/[escript]/branches/scons-dev/SConstruct
ViewVC logotype

Diff of /branches/scons-dev/SConstruct

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

revision 1654 by ksteube, Wed Jul 16 00:31:11 2008 UTC revision 1655 by ksteube, Wed Jul 16 05:10:10 2008 UTC
# Line 66  opts.AddOptions( Line 66  opts.AddOptions(
66    BoolOption('usevtk', 'Do you want to use VTK?', 'yes'),    BoolOption('usevtk', 'Do you want to use VTK?', 'yes'),
67    ('options_file', "File of paths/options. Default: scons/<hostname>_options.py", options_file),    ('options_file', "File of paths/options. Default: scons/<hostname>_options.py", options_file),
68    ('cc_defines','C/C++ defines to use', None),    ('cc_defines','C/C++ defines to use', None),
   
69    ('cc_flags', 'C compiler flags to use', '-DEFAULT_1'),    ('cc_flags', 'C compiler flags to use', '-DEFAULT_1'),
70    ('cp_flags', 'C++ compiler flags to use', '-DEFAULT_2'),    ('cc_optim', 'C compiler optimization flags to use', '-DEFAULT_2'),
71    ('cc_optim', 'C compiler optimization flags to use', '-DEFAULT_3'),    ('cc_debug', 'C compiler debug flags to use', '-DEFAULT_3'),
72    ('cp_optim', 'C++ compiler optimization flags to use', '-DEFAULT_4'),    ('omp_optim', 'OpenMP compiler flags to use (Release build)', '-DEFAULT_4'),
73    ('cc_debug', 'C compiler debug flags to use', '-DEFAULT_5'),    ('omp_debug', 'OpenMP compiler flags to use (Debug build)', '-DEFAULT_5'),
   ('cp_debug', 'C++ compiler debug flags to use', '-DEFAULT_6'),  
   ('omp_flags', 'OpenMP compiler flags to use (Release build)', '-DEFAULT_7'),  
   ('omp_flags_debug', 'OpenMP compiler flags to use (Debug build)', '-DEFAULT_8'),  
74    ('sys_libs', 'System libraries to link with', []),    ('sys_libs', 'System libraries to link with', []),
75    ('ar_flags', 'Static library archiver flags to use', ''),    ('ar_flags', 'Static library archiver flags to use', ''),
76      BoolOption('useopenmp', 'Compile parallel version using OpenMP', 'yes'),
77  # Python  # Python
78    PathOption('python_path', 'Path to Python includes', '/usr/include/'+python_version),    PathOption('python_path', 'Path to Python includes', '/usr/include/'+python_version),
79    PathOption('python_lib_path', 'Path to Python libs', usr_lib),    PathOption('python_lib_path', 'Path to Python libs', usr_lib),
# Line 113  opts.AddOptions( Line 110  opts.AddOptions(
110    PathOption('mkl_path', 'Path to MKL includes', None),    PathOption('mkl_path', 'Path to MKL includes', None),
111    PathOption('mkl_lib_path', 'Path to MKL libs', None),    PathOption('mkl_lib_path', 'Path to MKL libs', None),
112    ('mkl_libs', 'MKL libraries to link with', []),    ('mkl_libs', 'MKL libraries to link with', []),
 # SCSL  
   PathOption('scsl_path', 'Path to SCSL includes', None),  
   PathOption('scsl_lib_path', 'Path to SCSL libs', None),  
   ('scsl_libs', 'SCSL libraries to link with', []),  
   ('scsl_libs_MPI', 'SCSL libraries to link with for MPI build', []),  
113  # UMFPACK  # UMFPACK
114    PathOption('ufc_path', 'Path to UFconfig includes', '/usr/include'),    PathOption('ufc_path', 'Path to UFconfig includes', '/usr/include'),
115    PathOption('umf_path', 'Path to UMFPACK includes', '/usr/include'),    PathOption('umf_path', 'Path to UMFPACK includes', '/usr/include'),
# Line 135  opts.AddOptions( Line 127  opts.AddOptions(
127    
128  # Specify which compilers to use (intelc uses regular expressions  # Specify which compilers to use (intelc uses regular expressions
129  # improperly and emits a warning about failing to find the compilers.  # improperly and emits a warning about failing to find the compilers.
130  # It can be safely ignored)  # This warning can be safely ignored)
131    
132  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
133        env = Environment(tools = ['default', 'msvc'], options = opts)        env = Environment(tools = ['default', 'msvc'], options = opts)
# Line 151  else: Line 143  else:
143  Help(opts.GenerateHelpText(env))  Help(opts.GenerateHelpText(env))
144    
145  # Default compiler options (override allowed in hostname_options.py, but should not be necessary)  # Default compiler options (override allowed in hostname_options.py, but should not be necessary)
146    # For both C and C++ you get: cc_flags and either the optim flags or debug flags
147  if env["CC"] == "icc":  if env["CC"] == "icc":
148    # Intel compilers    # Intel compilers
149    cc_flags      = "-ansi -wd161 -w1 -vec-report0 -DBLOCKTIMER -DCORE_ID1"    cc_flags      = "-fPIC -ansi -wd161 -w1 -vec-report0 -DBLOCKTIMER -DCORE_ID1"
   cp_flags      = "-ansi -wd161"  
