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

Diff of /branches/diaplayground/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 4775 by caltinay, Wed Mar 19 23:12:53 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 134  vars.AddVariables( Line 135  vars.AddVariables(
135    ('pythonlibpath', 'Path to the python library. (You should not need to set this unless your python has moved)',''),    ('pythonlibpath', 'Path to the python library. (You should not need to set this unless your python has moved)',''),
136    ('pythonincpath','Path to python include files. (You should not need to set this unless your python has moved',''),    ('pythonincpath','Path to python include files. (You should not need to set this unless your python has moved',''),
137    BoolVariable('BADPYTHONMACROS','Extra \#include to get around a python bug.', True),    BoolVariable('BADPYTHONMACROS','Extra \#include to get around a python bug.', True),
138      BoolVariable('compressed_files','Enables reading from compressed binary files', True),
139      ('compression_libs', 'Compression libraries to link with', ['boost_iostreams'])
140  )  )
141    
142  ##################### Create environment and help text #######################  ##################### Create environment and help text #######################
# Line 148  env = Environment(tools = ['default'], o Line 151  env = Environment(tools = ['default'], o
151    
152  # set the vars for clang  # set the vars for clang
153  def mkclang(env):  def mkclang(env):
     env['CC']='clang'  
154      env['CXX']='clang++'      env['CXX']='clang++'
155    
156  if env['tools_names'] != 'default':  if env['tools_names'] != 'default':
# Line 207  env.Append(LIBPATH = [env['libinstall']] Line 209  env.Append(LIBPATH = [env['libinstall']]
209    
210  ################# Fill in compiler options if not set above ##################  ################# Fill in compiler options if not set above ##################
211    
 if env['cc'] != 'default': env['CC']=env['cc']  
212  if env['cxx'] != 'default': env['CXX']=env['cxx']  if env['cxx'] != 'default': env['CXX']=env['cxx']
213    
214  # 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 226  fatalwarning = '' # switch to turn warni
226  sysheaderopt = '' # how to indicate that a header is a system header  sysheaderopt = '' # how to indicate that a header is a system header
227    
228  # env['CC'] might be a full path  # env['CC'] might be a full path
229  cc_name=os.path.basename(env['CC'])  cc_name=os.path.basename(env['CXX'])
230    
231  if cc_name == 'icc':  if cc_name == 'icpc':
232      # Intel compiler      # Intel compiler
233      # #1875: offsetof applied to non-POD types is nonstandard (in boost)      # #1875: offsetof applied to non-POD types is nonstandard (in boost)
234      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
235        cc_flags    = "-fPIC -w2 -wd1875 -Wno-unknown-pragmas"
236      cc_optim    = "-O3 -ftz -fno-alias -ipo -xHost"      cc_optim    = "-O3 -ftz -fno-alias -ipo -xHost"
237      cc_debug    = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"      cc_debug    = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"
238      omp_flags   = "-openmp"      omp_flags   = "-openmp"
239      omp_ldflags = "-openmp -openmp_report=1"      omp_ldflags = "-openmp -openmp_report=1"
240      fatalwarning = "-Werror"      fatalwarning = "-Werror"
241  elif cc_name[:3] == 'gcc':  elif cc_name[:3] == 'g++':
242      # GNU C on any system      # GNU C on any system
243      # note that -ffast-math is not used because it breaks isnan(),      # note that -ffast-math is not used because it breaks isnan(),
244      # see mantis #691      # see mantis #691
245      cc_flags     = "-pedantic -Wall -fPIC -Wno-unknown-pragmas -DBLOCKTIMER  -Wno-sign-compare -Wno-system-headers -Wno-long-long -Wno-strict-aliasing -finline-functions"      cc_flags     = "-pedantic -Wall -fPIC -Wno-unknown-pragmas -Wno-sign-compare -Wno-system-headers -Wno-long-long -Wno-strict-aliasing -finline-functions"
246      cc_optim     = "-O3"      cc_optim     = "-O3"
247      cc_debug     = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"      cc_debug     = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"
248      omp_flags    = "-fopenmp"      omp_flags    = "-fopenmp"
# Line 269  if env['cc_optim']    == 'default': env[ Line 271  if env['cc_optim']    == 'default': env[
271  if env['cc_debug']    == 'default': env['cc_debug'] = cc_debug  if env['cc_debug']    == 'default': env['cc_debug'] = cc_debug
272  if env['omp_flags']   == 'default': env['omp_flags'] = omp_flags  if env['omp_flags']   == 'default': env['omp_flags'] = omp_flags
273  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'])  
274  if env['cxx_extra'] != '': env.Append(CXXFLAGS = env['cxx_extra'])  if env['cxx_extra'] != '': env.Append(CXXFLAGS = env['cxx_extra'])
275  if env['ld_extra']  != '': env.Append(LINKFLAGS = env['ld_extra'])  if env['ld_extra']  != '': env.Append(LINKFLAGS = env['ld_extra'])
276    
# Line 385  try: Line 386  try:
386  except KeyError:  except KeyError:
387      pass      pass
388    
389    if IS_OSX:
390      try:
391        env.PrependENVPath('DYLD_LIBRARY_PATH', os.environ['DYLD_LIBRARY_PATH'])
392      except KeyError:
393        pass
394    
395    
396  # these shouldn't be needed  # these shouldn't be needed
397  #for key in 'C_INCLUDE_PATH','CPLUS_INCLUDE_PATH','LIBRARY_PATH':  #for key in 'C_INCLUDE_PATH','CPLUS_INCLUDE_PATH','LIBRARY_PATH':
398  #    try:  #    try:
# Line 446  env.PrependENVPath('PYTHONPATH', prefix) Line 454  env.PrependENVPath('PYTHONPATH', prefix)
454  env['ENV']['ESCRIPT_ROOT'] = prefix  env['ENV']['ESCRIPT_ROOT'] = prefix
455    
456  if not env['verbose']:  if not env['verbose']:
     env['CCCOMSTR'] = "Compiling $TARGET"  
