/[escript]/branches/escript3047_with_pastix2995/SConstruct
ViewVC logotype

Diff of /branches/escript3047_with_pastix2995/SConstruct

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

revision 2161 by artak, Tue Dec 16 03:31:00 2008 UTC revision 2273 by jfenwick, Tue Feb 17 01:22:48 2009 UTC
# Line 75  opts.AddOptions( Line 75  opts.AddOptions(
75    BoolOption('useopenmp', 'Compile parallel version using OpenMP', 'yes'),    BoolOption('useopenmp', 'Compile parallel version using OpenMP', 'yes'),
76    BoolOption('usepedantic', 'Compile with -pedantic if using gcc', 'no'),    BoolOption('usepedantic', 'Compile with -pedantic if using gcc', 'no'),
77    BoolOption('usewarnings','Compile with warnings as errors if using gcc','yes'),    BoolOption('usewarnings','Compile with warnings as errors if using gcc','yes'),
78      ('forcelazy','for testing use only - set the default value for autolazy','leave_alone'),
79  # Python  # Python
80    ('python_path', 'Path to Python includes', '/usr/include/'+python_version),    ('python_path', 'Path to Python includes', '/usr/include/'+python_version),
81    ('python_lib_path', 'Path to Python libs', usr_lib),    ('python_lib_path', 'Path to Python libs', usr_lib),
# Line 119  opts.AddOptions( Line 120  opts.AddOptions(
120    ('umf_path', 'Path to UMFPACK includes', '/usr/include/suitesparse'),    ('umf_path', 'Path to UMFPACK includes', '/usr/include/suitesparse'),
121    ('umf_lib_path', 'Path to UMFPACK libs', usr_lib),    ('umf_lib_path', 'Path to UMFPACK libs', usr_lib),
122    ('umf_libs', 'UMFPACK libraries to link with', ['umfpack']),    ('umf_libs', 'UMFPACK libraries to link with', ['umfpack']),
123    # Silo
124      BoolOption('usesilo', 'switch on/off the usage of Silo', 'yes'),
125      ('silo_path', 'Path to Silo includes', '/usr/include'),
126      ('silo_lib_path', 'Path to Silo libs', usr_lib),
127      ('silo_libs', 'Silo libraries to link with', ['siloh5', 'hdf5']),
128  # AMD (used by UMFPACK)  # AMD (used by UMFPACK)
129    ('amd_path', 'Path to AMD includes', '/usr/include/suitesparse'),    ('amd_path', 'Path to AMD includes', '/usr/include/suitesparse'),
130    ('amd_lib_path', 'Path to AMD libs', usr_lib),    ('amd_lib_path', 'Path to AMD libs', usr_lib),
# Line 179  if env["CC"] == "icc": Line 185  if env["CC"] == "icc":
185    sysheaderopt      = ""    sysheaderopt      = ""
186  elif env["CC"] == "gcc":  elif env["CC"] == "gcc":
187    # GNU C on any system    # GNU C on any system
188    cc_flags      = "-pedantic -Wall -fPIC -ansi -ffast-math -Wno-unknown-pragmas -DBLOCKTIMER  -Wno-sign-compare -Wno-system-headers -Wno-long-long"    cc_flags      = "-pedantic -Wall -fPIC -ansi -ffast-math -Wno-unknown-pragmas -DBLOCKTIMER  -Wno-sign-compare -Wno-system-headers -Wno-long-long -Wno-strict-aliasing"
189  #the long long warning occurs on the Mac  #the long long warning occurs on the Mac
190    cc_optim      = "-O3"    cc_optim      = "-O3"
191    cc_debug      = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"    cc_debug      = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"
# Line 215  if env["omp_optim"]    == "-DEFAULT_4": env Line 221  if env["omp_optim"]    == "-DEFAULT_4": env
221  if env["omp_debug"] == "-DEFAULT_5": env['omp_debug'] = omp_debug  if env["omp_debug"] == "-DEFAULT_5": env['omp_debug'] = omp_debug
222  if env["omp_libs"]  == "-DEFAULT_6": env['omp_libs'] = omp_libs  if env["omp_libs"]  == "-DEFAULT_6": env['omp_libs'] = omp_libs
223    
224    #set up the autolazy values
225    if env['forcelazy']    != "leave_alone":
226      if env['forcelazy'] == 'on':
227        env.Append(CPPDEFINES='FAUTOLAZYON')
228      else:
229         if env['forcelazy'] == 'off':
230        env.Append(CPPDEFINES='FAUTOLAZYOFF')
231    
232  # OpenMP is disabled if useopenmp=no or both variables omp_optim and omp_debug are empty  # OpenMP is disabled if useopenmp=no or both variables omp_optim and omp_debug are empty
233  if not env["useopenmp"]:  if not env["useopenmp"]:
234    env['omp_optim'] = ""    env['omp_optim'] = ""
# Line 473  if env['useumfpack']: Line 487  if env['useumfpack']:
487  else:  else:
488    conf.Finish()    conf.Finish()
489    
490    ############ Silo (optional) ###################################
491    
492    if env['usesilo']:
493      conf = Configure(clone_env(env))
494      conf.env.AppendUnique(CPPPATH = [env['silo_path']])
495      conf.env.AppendUnique(LIBPATH = [env['silo_lib_path']])
496      conf.env.AppendUnique(LIBS = [env['silo_libs']])
497      if not conf.CheckCHeader('silo.h'): env['usesilo'] = 0
498      if not conf.CheckFunc('DBMkDir'): env['usesilo'] = 0
499      conf.Finish()
500    
501    # Add the path to Silo to environment env if it was found.
502    # Note that we do not add the libs since they are only needed for the
503    # escriptreader library and tools.
504    if env['usesilo']:
505      env.AppendUnique(CPPPATH = [env['silo_path']])
506      env.AppendUnique(LIBPATH = [env['silo_lib_path']])
507      env.Append(CPPDEFINES = ['HAVE_SILO'])
508    
509  ############ Add the compiler flags ############################  ############ Add the compiler flags ############################
510    
511  # Enable debug by choosing either cc_debug or cc_optim  # Enable debug by choosing either cc_debug or cc_optim
# Line 487  else: Line 520  else:
520  env.Append(CCFLAGS      = env['cc_flags'])  env.Append(CCFLAGS      = env['cc_flags'])
521  env.Append(LIBS         = [env['omp_libs']])  env.Append(LIBS         = [env['omp_libs']])
522    
523    
524    ############ Add some custom builders ##########################
525    
526    py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
527    env.Append(BUILDERS = {'PyCompile' : py_builder});
528    
529    runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix=env['PROGSUFFIX'], single_source=True)
530    env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
531    
532    runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
533    env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
534    
535  ############ MPI (optional) ####################################  ############ MPI (optional) ####################################
536    
537  # Create a modified environment for MPI programs (identical to env if usempi=no)  # Create a modified environment for MPI programs (identical to env if usempi=no)
# Line 561  if env['usemkl']: print "  Using MKL" Line 606  if env['usemkl']: print "  Using MKL"
606  else: print "   Not using MKL"  else: print "   Not using MKL"
607  if env['useumfpack']: print "   Using UMFPACK"  if env['useumfpack']: print "   Using UMFPACK"
608  else: print "   Not using UMFPACK"  else: print "   Not using UMFPACK"
609    if env['usesilo']: print "  Using Silo"
610    else: print "   Not using Silo"
611  if env['useopenmp']: print "    Using OpenMP"  if env['useopenmp']: print "    Using OpenMP"
612  else: print "   Not using OpenMP"  else: print "   Not using OpenMP"
613  if env['usempi']: print "   Using MPI"  if env['usempi']: print "   Using MPI"
# Line 583  Execute(Delete(env['libinstall'] + "/Com Line 630  Execute(Delete(env['libinstall'] + "/Com
630  Execute(Delete(env['libinstall'] + "/Compiled.with.openmp"))  Execute(Delete(env['libinstall'] + "/Compiled.with.openmp"))
631  if not env['usempi']: Execute(Delete(env['libinstall'] + "/pythonMPI"))  if not env['usempi']: Execute(Delete(env['libinstall'] + "/pythonMPI"))
632    
 ############ Add some custom builders ##########################  