150    cc_optim      = "-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias"    cc_optim      = "-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias"
   cp_optim      = "-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias"  
151    cc_debug      = "-g -O0 -UDOASSERT -DDOPROF"    cc_debug      = "-g -O0 -UDOASSERT -DDOPROF"
152    cp_debug      = "-g -O0 -UDOASSERT -DDOPROF"    omp_optim     = "-openmp -openmp_report0"
153    omp_flags     = "-openmp -openmp_report0"    omp_debug     = "-openmp -openmp_report0"
   omp_flags_debug   = "-openmp -openmp_report0"  
154  elif env["CC"] == "gcc":  elif env["CC"] == "gcc":
155    # GNU C on any system    # GNU C on any system
156    cc_flags      = "-ansi -ffast-math -Wno-unknown-pragmas -pedantic-errors -Wno-long-long -DBLOCKTIMER"    cc_flags      = "-fPIC -ansi -ffast-math -Wno-unknown-pragmas -pedantic-errors -Wno-long-long -DBLOCKTIMER"
   cp_flags      = "-ansi --no-warn"  
157    cc_optim      = "-O3"    cc_optim      = "-O3"
   cp_optim      = "-O3"  
158    cc_debug      = "-g -O0 -UDOASSERT -DDOPROF"    cc_debug      = "-g -O0 -UDOASSERT -DDOPROF"
159    cp_debug      = "-g -O0 -UDOASSERT -DDOPROF"    omp_optim     = ""
160    omp_flags     = ""    omp_debug     = ""
   omp_flags_debug   = ""  
161  elif env["CC"] == "cl":  elif env["CC"] == "cl":
162    # Microsoft Visual C on Windows    # Microsoft Visual C on Windows
163    cc_flags      = "/FD /EHsc /GR /wd4068 -D_USE_MATH_DEFINES -DDLL_NETCDF"    cc_flags      = "/FD /EHsc /GR /wd4068 -D_USE_MATH_DEFINES -DDLL_NETCDF"
   cp_flags      = "/FD /EHsc /GR /wd4068"  
164    cc_optim      = "/O2 /Op /MT /W3"    cc_optim      = "/O2 /Op /MT /W3"
   cp_optim      = "/O2 /Op /MT /W3"  
165    cc_debug      = "/Od /RTC1 /MTd /ZI"    cc_debug      = "/Od /RTC1 /MTd /ZI"
166    cp_debug      = "/Od /RTC1 /MTd /ZI"    omp_optim     = ""
167    omp_flags     = ""    omp_debug     = ""
   omp_flags_debug   = ""  
