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

Diff of /branches/inv2jf/SConstruct

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

revision 4295 by caltinay, Fri Mar 8 04:42:01 2013 UTC revision 4726 by sshaw, Fri Mar 7 00:23:44 2014 UTC
# Line 1  Line 1 
1  ##############################################################################  ##############################################################################
2  #  #
3  # Copyright (c) 2003-2013 by University of Queensland  # Copyright (c) 2003-2014 by University of Queensland
4  # http://www.uq.edu.au  # http://www.uq.edu.au
5  #  #
6  # Primary Business: Queensland, Australia  # Primary Business: Queensland, Australia
# Line 8  Line 8 
8  # http://www.opensource.org/licenses/osl-3.0.php  # http://www.opensource.org/licenses/osl-3.0.php
9  #  #
10  # Development until 2012 by Earth Systems Science Computational Center (ESSCC)  # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
11  # Development since 2012 by School of Earth Sciences  # Development 2012-2013 by School of Earth Sciences
12    # Development from 2014 by Centre for Geoscience Computing (GeoComp)
13  #  #
14  ##############################################################################  ##############################################################################
15    
# Line 27  REQUIRED_OPTS_VERSION=201 Line 28  REQUIRED_OPTS_VERSION=201
28  # MS Windows support, many thanks to PH  # MS Windows support, many thanks to PH
29  IS_WINDOWS = (os.name == 'nt')  IS_WINDOWS = (os.name == 'nt')
30    
31    IS_OSX = (os.uname()[0] == 'Darwin')
32    
33  ########################## Determine options file ############################  ########################## Determine options file ############################
34  # 1. command line  # 1. command line
35  # 2. scons/<hostname>_options.py  # 2. scons/<hostname>_options.py
# Line 43  if not options_file: Line 46  if not options_file:
46  if not os.path.isfile(options_file):  if not os.path.isfile(options_file):
47      print("\nWARNING:\nOptions file %s" % options_file)      print("\nWARNING:\nOptions file %s" % options_file)
48      print("not found! Default options will be used which is most likely suboptimal.")      print("not found! Default options will be used which is most likely suboptimal.")
49      print("It is recommended that you copy one of the TEMPLATE files in the scons/")      print("We recommend that you copy one of the TEMPLATE files in the scons/")
50      print("subdirectory and customize it to your needs.\n")      print("subdirectory and customize it to your needs.\n")
51      options_file = None      options_file = None
52    
# Line 60  vars.AddVariables( Line 63  vars.AddVariables(
63    PathVariable('build_dir', 'Top-level build directory', Dir('#/build').abspath, PathVariable.PathIsDirCreate),    PathVariable('build_dir', 'Top-level build directory', Dir('#/build').abspath, PathVariable.PathIsDirCreate),
64    BoolVariable('verbose', 'Output full compile/link lines', False),    BoolVariable('verbose', 'Output full compile/link lines', False),
65  # Compiler/Linker options  # Compiler/Linker options
   ('cc', 'Path to C compiler', 'default'),  
66    ('cxx', 'Path to C++ compiler', 'default'),    ('cxx', 'Path to C++ compiler', 'default'),
67    ('cc_flags', 'Base C/C++ compiler flags', 'default'),    ('cc_flags', 'Base C++ compiler flags', 'default'),
68    ('cc_optim', 'Additional C/C++ flags for a non-debug build', 'default'),    ('cc_optim', 'Additional C++ flags for a non-debug build', 'default'),
69    ('cc_debug', 'Additional C/C++ flags for a debug build', 'default'),    ('cc_debug', 'Additional C++ flags for a debug build', 'default'),
   ('cc_extra', 'Extra C compiler flags', ''),  
70    ('cxx_extra', 'Extra C++ compiler flags', ''),    ('cxx_extra', 'Extra C++ compiler flags', ''),
71    ('ld_extra', 'Extra linker flags', ''),    ('ld_extra', 'Extra linker flags', ''),
72    BoolVariable('werror','Treat compiler warnings as errors', True),    BoolVariable('werror','Treat compiler warnings as errors', True),
# Line 148  env = Environment(tools = ['default'], o Line 149  env = Environment(tools = ['default'], o
149    
150  # set the vars for clang  # set the vars for clang
151  def mkclang(env):  def mkclang(env):
     env['CC']='clang'  