633    
634  py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)  ############ Build the subdirectories ##########################
 env.Append(BUILDERS = {'PyCompile' : py_builder});  
   
 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix=env['PROGSUFFIX'], single_source=True)  
 env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});  
635    
636  runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)  from grouptest import *
 env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});  
637    
638  ############ Build the subdirectories ##########################  TestGroups=[]
639    
640  Export(  Export(
641    ["env",    ["env",
642     "env_mpi",     "env_mpi",
643     "clone_env",     "clone_env",
644     "IS_WINDOWS_PLATFORM"     "IS_WINDOWS_PLATFORM",
645       "TestGroups"
646     ]     ]
647    )    )
648    
649  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)
650    env.SConscript(dirs = ['tools/libescriptreader/src'], build_dir='build/$PLATFORM/tools/libescriptreader', duplicate=0)
651  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
652  env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)  env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
653  env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)  env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
# Line 617  env.SConscript(dirs = ['pythonMPI/src'], Line 660  env.SConscript(dirs = ['pythonMPI/src'],
660  env.SConscript(dirs = ['scripts'], build_dir='build/$PLATFORM/scripts', duplicate=0)  env.SConscript(dirs = ['scripts'], build_dir='build/$PLATFORM/scripts', duplicate=0)
661  env.SConscript(dirs = ['paso/profiling'], build_dir='build/$PLATFORM/paso/profiling', duplicate=0)  env.SConscript(dirs = ['paso/profiling'], build_dir='build/$PLATFORM/paso/profiling', duplicate=0)
662    
663    
664  ############ Remember what optimizations we used ###############  ############ Remember what optimizations we used ###############
665    
666  remember_list = []  remember_list = []
# Line 658  build_all_list += ['build_escript'] Line 702  build_all_list += ['build_escript']
702  build_all_list += ['build_finley']  build_all_list += ['build_finley']
703  if env['usempi']:       build_all_list += ['target_pythonMPI_exe']  if env['usempi']:       build_all_list += ['target_pythonMPI_exe']
704  if not IS_WINDOWS_PLATFORM: build_all_list += ['target_finley_wrapper']  if not IS_WINDOWS_PLATFORM: build_all_list += ['target_finley_wrapper']
705    if env['usesilo']:  build_all_list += ['target_escript2silo']
706  env.Alias('build_all', build_all_list)  env.Alias('build_all', build_all_list)
707    
708  install_all_list = []  install_all_list = []
# Line 671  install_all_list += ['target_install_mod Line 716  install_all_list += ['target_install_mod
716  install_all_list += ['target_install_pycad_py']  install_all_list += ['target_install_pycad_py']
717  if env['usempi']:       install_all_list += ['target_install_pythonMPI_exe']  if env['usempi']:       install_all_list += ['target_install_pythonMPI_exe']
718  if not IS_WINDOWS_PLATFORM: install_all_list += ['target_install_finley_wrapper']  if not IS_WINDOWS_PLATFORM: install_all_list += ['target_install_finley_wrapper']
719    if env['usesilo']:  install_all_list += ['target_install_escript2silo']
720  install_all_list += ['remember_options']  install_all_list += ['remember_options']
721  env.Alias('install_all', install_all_list)  env.Alias('install_all', install_all_list)
722    
# Line 688  env.Alias('all_tests', ['install_all', ' Line 734  env.Alias('all_tests', ['install_all', '
734    
735  env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'guide_html'])  env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'guide_html'])
736    
737    if not IS_WINDOWS_PLATFORM:
738       try:
739        utest=open("utest.sh","w")
740        utest.write(GroupTest.makeHeader())
741        for tests in TestGroups:
742            utest.write(tests.makeString())
743        utest.close()
744        print "utest.sh written"
745       except IOError:
746        print "Error attempting to write unittests file."
747        sys.exit(1)
748    

Legend:
Removed from v.2161  
changed lines
  Added in v.2273

  ViewVC Help
Powered by ViewVC 1.1.26