457      env['CXXCOMSTR'] = "Compiling $TARGET"      env['CXXCOMSTR'] = "Compiling $TARGET"
     env['SHCCCOMSTR'] = "Compiling $TARGET"  
458      env['SHCXXCOMSTR'] = "Compiling $TARGET"      env['SHCXXCOMSTR'] = "Compiling $TARGET"
459      env['ARCOMSTR'] = "Linking $TARGET"      env['ARCOMSTR'] = "Linking $TARGET"
460      env['LINKCOMSTR'] = "Linking $TARGET"      env['LINKCOMSTR'] = "Linking $TARGET"
# Line 488  Export( Line 494  Export(
494  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)
495  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)
496  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)
497  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)
498    
499    #This will pull in the escriptcore/py_src and escriptcore/test
500    env.SConscript(dirs = ['escriptcore/src'], variant_dir='$BUILD_DIR/$PLATFORM/escriptcore', duplicate=0)
501    #env.SConscript(dirs = ['escript/test'], variant_dir='$BUILD_DIR/$PLATFORM/escript/test', duplicate=0)
502  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)
503  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)
504  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 532  env.Alias('build_paso', ['install_paso_h
532  env.Alias('install_paso', ['build_paso', 'install_paso_lib'])  env.Alias('install_paso', ['build_paso', 'install_paso_lib'])
533    
534  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'])
535  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'])
536    
537  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'])
538  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 591  env.Default('install_all')
591  ################## Targets to build and run the test suite ###################  ################## Targets to build and run the test suite ###################
592    
593  if not env['cppunit']:  if not env['cppunit']:
594      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')
595      env.Alias('run_tests', test_msg)      env.Alias('run_tests', test_msg)
596      env.Alias('build_tests', '')      env.Alias('build_tests', '')
597  env.Alias('run_tests', ['install_all'])  env.Alias('run_tests', ['install_all'])
# Line 609  if not IS_WINDOWS: Line 619  if not IS_WINDOWS:
619  ######################## Summarize our environment ###########################  ######################## Summarize our environment ###########################
620  def print_summary():  def print_summary():
621      print("")      print("")
622      print("*** Config Summary (see config.log and lib/buildvars for details) ***")      print("*** Config Summary (see config.log and <prefix>/lib/buildvars for details) ***")
623      print("Escript/Finley revision %s"%global_revision)      print("Escript/Finley revision %s"%global_revision)
624      print("  Install prefix:  %s"%env['prefix'])      print("  Install prefix:  %s"%env['prefix'])
625      print("          Python:  %s"%sysconfig.PREFIX)      print("          Python:  %s"%sysconfig.PREFIX)
626      print("           boost:  %s"%env['boost_prefix'])      print("           boost:  %s"%env['boost_prefix'])
627      print("           numpy:  YES")      if env['numpy_h']:
628            print("           numpy:  YES (with headers)")
629        else:
630            print("           numpy:  YES (without headers)")
631      if env['usempi']:      if env['usempi']:
632          print("             MPI:  YES (flavour: %s)"%env['mpi'])          print("             MPI:  YES (flavour: %s)"%env['mpi'])
633      else:      else:
# Line 625  def print_summary(): Line 638  def print_summary():
638          print("          LAPACK:  DISABLED")          print("          LAPACK:  DISABLED")
639      d_list=[]      d_list=[]
640      e_list=[]      e_list=[]
641      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':
642          if env[i]: e_list.append(i)          if env[i]: e_list.append(i)
643          else: d_list.append(i)          else: d_list.append(i)
644      for i in e_list:      for i in e_list:
# Line 642  def print_summary(): Line 655  def print_summary():
655          print("            gmsh:  FOUND")          print("            gmsh:  FOUND")
656      else:      else:
657          print("            gmsh:  NOT FOUND")          print("            gmsh:  NOT FOUND")
658      if env['numpy_h']:      print(    "            gzip:  " + ("YES" if env['compressed_files'] else "NO"))
659          print("   numpy headers:  FOUND")  
     else:  
         print("   numpy headers:  NOT FOUND")  
     print("   vsl_random:  %s"%env['vsl_random'])  
           
660      if ((fatalwarning != '') and (env['werror'])):      if ((fatalwarning != '') and (env['werror'])):
661          print("  Treating warnings as errors")          print("  Treating warnings as errors")
662      else:      else:
# Line 655  def print_summary(): Line 664  def print_summary():
664      print("")      print("")
665      for w in env['warnings']:      for w in env['warnings']:
666          print("WARNING: %s"%w)          print("WARNING: %s"%w)
667        if len(GetBuildFailures()):
668            print("\nERROR: build stopped due to errors\n")
669        else:
670            print("\nSUCCESS: build complete\n")
671    
672  atexit.register(print_summary)  atexit.register(print_summary)
673    

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

  ViewVC Help
Powered by ViewVC 1.1.26