152      env['CXX']='clang++'      env['CXX']='clang++'
153    
154  if env['tools_names'] != 'default':  if env['tools_names'] != 'default':
# Line 207  env.Append(LIBPATH = [env['libinstall']] Line 207  env.Append(LIBPATH = [env['libinstall']]
207    
208  ################# Fill in compiler options if not set above ##################  ################# Fill in compiler options if not set above ##################
209    
 if env['cc'] != 'default': env['CC']=env['cc']  
210  if env['cxx'] != 'default': env['CXX']=env['cxx']  if env['cxx'] != 'default': env['CXX']=env['cxx']
211    
212  # version >=9 of intel C++ compiler requires use of icpc to link in C++  # version >=9 of intel C++ compiler requires use of icpc to link in C++
# Line 225  fatalwarning = '' # switch to turn warni Line 224  fatalwarning = '' # switch to turn warni
224  sysheaderopt = '' # how to indicate that a header is a system header  sysheaderopt = '' # how to indicate that a header is a system header
225    
226  # env['CC'] might be a full path  # env['CC'] might be a full path
227  cc_name=os.path.basename(env['CC'])  cc_name=os.path.basename(env['CXX'])
228    
229  if cc_name == 'icc':  if cc_name == 'icpc':
230      # Intel compiler      # Intel compiler
231      # #1875: offsetof applied to non-POD types is nonstandard (in boost)      # #1875: offsetof applied to non-POD types is nonstandard (in boost)
232      cc_flags    = "-std=c99 -fPIC -w2 -wd1875 -Wno-unknown-pragmas -DBLOCKTIMER -DCORE_ID1"      # removed -std=c99 because icpc doesn't like it and we aren't using c anymore
233        cc_flags    = "-fPIC -w2 -wd1875 -Wno-unknown-pragmas -DBLOCKTIMER -DCORE_ID1"
234      cc_optim    = "-O3 -ftz -fno-alias -ipo -xHost"      cc_optim    = "-O3 -ftz -fno-alias -ipo -xHost"
235      cc_debug    = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"      cc_debug    = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"
236      omp_flags   = "-openmp"      omp_flags   = "-openmp"
237      omp_ldflags = "-openmp -openmp_report=1"      omp_ldflags = "-openmp -openmp_report=1"
238      fatalwarning = "-Werror"      fatalwarning = "-Werror"
239  elif cc_name[:3] == 'gcc':  elif cc_name[:3] == 'g++':
240      # GNU C on any system      # GNU C on any system
241      # note that -ffast-math is not used because it breaks isnan(),      # note that -ffast-math is not used because it breaks isnan(),
242      # see mantis #691      # see mantis #691
# Line 269  if env['cc_optim']    == 'default': env[ Line 269  if env['cc_optim']    == 'default': env[
269  if env['cc_debug']    == 'default': env['cc_debug'] = cc_debug  if env['cc_debug']    == 'default': env['cc_debug'] = cc_debug
270  if env['omp_flags']   == 'default': env['omp_flags'] = omp_flags  if env['omp_flags']   == 'default': env['omp_flags'] = omp_flags
271  if env['omp_ldflags'] == 'default': env['omp_ldflags'] = omp_ldflags  if env['omp_ldflags'] == 'default': env['omp_ldflags'] = omp_ldflags
 if env['cc_extra']  != '': env.Append(CFLAGS = env['cc_extra'])  
272  if env['cxx_extra'] != '': env.Append(CXXFLAGS = env['cxx_extra'])  if env['cxx_extra'] != '': env.Append(CXXFLAGS = env['cxx_extra'])
273  if env['ld_extra']  != '': env.Append(LINKFLAGS = env['ld_extra'])  if env['ld_extra']  != '': env.Append(LINKFLAGS = env['ld_extra'])
274    
# Line 385  try: Line 384  try:
384  except KeyError:  except KeyError:
385      pass      pass
386    
387    if IS_OSX:
388      try:
389        env.PrependENVPath('DYLD_LIBRARY_PATH', os.environ['DYLD_LIBRARY_PATH'])
390      except KeyError:
391        pass
392    
393    
394  # these shouldn't be needed  # these shouldn't be needed
395  #for key in 'C_INCLUDE_PATH','CPLUS_INCLUDE_PATH','LIBRARY_PATH':  #for key in 'C_INCLUDE_PATH','CPLUS_INCLUDE_PATH','LIBRARY_PATH':
396  #    try:  #    try:
# Line 446  env.PrependENVPath('PYTHONPATH', prefix) Line 452  env.PrependENVPath('PYTHONPATH', prefix)
452  env['ENV']['ESCRIPT_ROOT'] = prefix  env['ENV']['ESCRIPT_ROOT'] = prefix
453    
454  if not env['verbose']:  if not env['verbose']:
     env['CCCOMSTR'] = "Compiling $TARGET"  
