/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 1930 by phornby, Fri Oct 24 09:35:55 2008 UTC revision 2184 by caltinay, Mon Dec 22 04:27:26 2008 UTC
# Line 73  opts.AddOptions( Line 73  opts.AddOptions(
73    ('sys_libs', 'System libraries to link with', []),    ('sys_libs', 'System libraries to link with', []),
74    ('ar_flags', 'Static library archiver flags to use', ''),    ('ar_flags', 'Static library archiver flags to use', ''),
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', 'yes'),    BoolOption('usepedantic', 'Compile with -pedantic if using gcc', 'no'),
77      BoolOption('usewarnings','Compile with warnings as errors if using gcc','yes'),
78  # Python  # Python
79    ('python_path', 'Path to Python includes', '/usr/include/'+python_version),    ('python_path', 'Path to Python includes', '/usr/include/'+python_version),
80    ('python_lib_path', 'Path to Python libs', usr_lib),    ('python_lib_path', 'Path to Python libs', usr_lib),
# Line 118  opts.AddOptions( Line 119  opts.AddOptions(
119    ('umf_path', 'Path to UMFPACK includes', '/usr/include/suitesparse'),    ('umf_path', 'Path to UMFPACK includes', '/usr/include/suitesparse'),
120    ('umf_lib_path', 'Path to UMFPACK libs', usr_lib),    ('umf_lib_path', 'Path to UMFPACK libs', usr_lib),
121    ('umf_libs', 'UMFPACK libraries to link with', ['umfpack']),    ('umf_libs', 'UMFPACK libraries to link with', ['umfpack']),
122    # Silo
123      BoolOption('usesilo', 'switch on/off the usage of Silo', 'yes'),
124      ('silo_path', 'Path to Silo includes', '/usr/include'),
125      ('silo_lib_path', 'Path to Silo libs', usr_lib),
126      ('silo_libs', 'Silo libraries to link with', ['siloh5', 'hdf5']),
127  # AMD (used by UMFPACK)  # AMD (used by UMFPACK)
128    ('amd_path', 'Path to AMD includes', '/usr/include/suitesparse'),    ('amd_path', 'Path to AMD includes', '/usr/include/suitesparse'),
129    ('amd_lib_path', 'Path to AMD libs', usr_lib),    ('amd_lib_path', 'Path to AMD libs', usr_lib),
# Line 125  opts.AddOptions( Line 131  opts.AddOptions(
131  # BLAS (used by UMFPACK)  # BLAS (used by UMFPACK)
132    ('blas_path', 'Path to BLAS includes', '/usr/include/suitesparse'),    ('blas_path', 'Path to BLAS includes', '/usr/include/suitesparse'),
133    ('blas_lib_path', 'Path to BLAS libs', usr_lib),    ('blas_lib_path', 'Path to BLAS libs', usr_lib),
134    ('blas_libs', 'BLAS libraries to link with', ['blas'])    ('blas_libs', 'BLAS libraries to link with', ['blas']),
135    # An option for specifying the compiler tools set (see windows branch).
136      ('tools_names', 'allow control over the tools in the env setup', ['intelc']),
137    # finer control over library building, intel aggressive global optimisation
138    # works with dynamic libraries on windows.
139      ('share_esysUtils', 'control static or dynamic esysUtils lib', False),
140      ('share_paso', 'control static or dynamic paso lib', False)
141  )  )
142    
143  ############ Specify which compilers to use ####################  ############ Specify which compilers to use ####################
# Line 134  opts.AddOptions( Line 146  opts.AddOptions(
146  # failing to find the compilers.  This warning can be safely ignored.  # failing to find the compilers.  This warning can be safely ignored.
147    
148  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
149        env = Environment(tools = ['default', 'msvc'], options = opts)        env = Environment(options = opts)
150        #env = Environment(tools = ['default', 'intelc'], options = opts)        env = Environment(tools = ['default'] + env['tools_names'],
151                            options = opts)
152  else:  else:
153     if socket.gethostname().split('.')[0] == 'service0':     if socket.gethostname().split('.')[0] == 'service0':
154        env = Environment(tools = ['default', 'intelc'], options = opts)        env = Environment(tools = ['default', 'intelc'], options = opts)
# Line 156  if env['useMPI']: env['usempi'] = 1 Line 169  if env['useMPI']: env['usempi'] = 1
169  # 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)
170  # For both C and C++ you get: cc_flags and either the optim flags or debug flags  # For both C and C++ you get: cc_flags and either the optim flags or debug flags
171    
172    sysheaderopt = ""       # how do we indicate that a header is a system header. Use "" for no action.
173    
174  if env["CC"] == "icc":  if env["CC"] == "icc":
175    # Intel compilers    # Intel compilers
176    cc_flags      = "-fPIC -ansi -wd161 -w1 -vec-report0 -DBLOCKTIMER -DCORE_ID1"    cc_flags      = "-fPIC -ansi -wd161 -w1 -vec-report0 -DBLOCKTIMER -DCORE_ID1"
# Line 165  if env["CC"] == "icc": Line 180  if env["CC"] == "icc":
180    omp_debug     = "-openmp -openmp_report0"    omp_debug     = "-openmp -openmp_report0"
181    omp_libs      = ['guide', 'pthread']    omp_libs      = ['guide', 'pthread']
182    pedantic      = ""    pedantic      = ""
183      fatalwarning      = ""        # Switch to turn warnings into errors
184      sysheaderopt      = ""
185  elif env["CC"] == "gcc":  elif env["CC"] == "gcc":
186    # GNU C on any system    # GNU C on any system
187    cc_flags      = "-fPIC -ansi -ffast-math -Wno-unknown-pragmas -DBLOCKTIMER"    cc_flags      = "-pedantic -Wall -fPIC -ansi -ffast-math -Wno-unknown-pragmas -DBLOCKTIMER  -Wno-sign-compare -Wno-system-headers -Wno-long-long"
188    #the long long warning occurs on the Mac
189    cc_optim      = "-O3"    cc_optim      = "-O3"
190    cc_debug      = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"    cc_debug      = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"
191    omp_optim     = ""    omp_optim     = ""
192    omp_debug     = ""    omp_debug     = ""
193    omp_libs      = []    omp_libs      = []
194    pedantic      = "-pedantic-errors -Wno-long-long"    pedantic      = "-pedantic-errors -Wno-long-long"
195      fatalwarning      = "-Werror"
196      sysheaderopt      = "-isystem "
197  elif env["CC"] == "cl":  elif env["CC"] == "cl":
198    # Microsoft Visual C on Windows    # Microsoft Visual C on Windows
199    cc_flags      = "/FD /EHsc /GR /wd4068 -D_USE_MATH_DEFINES -DDLL_NETCDF"    cc_flags      = "/FD /EHsc /GR /wd4068 -D_USE_MATH_DEFINES -DDLL_NETCDF"
# Line 183  elif env["CC"] == "cl": Line 203  elif env["CC"] == "cl":
203    omp_debug     = ""    omp_debug     = ""
204    omp_libs      = []    omp_libs      = []
205    pedantic      = ""    pedantic      = ""
206      fatalwarning      = ""
207      sysheaderopt      = ""
208  elif env["CC"] == "icl":  elif env["CC"] == "icl":
209    # intel C on Windows, see windows_msvc71_options.py for a start    # intel C on Windows, see windows_intelc_options.py for a start
210    pedantic      = ""    pedantic      = ""
211      fatalwarning      = ""
212      sysheaderopt      = ""
213    
214    
215  # If not specified in hostname_options.py then set them here  # If not specified in hostname_options.py then set them here
216  if env["cc_flags"]  == "-DEFAULT_1": env['cc_flags'] = cc_flags  if env["cc_flags"]  == "-DEFAULT_1": env['cc_flags'] = cc_flags
# Line 255  env.Append(CPPPATH     = [Dir('include')]) Line 280  env.Append(CPPPATH     = [Dir('include')])
280  # Add cc option -L<Escript>/trunk/lib  # Add cc option -L<Escript>/trunk/lib
281  env.Append(LIBPATH      = [Dir(env['libinstall'])])  env.Append(LIBPATH      = [Dir(env['libinstall'])])
282    
 env.Append(CPPDEFINES = ['ESCRIPT_EXPORTS', 'FINLEY_EXPORTS'])  
   