168    
169  # If not specified in hostname_options.py then set them here  # If not specified in hostname_options.py then set them here
170  if env["cc_flags"]      == "-DEFAULT_1": env['cc_flags'] = cc_flags  if env["cc_flags"]      == "-DEFAULT_1": env['cc_flags'] = cc_flags
171  if env["cp_flags"]      == "-DEFAULT_2": env['cp_flags'] = cp_flags  if env["cc_optim"]      == "-DEFAULT_2": env['cc_optim'] = cc_optim
172  if env["cc_optim"]      == "-DEFAULT_3": env['cc_optim'] = cc_optim  if env["cc_debug"]      == "-DEFAULT_3": env['cc_debug'] = cc_debug
173  if env["cp_optim"]      == "-DEFAULT_4": env['cp_optim'] = cp_optim  if env["omp_optim"]     == "-DEFAULT_4": env['omp_optim'] = omp_optim
174  if env["cc_debug"]      == "-DEFAULT_5": env['cc_debug'] = cc_debug  if env["omp_debug"]     == "-DEFAULT_5": env['omp_debug'] = omp_debug
175  if env["cp_debug"]      == "-DEFAULT_6": env['cp_debug'] = cp_debug  
176  if env["omp_flags"]     == "-DEFAULT_7": env['omp_flags'] = omp_flags  # OpenMP is disabled if useopenmp=no or both variables omp_optim and omp_debug are empty
177  if env["omp_flags_debug"]   == "-DEFAULT_8": env['omp_flags_debug'] = omp_flags_debug  if not env["useopenmp"]:
178      env['omp_optim'] = ""
179      env['omp_debug'] = ""
180    
181    if env['omp_optim'] == "" and env['omp_debug'] == "": env["useopenmp"] = 0
182    
183  # Get the global Subversion revision number for getVersion() method  # Get the global Subversion revision number for getVersion() method
184  try:  try:
# Line 325  conf.Finish() Line 313  conf.Finish()
313  # Enable debug  # Enable debug
314  if env['usedebug']:  if env['usedebug']:
315    env.Append(CCFLAGS        = env['cc_debug'])    env.Append(CCFLAGS        = env['cc_debug'])
316    env.Append(CCFLAGS        = env['omp_flags_debug'])    env.Append(CCFLAGS        = env['omp_debug'])
317    env.Append(CCFLAGS        = env['cc_flags'])    env.Append(CCFLAGS        = env['cc_flags'])
318    env.Append(CPPDEFINES     = ['BOUNDS_CHECK'])    env.Append(CPPDEFINES     = ['BOUNDS_CHECK'])
319  else:  else:
320    env.Append(CCFLAGS        = env['cc_optim'])    env.Append(CCFLAGS        = env['cc_optim'])
321    env.Append(CCFLAGS        = env['omp_flags'])    env.Append(CCFLAGS        = env['omp_optim'])
322    env.Append(CCFLAGS        = env['cc_flags'])    env.Append(CCFLAGS        = env['cc_flags'])
323    
324  # Python  # Python
# Line 385  env.Append(ARFLAGS = env['ar_flags']) Line 373  env.Append(ARFLAGS = env['ar_flags'])
373    
374  ############ End of modify environment #########################  ############ End of modify environment #########################
375    
376    print ""
377    print "Summary of configuration"
378    print " Using python"
379    print " Using numarray"
380    print " Using boost"
381    if env['usenetcdf']: print "    Using NetCDF"
382    else: print "   Not using NetCDF"
383    if env['usevtk']: print "   Using VTK"
384    else: print "   Not using VTK"
385    if env['useopenmp']: print "    Using OpenMP"
386    else: print "   Not using OpenMP"
387    if env['usempi']: print "   Using MPI"
388    else: print "   Not using MPI"
389    if env['useparmetis']: print "  Using ParMETIS"
390    else: print "   Not using ParMETIS"
391    if env['usedebug']: print " Compiling for debug"
392    else: print "   Not compiling for debug"
393    print ""
394    
395  #==========================================================================  #==========================================================================
396  #  #
397  #    Add some custom builders  #    Add some custom builders
# Line 392  env.Append(ARFLAGS = env['ar_flags']) Line 399  env.Append(ARFLAGS = env['ar_flags'])
399  py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)  py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
400  env.Append(BUILDERS = {'PyCompile' : py_builder});  env.Append(BUILDERS = {'PyCompile' : py_builder});
401    
402  runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed',  runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix=env['PROGSUFFIX'], single_source=True)
                               src_suffix=env['PROGSUFFIX'], single_source=True)  
403  env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});  env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
404    
405  runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)  runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
# Line 404  if not IS_WINDOWS_PLATFORM: Line 410  if not IS_WINDOWS_PLATFORM:
410    env.Execute("/bin/rm -f " + libinstall + "/Compiled.with.*")    env.Execute("/bin/rm -f " + libinstall + "/Compiled.with.*")
411    if env['usedebug']:       env.Execute("touch " + libinstall + "/Compiled.with.debug")    if env['usedebug']:       env.Execute("touch " + libinstall + "/Compiled.with.debug")
412    if env['usempi']:     env.Execute("touch " + libinstall + "/Compiled.with.mpi")    if env['usempi']:     env.Execute("touch " + libinstall + "/Compiled.with.mpi")
413    if env['omp_flags'] != '':    env.Execute("touch " + libinstall + "/Compiled.with.OpenMP")    if env['omp_optim'] != '':    env.Execute("touch " + libinstall + "/Compiled.with.OpenMP")
414    
415  Export(["env", "env_mpi", "incinstall", "libinstall", "pyinstall", "sys_libs", "prefix" ])  Export(["env", "env_mpi", "incinstall", "libinstall", "pyinstall", "sys_libs", "prefix" ])
416    
# Line 445  build_all_list += ['build_paso'] Line 451  build_all_list += ['build_paso']
451  build_all_list += ['build_escript']  build_all_list += ['build_escript']
452  build_all_list += ['build_finley']  build_all_list += ['build_finley']
453  # build_all_list += ['build_bruce']  # build_all_list += ['build_bruce']
454    if env['usempi']: build_all_list += ['target_pythonMPI_exe']
455    
456  install_all_list = []  install_all_list = []
457  install_all_list += ['target_init']  install_all_list += ['target_init']
# Line 457  install_all_list += ['target_install_mod Line 464  install_all_list += ['target_install_mod
464  install_all_list += ['target_install_pycad_py']  install_all_list += ['target_install_pycad_py']
465  # install_all_list += ['target_install_bruce']  # install_all_list += ['target_install_bruce']
466  # install_all_list += ['target_install_bruce_py']  # install_all_list += ['target_install_bruce_py']
467    if env['usempi']: install_all_list += ['target_install_pythonMPI_exe']
468    
469  env.Alias('build_all', build_all_list)  env.Alias('build_all', build_all_list)
470  env.Alias('install_all', install_all_list)  env.Alias('install_all', install_all_list)

Legend:
Removed from v.1654  
changed lines
  Added in v.1655

  ViewVC Help
Powered by ViewVC 1.1.26