455      env['CXXCOMSTR'] = "Compiling $TARGET"      env['CXXCOMSTR'] = "Compiling $TARGET"
     env['SHCCCOMSTR'] = "Compiling $TARGET"  
456      env['SHCXXCOMSTR'] = "Compiling $TARGET"      env['SHCXXCOMSTR'] = "Compiling $TARGET"
457      env['ARCOMSTR'] = "Linking $TARGET"      env['ARCOMSTR'] = "Linking $TARGET"
458      env['LINKCOMSTR'] = "Linking $TARGET"      env['LINKCOMSTR'] = "Linking $TARGET"
# Line 488  Export( Line 492  Export(
492  env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='$BUILD_DIR/$PLATFORM/tools/escriptconvert', duplicate=0)  env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='$BUILD_DIR/$PLATFORM/tools/escriptconvert', duplicate=0)
493  env.SConscript(dirs = ['paso/src'], variant_dir='$BUILD_DIR/$PLATFORM/paso', duplicate=0)  env.SConscript(dirs = ['paso/src'], variant_dir='$BUILD_DIR/$PLATFORM/paso', duplicate=0)
494  env.SConscript(dirs = ['weipa/src'], variant_dir='$BUILD_DIR/$PLATFORM/weipa', duplicate=0)  env.SConscript(dirs = ['weipa/src'], variant_dir='$BUILD_DIR/$PLATFORM/weipa', duplicate=0)
495  env.SConscript(dirs = ['escript/src'], variant_dir='$BUILD_DIR/$PLATFORM/escript', duplicate=0)  env.SConscript(dirs = ['escript/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/escript', duplicate=0)
496    
497    #This will pull in the escriptcore/py_src and escriptcore/test
498    env.SConscript(dirs = ['escriptcore/src'], variant_dir='$BUILD_DIR/$PLATFORM/escriptcore', duplicate=0)
499    #env.SConscript(dirs = ['escript/test'], variant_dir='$BUILD_DIR/$PLATFORM/escript/test', duplicate=0)
500  env.SConscript(dirs = ['esysUtils/src'], variant_dir='$BUILD_DIR/$PLATFORM/esysUtils', duplicate=0)  env.SConscript(dirs = ['esysUtils/src'], variant_dir='$BUILD_DIR/$PLATFORM/esysUtils', duplicate=0)
501  env.SConscript(dirs = ['pasowrap/src'], variant_dir='$BUILD_DIR/$PLATFORM/pasowrap', duplicate=0)  env.SConscript(dirs = ['pasowrap/src'], variant_dir='$BUILD_DIR/$PLATFORM/pasowrap', duplicate=0)
502  env.SConscript(dirs = ['dudley/src'], variant_dir='$BUILD_DIR/$PLATFORM/dudley', duplicate=0)  env.SConscript(dirs = ['dudley/src'], variant_dir='$BUILD_DIR/$PLATFORM/dudley', duplicate=0)
# Line 522  env.Alias('build_paso', ['install_paso_h Line 530  env.Alias('build_paso', ['install_paso_h
530  env.Alias('install_paso', ['build_paso', 'install_paso_lib'])  env.Alias('install_paso', ['build_paso', 'install_paso_lib'])
531    
532  env.Alias('build_escript', ['install_escript_headers', 'build_escript_lib', 'build_escriptcpp_lib'])  env.Alias('build_escript', ['install_escript_headers', 'build_escript_lib', 'build_escriptcpp_lib'])
533  env.Alias('install_escript', ['build_escript', 'install_escript_lib', 'install_escriptcpp_lib', 'install_escript_py'])  env.Alias('install_escript', ['build_escript', 'install_escript_lib', 'install_escriptcpp_lib', 'install_escriptcore_py', 'install_escript_py'])
534    
535  env.Alias('build_pasowrap', ['install_pasowrap_headers', 'build_pasowrap_lib', 'build_pasowrapcpp_lib'])  env.Alias('build_pasowrap', ['install_pasowrap_headers', 'build_pasowrap_lib', 'build_pasowrapcpp_lib'])
536  env.Alias('install_pasowrap', ['build_pasowrap', 'install_pasowrap_lib', 'install_pasowrapcpp_lib', 'install_pasowrap_py'])  env.Alias('install_pasowrap', ['build_pasowrap', 'install_pasowrap_lib', 'install_pasowrapcpp_lib', 'install_pasowrap_py'])
# Line 581  env.Default('install_all') Line 589  env.Default('install_all')
589  ################## Targets to build and run the test suite ###################  ################## Targets to build and run the test suite ###################
590    
591  if not env['cppunit']:  if not env['cppunit']:
592      test_msg = env.Command('.dummy.', None, '@echo "Cannot run C/C++ unit tests, CppUnit not found!";exit 1')      test_msg = env.Command('.dummy.', None, '@echo "Cannot run C++ unit tests, CppUnit not found!";exit 1')
593      env.Alias('run_tests', test_msg)      env.Alias('run_tests', test_msg)
594      env.Alias('build_tests', '')      env.Alias('build_tests', '')
595  env.Alias('run_tests', ['install_all'])  env.Alias('run_tests', ['install_all'])
# Line 609  if not IS_WINDOWS: Line 617  if not IS_WINDOWS:
617  ######################## Summarize our environment ###########################  ######################## Summarize our environment ###########################
618  def print_summary():  def print_summary():
619      print("")      print("")
620      print("*** Config Summary (see config.log and lib/buildvars for details) ***")      print("*** Config Summary (see config.log and <prefix>/lib/buildvars for details) ***")
621      print("Escript/Finley revision %s"%global_revision)      print("Escript/Finley revision %s"%global_revision)
622      print("  Install prefix:  %s"%env['prefix'])      print("  Install prefix:  %s"%env['prefix'])
623      print("          Python:  %s"%sysconfig.PREFIX)      print("          Python:  %s"%sysconfig.PREFIX)
624      print("           boost:  %s"%env['boost_prefix'])      print("           boost:  %s"%env['boost_prefix'])
625      print("           numpy:  YES")      if env['numpy_h']:
626            print("           numpy:  YES (with headers)")
627        else:
628            print("           numpy:  YES (without headers)")
629      if env['usempi']:      if env['usempi']:
630          print("             MPI:  YES (flavour: %s)"%env['mpi'])          print("             MPI:  YES (flavour: %s)"%env['mpi'])
631      else:      else:
# Line 625  def print_summary(): Line 636  def print_summary():
636          print("          LAPACK:  DISABLED")          print("          LAPACK:  DISABLED")
637      d_list=[]      d_list=[]
638      e_list=[]      e_list=[]
639      for i in 'debug','openmp','boomeramg','mkl','netcdf','papi','parmetis','pyproj','silo','sympy','umfpack','visit','vsl_random':      for i in 'debug','openmp','boomeramg','gdal','mkl','netcdf','papi','parmetis','pyproj','scipy','silo','sympy','umfpack','visit','vsl_random':
640          if env[i]: e_list.append(i)          if env[i]: e_list.append(i)
641          else: d_list.append(i)          else: d_list.append(i)
642      for i in e_list:      for i in e_list:
# Line 642  def print_summary(): Line 653  def print_summary():
653          print("            gmsh:  FOUND")          print("            gmsh:  FOUND")
654      else:      else:
655          print("            gmsh:  NOT FOUND")          print("            gmsh:  NOT FOUND")
656      if env['numpy_h']:  
         print("   numpy headers:  FOUND")  
     else:  
         print("   numpy headers:  NOT FOUND")  
     print("   vsl_random:  %s"%env['vsl_random'])  
           
657      if ((fatalwarning != '') and (env['werror'])):      if ((fatalwarning != '') and (env['werror'])):
658          print("  Treating warnings as errors")          print("  Treating warnings as errors")
659      else:      else:
# Line 655  def print_summary(): Line 661  def print_summary():
661      print("")      print("")
662      for w in env['warnings']:      for w in env['warnings']:
663          print("WARNING: %s"%w)          print("WARNING: %s"%w)
664        if len(GetBuildFailures()):
665            print("\nERROR: build stopped due to errors\n")
666        else:
667            print("\nSUCCESS: build complete\n")
668    
669  atexit.register(print_summary)  atexit.register(print_summary)
670    

Legend:
Removed from v.4295  
changed lines
  Added in v.4726

  ViewVC Help
Powered by ViewVC 1.1.26