283  if env['cc_extra'] != '': env.Append(CCFLAGS = env['cc_extra'])  if env['cc_extra'] != '': env.Append(CCFLAGS = env['cc_extra'])
284  if env['ld_extra'] != '': env.Append(LINKFLAGS = env['ld_extra'])  if env['ld_extra'] != '': env.Append(LINKFLAGS = env['ld_extra'])
285    
# Line 266  if env['usepedantic']: env.Append(CCFLAG Line 289  if env['usepedantic']: env.Append(CCFLAG
289  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
290    env.PrependENVPath('PATH',    [env['boost_lib_path']])    env.PrependENVPath('PATH',    [env['boost_lib_path']])
291    env.PrependENVPath('PATH',    [env['libinstall']])    env.PrependENVPath('PATH',    [env['libinstall']])
292      if not env['share_esysUtils'] :
293        env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])
294      if not env['share_paso'] :
295        env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])
296    
297    if env['usenetcdf']:    if env['usenetcdf']:
298      env.PrependENVPath('PATH',  [env['netCDF_lib_path']])      env.PrependENVPath('PATH',  [env['netCDF_lib_path']])
299    
# Line 304  if conf.CheckFunc('gethostname'): Line 332  if conf.CheckFunc('gethostname'):
332    
333  ############ python libraries (required) #######################  ############ python libraries (required) #######################
334    
335  conf.env.AppendUnique(CPPPATH       = [env['python_path']])  
336    if not sysheaderopt =="":
337      conf.env.Append(CCFLAGS=sysheaderopt+env['python_path'])
338    else:
339      conf.env.AppendUnique(CPPPATH     = [env['python_path']])
340    
341  conf.env.AppendUnique(LIBPATH       = [env['python_lib_path']])  conf.env.AppendUnique(LIBPATH       = [env['python_lib_path']])
342  conf.env.AppendUnique(LIBS      = [env['python_libs']])  conf.env.AppendUnique(LIBS      = [env['python_libs']])
343    
# Line 319  if not conf.CheckFunc('Py_Main'): Line 352  if not conf.CheckFunc('Py_Main'):
352    
353  ############ boost (required) ##################################  ############ boost (required) ##################################
354    
355  conf.env.AppendUnique(CPPPATH       = [env['boost_path']])  if not sysheaderopt =="":
356      conf.env.Append(CCFLAGS=sysheaderopt+env['boost_path']+'boost')
357    else:
358      conf.env.AppendUnique(CPPPATH     = [env['boost_path']])
359    
360  conf.env.AppendUnique(LIBPATH       = [env['boost_lib_path']])  conf.env.AppendUnique(LIBPATH       = [env['boost_lib_path']])
361  conf.env.AppendUnique(LIBS      = [env['boost_libs']])  conf.env.AppendUnique(LIBS      = [env['boost_libs']])
362    
# Line 432  if env['useumfpack']: Line 469  if env['useumfpack']:
469    
470  if env['useumfpack'] and not conf.CheckCHeader('umfpack.h'): env['useumfpack'] = 0  if env['useumfpack'] and not conf.CheckCHeader('umfpack.h'): env['useumfpack'] = 0
471  if env['useumfpack'] and not conf.CheckFunc('umfpack_di_symbolic'): env['useumfpack'] = 0  if env['useumfpack'] and not conf.CheckFunc('umfpack_di_symbolic'): env['useumfpack'] = 0
472    if env['useumfpack'] and not conf.CheckFunc('daxpy'): env['useumfpack'] = 0 # this does not work on shake73?
473    
474  # Add UMFPACK to environment env if it was found  # Add UMFPACK to environment env if it was found
475  if env['useumfpack']:  if env['useumfpack']:
# Line 440  if env['useumfpack']: Line 478  if env['useumfpack']:
478  else:  else:
479    conf.Finish()    conf.Finish()
480    
481    ############ Silo (optional) ###################################
482    
483    if env['usesilo']:
484      conf = Configure(clone_env(env))
485      conf.env.AppendUnique(CPPPATH = [env['silo_path']])
486      conf.env.AppendUnique(LIBPATH = [env['silo_lib_path']])
487      conf.env.AppendUnique(LIBS = [env['silo_libs']])
488      if not conf.CheckCHeader('silo.h'): env['usesilo'] = 0
489      if not conf.CheckFunc('DBMkDir'): env['usesilo'] = 0
490      conf.Finish()
491    
492    # Add the path to Silo to environment env if it was found.
493    # Note that we do not add the libs since they are only needed for the
494    # escriptreader library and tools.
495    if env['usesilo']:
496      env.AppendUnique(CPPPATH = [env['silo_path']])
497      env.AppendUnique(LIBPATH = [env['silo_lib_path']])
498      env.Append(CPPDEFINES = ['HAVE_SILO'])
499    
500  ############ Add the compiler flags ############################  ############ Add the compiler flags ############################
501    
502  # Enable debug by choosing either cc_debug or cc_optim  # Enable debug by choosing either cc_debug or cc_optim
# Line 505  else: Line 562  else:
562    
563  env['useparmetis'] = env_mpi['useparmetis']  env['useparmetis'] = env_mpi['useparmetis']
564    
565    ############ Now we switch on Warnings as errors ###############
566    
567    #this needs to be done after configuration because the scons test files have warnings in them
568    
569    if ((fatalwarning != "") and (env['usewarnings'])):
570      env.Append(CCFLAGS        = fatalwarning)
571      env_mpi.Append(CCFLAGS        = fatalwarning)
572    
573  ############ Summarize our environment #########################  ############ Summarize our environment #########################
574    
575  print ""  print ""
# Line 520  if env['usemkl']: print "  Using MKL" Line 585  if env['usemkl']: print "  Using MKL"
585  else: print "   Not using MKL"  else: print "   Not using MKL"
586  if env['useumfpack']: print "   Using UMFPACK"  if env['useumfpack']: print "   Using UMFPACK"
587  else: print "   Not using UMFPACK"  else: print "   Not using UMFPACK"
588    if env['usesilo']: print "  Using Silo"
589    else: print "   Not using Silo"
590  if env['useopenmp']: print "    Using OpenMP"  if env['useopenmp']: print "    Using OpenMP"
591  else: print "   Not using OpenMP"  else: print "   Not using OpenMP"
592  if env['usempi']: print "   Using MPI"  if env['usempi']: print "   Using MPI"
# Line 531  else: print "  Not using PAPI" Line 598  else: print "  Not using PAPI"
598  if env['usedebug']: print " Compiling for debug"  if env['usedebug']: print " Compiling for debug"
599  else: print "   Not compiling for debug"  else: print "   Not compiling for debug"
600  print " Installing in", prefix  print " Installing in", prefix
601    if ((fatalwarning != "") and (env['usewarnings'])): print " Treating warnings as errors"
602    else: print "   Not treating warnings as errors"
603  print ""  print ""
604    
605  ############ Delete option-dependent files #####################  ############ Delete option-dependent files #####################
# Line 553  env.Append(BUILDERS = {'RunPyUnitTest' : Line 622  env.Append(BUILDERS = {'RunPyUnitTest' :
622    
623  ############ Build the subdirectories ##########################  ############ Build the subdirectories ##########################
624    
625  Export(["env", "env_mpi", "clone_env"])  Export(
626      ["env",
627       "env_mpi",
628       "clone_env",
629       "IS_WINDOWS_PLATFORM"
630       ]
631      )
632    
633  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)
634    env.SConscript(dirs = ['tools/libescriptreader/src'], build_dir='build/$PLATFORM/tools/libescriptreader', duplicate=0)
635  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)  env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
636  env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)  env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
637  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 566  env.SConscript(dirs = ['pyvisi/py_src'], Line 642  env.SConscript(dirs = ['pyvisi/py_src'],
642  env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)  env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)
643  env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)  env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
644  env.SConscript(dirs = ['scripts'], build_dir='build/$PLATFORM/scripts', duplicate=0)  env.SConscript(dirs = ['scripts'], build_dir='build/$PLATFORM/scripts', duplicate=0)
645    env.SConscript(dirs = ['paso/profiling'], build_dir='build/$PLATFORM/paso/profiling', duplicate=0)
646    
647  ############ Remember what optimizations we used ###############  ############ Remember what optimizations we used ###############
648    
# Line 608  build_all_list += ['build_escript'] Line 685  build_all_list += ['build_escript']
685  build_all_list += ['build_finley']  build_all_list += ['build_finley']
686  if env['usempi']:       build_all_list += ['target_pythonMPI_exe']  if env['usempi']:       build_all_list += ['target_pythonMPI_exe']
687  if not IS_WINDOWS_PLATFORM: build_all_list += ['target_finley_wrapper']  if not IS_WINDOWS_PLATFORM: build_all_list += ['target_finley_wrapper']
688    if env['usesilo']:  build_all_list += ['target_escript2silo']
689  env.Alias('build_all', build_all_list)  env.Alias('build_all', build_all_list)
690    
691  install_all_list = []  install_all_list = []
# Line 621  install_all_list += ['target_install_mod Line 699  install_all_list += ['target_install_mod
699  install_all_list += ['target_install_pycad_py']  install_all_list += ['target_install_pycad_py']
700  if env['usempi']:       install_all_list += ['target_install_pythonMPI_exe']  if env['usempi']:       install_all_list += ['target_install_pythonMPI_exe']
701  if not IS_WINDOWS_PLATFORM: install_all_list += ['target_install_finley_wrapper']  if not IS_WINDOWS_PLATFORM: install_all_list += ['target_install_finley_wrapper']
702    if env['usesilo']:  install_all_list += ['target_install_escript2silo']
703  install_all_list += ['remember_options']  install_all_list += ['remember_options']
704  env.Alias('install_all', install_all_list)  env.Alias('install_all', install_all_list)
705    

Legend:
Removed from v.1930  
changed lines
  Added in v.2184

  ViewVC Help
Powered by ViewVC 1.1.26