/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1339 by ksteube, Wed Nov 7 01:53:12 2007 UTC revision 1663 by artak, Tue Jul 22 02:56:21 2008 UTC
# Line 20  import sys, os, re Line 20  import sys, os, re
20  if sys.path.count('scons')==0: sys.path.append('scons')  if sys.path.count('scons')==0: sys.path.append('scons')
21  import scons_extensions  import scons_extensions
22    
23    # We may also need to know where python's site-packages subdirectory lives
24    python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1])
25    
26  #===============================================================  #===============================================================
27    
28  tools_prefix="/usr"  tools_prefix="/usr"
# Line 28  tools_prefix="/usr" Line 31  tools_prefix="/usr"
31  #      #    
32  #    get the installation prefix  #    get the installation prefix
33  #  #
34  prefix = ARGUMENTS.get('prefix', '/usr')  prefix = ARGUMENTS.get('prefix', sys.prefix )
35    
36  # We may also need to know where python's site-packages subdirectory lives  # We may also need to know where python's site-packages subdirectory lives
37  python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1])  python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1])
   
38  # Install as a standard python package in /usr/lib64 if available, else in /usr/lib  # Install as a standard python package in /usr/lib64 if available, else in /usr/lib
39  if os.path.isdir(  prefix+"/lib64/"+python_version+"/site-packages"):  if os.path.isdir(  prefix+"/lib64/"+python_version+"/site-packages"):
40     sys_dir_packages =  prefix+"/lib64/"+python_version+"/site-packages/esys"     sys_dir_packages =  prefix+"/lib64/"+python_version+"/site-packages/esys"
# Line 213  opts.AddOptions( Line 215  opts.AddOptions(
215    ('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default),    ('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default),
216    ('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default),    ('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default),
217    ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', cxx_flags_debug_default),    ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', cxx_flags_debug_default),
218      ('link_flags', 'Linker flags to use (Release build)', None),
219      ('link_flags_debug', 'Linker flags to use (Debug build)', None),
220    
221    ('omp_flags', 'OpenMP compiler flags to use (Release build)', ''),    ('omp_flags', 'OpenMP compiler flags to use (Release build)', ''),
222    ('omp_flags_debug', 'OpenMP compiler flags to use (Debug build)', ''),    ('omp_flags_debug', 'OpenMP compiler flags to use (Debug build)', ''),
223    ('ar_flags', 'Static library archiver flags to use', None),    ('ar_flags', 'Static library archiver flags to use', None),
# Line 236  opts.AddOptions( Line 241  opts.AddOptions(
241    PathOption('amd_path', 'Path to AMD includes', amd_path_default),    PathOption('amd_path', 'Path to AMD includes', amd_path_default),
242    PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default),    PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default),
243    ('amd_libs', 'AMD libraries to link with', amd_libs_default),    ('amd_libs', 'AMD libraries to link with', amd_libs_default),
244    # ParMETIS
245      ('parmetis_path', 'Path to ParMETIS includes', ''),
246      ('parmetis_lib_path', 'Path to ParMETIS library', ''),
247      ('parmetis_lib', 'ParMETIS library to link with', []),
248  # TRILINOS  # TRILINOS
249    PathOption('trilinos_path', 'Path to TRILINOS includes', None),    PathOption('trilinos_path', 'Path to TRILINOS includes', None),
250    PathOption('trilinos_lib_path', 'Path to TRILINOS libs', None),    PathOption('trilinos_lib_path', 'Path to TRILINOS libs', None),
# Line 289  opts.AddOptions( Line 298  opts.AddOptions(
298    
299  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
300        env = Environment(tools = ['default', 'msvc'], options = opts)        env = Environment(tools = ['default', 'msvc'], options = opts)
301          #env = Environment(tools = ['default', 'intelc'], options = opts)
302  else:  else:
303     if os.uname()[4]=='ia64':     if socket.gethostname().split('.')[0] == 'service0':
304          env = Environment(tools = ['default', 'intelc'], options = opts)
305       elif os.uname()[4]=='ia64':
306        env = Environment(tools = ['default', 'intelc'], options = opts)        env = Environment(tools = ['default', 'intelc'], options = opts)
307        if env['CXX'] == 'icpc':        if env['CXX'] == 'icpc':
308           env['LINK'] = env['CXX'] # version >=9 of intel c++ compiler requires use of icpc to link in C++ runtimes (icc does not). FIXME: this behaviour could be directly incorporated into scons intelc.py           env['LINK'] = env['CXX'] # version >=9 of intel c++ compiler requires use of icpc to link in C++ runtimes (icc does not). FIXME: this behaviour could be directly incorporated into scons intelc.py
# Line 301  Help(opts.GenerateHelpText(env)) Line 313  Help(opts.GenerateHelpText(env))
313  if env['bounds_check']:  if env['bounds_check']:
314     env.Append(CPPDEFINES = [ 'BOUNDS_CHECK' ])     env.Append(CPPDEFINES = [ 'BOUNDS_CHECK' ])
315     env.Append(CXXDEFINES = [ 'BOUNDS_CHECK' ])     env.Append(CXXDEFINES = [ 'BOUNDS_CHECK' ])
316       bounds_check = env['bounds_check']
317    else:
318       bounds_check = 0
319    
320  #=================================================================================================  #=================================================================================================
321  #  #
# Line 470  else: Line 485  else:
485          env.Append(CXXFLAGS = flags)          env.Append(CXXFLAGS = flags)
486       except KeyError:       except KeyError:
487          pass          pass
488    
489    # Impassioned plea - please do this sort of thing in the options files.
490  try:  try:
491       if env['CC'] == 'gcc': env.Append(CCFLAGS = "-pedantic-errors -Wno-long-long")       #if env['CC'] == 'gcc': env.Append(CCFLAGS = "-pedantic-errors -Wno-long-long")
492         pass
493  except:  except:
494       pass       pass
495    
496    if dodebug:
497         try:
498            flags = env['link_flags_debug']
499            env.Append(LINKFLAGS = flags)
500         except KeyError:
501            pass
502    else:
503         try:
504            flags = env['link_flags']
505            env.Append(LINKFLAGS = flags)
506         except KeyError:
507            pass
508    
509    # ============= Remember what options were used in the compile =====================================
510    if not IS_WINDOWS_PLATFORM:
511      env.Execute("/bin/rm -f " + libinstall + "/Compiled.with.*")
512      if dodebug:       env.Execute("touch " + libinstall + "/Compiled.with.debug")
513      if useMPI:        env.Execute("touch " + libinstall + "/Compiled.with.mpi")
514      if omp_flags != '':   env.Execute("touch " + libinstall + "/Compiled.with.OpenMP")
515      if bounds_check:  env.Execute("touch " + libinstall + "/Compiled.with.bounds_check")
516    
517  # ============= set mkl (but only of no MPI) =====================================  # ============= set mkl (but only of no MPI) =====================================
518  if not useMPI:  if not useMPI:
519     try:     try:
# Line 486  if not useMPI: Line 525  if not useMPI:
525     try:     try:
526        lib_path = env['mkl_lib_path']        lib_path = env['mkl_lib_path']
527        env.Append(LIBPATH = [lib_path,])        env.Append(LIBPATH = [lib_path,])
528          env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
529     except KeyError:     except KeyError:
530        pass        pass
531    
# Line 507  if not useMPI: Line 547  if not useMPI:
547     try:     try:
548        lib_path = env['scsl_lib_path']        lib_path = env['scsl_lib_path']
549        env.Append(LIBPATH = [lib_path,])        env.Append(LIBPATH = [lib_path,])
550          env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
551     except KeyError:     except KeyError:
552        pass        pass
553        
# Line 624  try: Line 665  try:
665  except KeyError:  except KeyError:
666     blas_libs = [ ]     blas_libs = [ ]
667    
668  # ========== netcdf (currently not supported with mpi) ====================================  # ========== netcdf ====================================
669  if useMPI:  try:
670     useNetCDF = 'no'     useNetCDF = env['useNetCDF']
671  else:  except KeyError:
672     try:     useNetCDF = 'yes'
673        useNetCDF = env['useNetCDF']     pass
    except KeyError:  
       useNetCDF = 'yes'  
       pass  
