/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 4542 by jfenwick, Thu Nov 28 01:33:22 2013 UTC revision 5123 by sshaw, Thu Aug 28 07:02:11 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("We recommend that you copy one of the TEMPLATE files in the scons/")      print("We recommend that you copy the most relavent options file in the scons/os/")
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 132  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 153  env = Environment(tools = ['default'], o
153  def mkclang(env):  def mkclang(env):
154      env['CXX']='clang++'      env['CXX']='clang++'
155    
156  if env['tools_names'] != 'default':  if env['tools_names'] != ['default']:
157      zz=env['tools_names']      zz=env['tools_names']
158      if 'clang' in zz:      if 'clang' in zz:
159          zz.remove('clang')          zz.remove('clang')
# Line 227  if cc_name == 'icpc': Line 232  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      # removed -std=c99 because icpc doesn't like it and we aren't using c anymore      # 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 -DBLOCKTIMER -DCORE_ID1"      cc_flags    = "-fPIC -w2 -wd1875 -Wno-unknown-pragmas"
236      cc_optim    = "-O3 -ftz -fno-alias -ipo -xHost"      cc_optim    = "-O3 -ftz -fno-alias -inline-level=2 -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"
# Line 237  elif cc_name[:3] == 'g++': Line 242  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 --param=max-vartrack-size=90000000" #avoids vartrack limit being exceeded with escriptcpp.cpp
248      omp_flags    = "-fopenmp"      omp_flags    = "-fopenmp"
249      omp_ldflags  = "-fopenmp"      omp_ldflags  = "-fopenmp"
250      fatalwarning = "-Werror"      fatalwarning = "-Werror"
# Line 365  for key in 'OMP_NUM_THREADS', 'ESCRIPT_N Line 370  for key in 'OMP_NUM_THREADS', 'ESCRIPT_N
370      try:      try:
371          env['ENV'][key] = os.environ[key]          env['ENV'][key] = os.environ[key]
372      except KeyError:      except KeyError:
373          env['ENV'][key] = 1          env['ENV'][key] = '1'
374    
375  env_export=env['env_export']  env_export=env['env_export']
376  env_export.extend(['ESCRIPT_NUM_THREADS','ESCRIPT_HOSTFILE','DISPLAY','XAUTHORITY','PATH','HOME','KMP_MONITOR_STACKSIZE','TMPDIR','TEMP','TMP'])  env_export.extend(['ESCRIPT_NUM_THREADS','ESCRIPT_HOSTFILE','DISPLAY','XAUTHORITY','PATH','HOME','KMP_MONITOR_STACKSIZE','TMPDIR','TEMP','TMP','LD_PRELOAD'])
377    
378  for key in set(env_export):  for key in set(env_export):
379      try:      try:
# Line 381  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 407  env.Append(BUILDERS = {'RunUnitTest' : r Line 419  env.Append(BUILDERS = {'RunUnitTest' : r
419  runPyUnitTest_builder = Builder(action = runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)  runPyUnitTest_builder = Builder(action = runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
420  env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});  env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
421    
422    runPyExample_builder = Builder(action = runPyExample, suffix = '.passed', src_suffic='.py', single_source=True)
423    env.Append(BUILDERS = {'RunPyExample' : runPyExample_builder});
424    
425  epstopdfbuilder = Builder(action = eps2pdf, suffix='.pdf', src_suffix='.eps', single_source=True)  epstopdfbuilder = Builder(action = eps2pdf, suffix='.pdf', src_suffix='.eps', single_source=True)
426  env.Append(BUILDERS = {'EpsToPDF' : epstopdfbuilder});  env.Append(BUILDERS = {'EpsToPDF' : epstopdfbuilder});
427    
# Line 492  env.SConscript(dirs = ['pasowrap/src'], Line 507  env.SConscript(dirs = ['pasowrap/src'],
507  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)
508  env.SConscript(dirs = ['finley/src'], variant_dir='$BUILD_DIR/$PLATFORM/finley', duplicate=0)  env.SConscript(dirs = ['finley/src'], variant_dir='$BUILD_DIR/$PLATFORM/finley', duplicate=0)
509  env.SConscript(dirs = ['ripley/src'], variant_dir='$BUILD_DIR/$PLATFORM/ripley', duplicate=0)  env.SConscript(dirs = ['ripley/src'], variant_dir='$BUILD_DIR/$PLATFORM/ripley', duplicate=0)
510    env.SConscript(dirs = ['speckley/src'], variant_dir='$BUILD_DIR/$PLATFORM/speckley', duplicate=0)
511  env.SConscript(dirs = ['downunder/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/downunder', duplicate=0)  env.SConscript(dirs = ['downunder/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/downunder', duplicate=0)
512  env.SConscript(dirs = ['modellib/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/modellib', duplicate=0)  env.SConscript(dirs = ['modellib/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/modellib', duplicate=0)
513  env.SConscript(dirs = ['pycad/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pycad', duplicate=0)  env.SConscript(dirs = ['pycad/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pycad', duplicate=0)
# Line 534  env.Alias('install_finley', ['build_finl Line 550  env.Alias('install_finley', ['build_finl
550  env.Alias('build_ripley', ['install_ripley_headers', 'build_ripley_lib', 'build_ripleycpp_lib'])  env.Alias('build_ripley', ['install_ripley_headers', 'build_ripley_lib', 'build_ripleycpp_lib'])
551  env.Alias('install_ripley', ['build_ripley', 'install_ripley_lib', 'install_ripleycpp_lib', 'install_ripley_py'])  env.Alias('install_ripley', ['build_ripley', 'install_ripley_lib', 'install_ripleycpp_lib', 'install_ripley_py'])
552    
553    env.Alias('build_speckley', ['install_speckley_headers', 'build_speckley_lib', 'build_speckleycpp_lib'])
554    env.Alias('install_speckley', ['build_speckley', 'install_speckley_lib', 'install_speckleycpp_lib', 'install_speckley_py'])
555    
556  env.Alias('build_weipa', ['install_weipa_headers', 'build_weipa_lib', 'build_weipacpp_lib'])  env.Alias('build_weipa', ['install_weipa_headers', 'build_weipa_lib', 'build_weipacpp_lib'])
557  env.Alias('install_weipa', ['build_weipa', 'install_weipa_lib', 'install_weipacpp_lib', 'install_weipa_py'])  env.Alias('install_weipa', ['build_weipa', 'install_weipa_lib', 'install_weipacpp_lib', 'install_weipa_py'])
558    
# Line 549  build_all_list += ['build_pasowrap'] Line 568  build_all_list += ['build_pasowrap']
568  build_all_list += ['build_dudley']  build_all_list += ['build_dudley']
569  build_all_list += ['build_finley']  build_all_list += ['build_finley']
570  build_all_list += ['build_ripley']  build_all_list += ['build_ripley']
571    build_all_list += ['build_speckley']
572  build_all_list += ['build_weipa']  build_all_list += ['build_weipa']
573  if not IS_WINDOWS: build_all_list += ['build_escriptreader']  if not IS_WINDOWS: build_all_list += ['build_escriptreader']
574  if env['usempi']:   build_all_list += ['build_pythonMPI']  if env['usempi']:   build_all_list += ['build_pythonMPI']
# Line 564  install_all_list += ['install_pasowrap'] Line 584  install_all_list += ['install_pasowrap']
584  install_all_list += ['install_dudley']  install_all_list += ['install_dudley']
585  install_all_list += ['install_finley']  install_all_list += ['install_finley']
586  install_all_list += ['install_ripley']  install_all_list += ['install_ripley']
587    install_all_list += ['install_speckley']
588  install_all_list += ['install_weipa']  install_all_list += ['install_weipa']
589  if not IS_WINDOWS: install_all_list += ['install_escriptreader']  if not IS_WINDOWS: install_all_list += ['install_escriptreader']
590  install_all_list += ['install_downunder_py']  install_all_list += ['install_downunder_py']
# Line 643  def print_summary(): Line 664  def print_summary():
664          print("            gmsh:  FOUND")          print("            gmsh:  FOUND")
665      else:      else:
666          print("            gmsh:  NOT FOUND")          print("            gmsh:  NOT FOUND")
667        print(    "            gzip:  " + ("YES" if env['compressed_files'] else "NO"))
668    
669      if ((fatalwarning != '') and (env['werror'])):      if ((fatalwarning != '') and (env['werror'])):
670          print("  Treating warnings as errors")          print("  Treating warnings as errors")
# Line 651  def print_summary(): Line 673  def print_summary():
673      print("")      print("")
674      for w in env['warnings']:      for w in env['warnings']:
675          print("WARNING: %s"%w)          print("WARNING: %s"%w)
676        if len(GetBuildFailures()):
677            print("\nERROR: build stopped due to errors\n")
678        else:
679            print("\nSUCCESS: build complete\n")
680    
681  atexit.register(print_summary)  atexit.register(print_summary)
682    

Legend:
Removed from v.4542  
changed lines
  Added in v.5123

  ViewVC Help
Powered by ViewVC 1.1.26