674            
675  if useNetCDF == 'yes':  if useNetCDF == 'yes':
676     try:     try:
# Line 651  if useNetCDF == 'yes': Line 689  if useNetCDF == 'yes':
689     try:     try:
690        lib_path = env['netCDF_lib_path']        lib_path = env['netCDF_lib_path']
691        env.Append(LIBPATH = [ lib_path, ])        env.Append(LIBPATH = [ lib_path, ])
692          env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
693        if IS_WINDOWS_PLATFORM :        if IS_WINDOWS_PLATFORM :
694           env.PrependENVPath('PATH', lib_path)           env.PrependENVPath('PATH', lib_path)
695     except KeyError:     except KeyError:
# Line 668  except KeyError: Line 707  except KeyError:
707  try:  try:
708     lib_path = env['boost_lib_path']     lib_path = env['boost_lib_path']
709     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
710       env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
711     if IS_WINDOWS_PLATFORM :     if IS_WINDOWS_PLATFORM :
712        env.PrependENVPath('PATH', lib_path)        env.PrependENVPath('PATH', lib_path)
713  except KeyError:  except KeyError:
# Line 684  except KeyError: Line 724  except KeyError:
724     pass     pass
725  try:  try:
726     lib_path = env['python_lib_path']     lib_path = env['python_lib_path']
727       env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
728     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
729  except KeyError:  except KeyError:
730     pass     pass
# Line 700  try: Line 741  try:
741     epydoc_path = env['epydoc_path']     epydoc_path = env['epydoc_path']
742  except KeyError:  except KeyError:
743     epydoc_path = None     epydoc_path = None
744    # =============== ParMETIS =======================================
745    try:
746       parmetis_path = env['parmetis_path']
747       parmetis_lib_path = env['parmetis_lib_path']
748       parmetis_lib = env['parmetis_lib']
749    except KeyError:
750       parmetis_path = ''
751       parmetis_lib_path = ''
752       parmetis_lib = ''
753    
754    if useMPI and os.path.isdir(parmetis_lib_path):
755       env.Append(CPPDEFINES = [ 'PARMETIS' ])
756       env.Append(CXXDEFINES = [ 'PARMETIS' ])
757       env.Append(CPPPATH = [parmetis_path])
758       env.Append(LIBPATH = [parmetis_lib_path])
759       env.Append(LIBS = parmetis_lib)
760  # =============== PAPI =======================================  # =============== PAPI =======================================
761  try:  try:
762     includes = env['papi_path']     includes = env['papi_path']
# Line 717  except KeyError: Line 774  except KeyError:
774     papi_libs = None     papi_libs = None
775  # ============= set mpi =====================================  # ============= set mpi =====================================
776  if useMPI:  if useMPI:
777     env.Append(CPPDEFINES=['PASO_MPI',])     env.Append(CPPDEFINES=['PASO_MPI', 'MPI_NO_CPPBIND'])
778     try:     try:
779        includes = env['mpi_path']        includes = env['mpi_path']
780        env.Append(CPPPATH = [includes,])        env.Append(CPPPATH = [includes,])
# Line 830  try: Line 887  try:
887     global_revision = re.sub(":.*", "", global_revision[0])     global_revision = re.sub(":.*", "", global_revision[0])
888     global_revision = re.sub("[^0-9]", "", global_revision)     global_revision = re.sub("[^0-9]", "", global_revision)
889  except:  except:
890     global_revision = "0"     global_revision="-1"
891       print "Warning: unable to recover global revsion number."
892    if global_revision == "": global_revision="0"
893    print "Revision number is %s."%global_revision
894  env.Append(CPPDEFINES = "SVN_VERSION="+global_revision)  env.Append(CPPDEFINES = "SVN_VERSION="+global_revision)
895    
896  # Python install - esys __init__.py  # Python install - esys __init__.py
# Line 886  except AttributeError: Line 946  except AttributeError:
946  # Third Party libraries  # Third Party libraries
947  env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)  env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
948  # C/C++ Libraries  # C/C++ Libraries
949    env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
950    env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
951  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
952  # bruce is removed for now as it doesn't really do anything  # bruce is removed for now as it doesn't really do anything
953  # env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)  # env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
 env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)  
 env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)  
954  env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)  env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
955  env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)  env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)
956  env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)  env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)

Legend:
Removed from v.1339  
changed lines
  Added in v.1663

  ViewVC Help
Powered by ViewVC 1.1.26