/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 3259 by jfenwick, Mon Oct 11 01:48:14 2010 UTC revision 3466 by caltinay, Tue Feb 8 05:16:21 2011 UTC
# Line 54  vars = Variables(options_file, ARGUMENTS Line 54  vars = Variables(options_file, ARGUMENTS
54  vars.AddVariables(  vars.AddVariables(
55    PathVariable('options_file', 'Path to options file', options_file, PathVariable.PathIsFile),    PathVariable('options_file', 'Path to options file', options_file, PathVariable.PathIsFile),
56    PathVariable('prefix', 'Installation prefix', Dir('#.').abspath, PathVariable.PathIsDirCreate),    PathVariable('prefix', 'Installation prefix', Dir('#.').abspath, PathVariable.PathIsDirCreate),
57      PathVariable('build_dir', 'Top-level build directory', Dir('#/build').abspath, PathVariable.PathIsDirCreate),
58    BoolVariable('verbose', 'Output full compile/link lines', False),    BoolVariable('verbose', 'Output full compile/link lines', False),
59  # Compiler/Linker options  # Compiler/Linker options
60    ('cc', 'Path to C compiler', 'default'),    ('cc', 'Path to C compiler', 'default'),
# Line 71  vars.AddVariables( Line 72  vars.AddVariables(
72    ('omp_ldflags', 'OpenMP linker flags', 'default'),    ('omp_ldflags', 'OpenMP linker flags', 'default'),
73  # Mandatory libraries  # Mandatory libraries
74    ('boost_prefix', 'Prefix/Paths of boost installation', default_prefix),    ('boost_prefix', 'Prefix/Paths of boost installation', default_prefix),
75    ('boost_libs', 'Boost libraries to link with', ['boost_python']),    ('boost_libs', 'Boost libraries to link with', ['boost_python-mt']),
76  # Optional libraries and options  # Optional libraries and options
77    EnumVariable('mpi', 'Compile parallel version using MPI flavour', 'none', allowed_values=mpi_flavours),    EnumVariable('mpi', 'Compile parallel version using MPI flavour', 'none', allowed_values=mpi_flavours),
78    ('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix),    ('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix),
# Line 125  vars.AddVariables( Line 126  vars.AddVariables(
126  # Intel's compiler uses regular expressions improperly and emits a warning  # Intel's compiler uses regular expressions improperly and emits a warning
127  # about failing to find the compilers. This warning can be safely ignored.  # about failing to find the compilers. This warning can be safely ignored.
128    
129  env = Environment(tools = ['default'], options = vars)  # PATH is needed so the compiler, linker and tools are found if they are not
130    # in default locations.
131    env = Environment(tools = ['default'], options = vars,
132                      ENV = {'PATH': os.environ['PATH']})
133  if env['tools_names'] != 'default':  if env['tools_names'] != 'default':
134      env = Environment(tools = ['default'] + env['tools_names'], options = vars)      env = Environment(tools = ['default'] + env['tools_names'], options = vars,
135                          ENV = {'PATH' : os.environ['PATH']})
136    
137  if options_file:  if options_file:
138      opts_valid=False      opts_valid=False
# Line 146  if options_file: Line 151  if options_file:
151  Help(vars.GenerateHelpText(env))  Help(vars.GenerateHelpText(env))
152    
153  # Check for superfluous options  # Check for superfluous options
154  for k in vars.UnknownVariables():  if len(vars.UnknownVariables())>0:
155      print("WARNING: Ignoring unknown option '%s'" % k)      for k in vars.UnknownVariables():
156            print("Unknown option '%s'" % k)
157        Exit(1)
158    
159  #################### Make sure install directories exist #####################  #################### Make sure install directories exist #####################
160    
161    env['BUILD_DIR']=env['build_dir']
162  prefix=Dir(env['prefix']).abspath  prefix=Dir(env['prefix']).abspath
163  env['incinstall'] = os.path.join(prefix, 'include')  env['incinstall'] = os.path.join(prefix, 'include')
164  env['bininstall'] = os.path.join(prefix, 'bin')  env['bininstall'] = os.path.join(prefix, 'bin')
# Line 277  try: Line 285  try:
285      if global_revision == '': global_revision='-2'      if global_revision == '': global_revision='-2'
286  except:  except:
287      global_revision = '-1'      global_revision = '-1'
288    env['svn_revision']=global_revision
289  env.Append(CPPDEFINES=['SVN_VERSION='+global_revision])  env.Append(CPPDEFINES=['SVN_VERSION='+global_revision])
290    
291  if IS_WINDOWS:  if IS_WINDOWS:
# Line 294  if IS_WINDOWS: Line 303  if IS_WINDOWS:
303  else:  else:
304      LD_LIBRARY_PATH_KEY='LD_LIBRARY_PATH'      LD_LIBRARY_PATH_KEY='LD_LIBRARY_PATH'
305    
306  # the following env variables are exported for the unit tests, PATH is needed  # the following env variables are exported for the unit tests
 # so the compiler/linker is found if they are not in default locations.  
307    
308  for key in 'OMP_NUM_THREADS', 'ESCRIPT_NUM_PROCS', 'ESCRIPT_NUM_NODES':  for key in 'OMP_NUM_THREADS', 'ESCRIPT_NUM_PROCS', 'ESCRIPT_NUM_NODES':
309      try:      try:
# Line 304  for key in 'OMP_NUM_THREADS', 'ESCRIPT_N Line 312  for key in 'OMP_NUM_THREADS', 'ESCRIPT_N
312          env['ENV'][key] = 1          env['ENV'][key] = 1
313    
314  env_export=env['env_export']  env_export=env['env_export']
315  env_export.extend(['ESCRIPT_NUM_THREADS','ESCRIPT_HOSTFILE','DISPLAY','XAUTHORITY','PATH','HOME'])  env_export.extend(['ESCRIPT_NUM_THREADS','ESCRIPT_HOSTFILE','DISPLAY','XAUTHORITY','PATH','HOME','TMPDIR','TEMP','TMP'])
316    
317  for key in set(env_export):  for key in set(env_export):
318      try:      try:
# Line 373  if conf.CheckFunc('gethostname'): Line 381  if conf.CheckFunc('gethostname'):
381  python_inc_path=sysconfig.get_python_inc()  python_inc_path=sysconfig.get_python_inc()
382  if IS_WINDOWS:  if IS_WINDOWS:
383      python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs')      python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs')
384    elif env['PLATFORM']=='darwin':
385        python_lib_path=sysconfig.get_config_var('LIBPL')
386  else:  else:
387      python_lib_path=sysconfig.get_config_var('LIBDIR')      python_lib_path=sysconfig.get_config_var('LIBDIR')
388  #python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux  #python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux
# Line 557  if env['parmetis']: Line 567  if env['parmetis']:
567      env.PrependENVPath(LD_LIBRARY_PATH_KEY, parmetis_lib_path)      env.PrependENVPath(LD_LIBRARY_PATH_KEY, parmetis_lib_path)
568      env.Append(CPPDEFINES = ['USE_PARMETIS'])      env.Append(CPPDEFINES = ['USE_PARMETIS'])
569    
570    ######## gmsh (optional, for tests)
571    
572    try:
573        import subprocess
574        p=subprocess.Popen(['gmsh', '-version'], stderr=subprocess.PIPE)
575        p.poll()
576        env['gmsh']=True
577    except OSError:
578        env['gmsh']=False
579    
580  ######################## Summarize our environment ###########################  ######################## Summarize our environment ###########################
581    
582  # keep some of our install paths first in the list for the unit tests  # keep some of our install paths first in the list for the unit tests
# Line 572  if not env['verbose']: Line 592  if not env['verbose']:
592      env['ARCOMSTR'] = "Linking $TARGET"      env['ARCOMSTR'] = "Linking $TARGET"
593      env['LINKCOMSTR'] = "Linking $TARGET"      env['LINKCOMSTR'] = "Linking $TARGET"
594      env['SHLINKCOMSTR'] = "Linking $TARGET"      env['SHLINKCOMSTR'] = "Linking $TARGET"
595        env['PDFLATEXCOMSTR'] = "Building $TARGET from LaTeX input $SOURCES"
596        env['BIBTEXCOMSTR'] = "Generating bibliography $TARGET"
597        env['MAKEINDEXCOMSTR'] = "Generating index $TARGET"
598        env['PDFLATEXCOMSTR'] = "Building $TARGET from LaTeX input $SOURCES"
599      #Progress(['Checking -\r', 'Checking \\\r', 'Checking |\r', 'Checking /\r'], interval=17)      #Progress(['Checking -\r', 'Checking \\\r', 'Checking |\r', 'Checking /\r'], interval=17)
600    
601  print("")  print("")
# Line 598  for i in e_list: Line 622  for i in e_list:
622      print("%16s:  YES"%i)      print("%16s:  YES"%i)
623  for i in d_list:  for i in d_list:
624      print("%16s:  DISABLED"%i)      print("%16s:  DISABLED"%i)
625    if env['gmsh']:
626        print("            gmsh:  FOUND")
627    else:
628        print("            gmsh:  NOT FOUND")
629  if ((fatalwarning != '') and (env['werror'])):  if ((fatalwarning != '') and (env['werror'])):
630      print("  Treating warnings as errors")      print("  Treating warnings as errors")
631  else:  else:
# Line 626  Export( Line 654  Export(
654    ]    ]
655  )  )
656    
657  env.SConscript(dirs = ['tools/CppUnitTest/src'], variant_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)  env.SConscript(dirs = ['tools/CppUnitTest/src'], variant_dir='$BUILD_DIR/$PLATFORM/tools/CppUnitTest', duplicate=0)
658  env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='build/$PLATFORM/tools/escriptconvert', duplicate=0)  env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='$BUILD_DIR/$PLATFORM/tools/escriptconvert', duplicate=0)
659  env.SConscript(dirs = ['paso/src'], variant_dir='build/$PLATFORM/paso', duplicate=0)  env.SConscript(dirs = ['paso/src'], variant_dir='$BUILD_DIR/$PLATFORM/paso', duplicate=0)
660  env.SConscript(dirs = ['weipa/src'], variant_dir='build/$PLATFORM/weipa', duplicate=0)  env.SConscript(dirs = ['weipa/src'], variant_dir='$BUILD_DIR/$PLATFORM/weipa', duplicate=0)
661  env.SConscript(dirs = ['escript/src'], variant_dir='build/$PLATFORM/escript', duplicate=0)  env.SConscript(dirs = ['escript/src'], variant_dir='$BUILD_DIR/$PLATFORM/escript', duplicate=0)
662  env.SConscript(dirs = ['esysUtils/src'], variant_dir='build/$PLATFORM/esysUtils', duplicate=0)  env.SConscript(dirs = ['esysUtils/src'], variant_dir='$BUILD_DIR/$PLATFORM/esysUtils', duplicate=0)
663  env.SConscript(dirs = ['dudley/src'], variant_dir='build/$PLATFORM/dudley', duplicate=0)  env.SConscript(dirs = ['dudley/src'], variant_dir='$BUILD_DIR/$PLATFORM/dudley', duplicate=0)
664  env.SConscript(dirs = ['finley/src'], variant_dir='build/$PLATFORM/finley', duplicate=0)  env.SConscript(dirs = ['finley/src'], variant_dir='$BUILD_DIR/$PLATFORM/finley', duplicate=0)
665  env.SConscript(dirs = ['modellib/py_src'], variant_dir='build/$PLATFORM/modellib', duplicate=0)  env.SConscript(dirs = ['modellib/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/modellib', duplicate=0)
666  env.SConscript(dirs = ['doc'], variant_dir='build/$PLATFORM/doc', duplicate=0)  env.SConscript(dirs = ['doc'], variant_dir='$BUILD_DIR/$PLATFORM/doc', duplicate=0)
667  env.SConscript(dirs = ['pyvisi/py_src'], variant_dir='build/$PLATFORM/pyvisi', duplicate=0)  env.SConscript(dirs = ['pyvisi/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pyvisi', duplicate=0)
668  env.SConscript(dirs = ['pycad/py_src'], variant_dir='build/$PLATFORM/pycad', duplicate=0)  env.SConscript(dirs = ['pycad/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pycad', duplicate=0)
669  env.SConscript(dirs = ['pythonMPI/src'], variant_dir='build/$PLATFORM/pythonMPI', duplicate=0)  env.SConscript(dirs = ['pythonMPI/src'], variant_dir='$BUILD_DIR/$PLATFORM/pythonMPI', duplicate=0)
670  env.SConscript(dirs = ['paso/profiling'], variant_dir='build/$PLATFORM/paso/profiling', duplicate=0)  env.SConscript(dirs = ['paso/profiling'], variant_dir='$BUILD_DIR/$PLATFORM/paso/profiling', duplicate=0)
671    
672  ######################## Populate the buildvars file #########################  ######################## Populate the buildvars file #########################
673    
# Line 751  env.Alias('install_cppunittest', ['build Line 779  env.Alias('install_cppunittest', ['build
779  env.Alias('run_tests', ['install_all', 'install_cppunittest_lib'])  env.Alias('run_tests', ['install_all', 'install_cppunittest_lib'])
780  env.Alias('all_tests', ['install_all', 'install_cppunittest_lib', 'run_tests', 'py_tests'])  env.Alias('all_tests', ['install_all', 'install_cppunittest_lib', 'run_tests', 'py_tests'])
781  env.Alias('build_full',['install_all','build_tests','build_py_tests'])  env.Alias('build_full',['install_all','build_tests','build_py_tests'])
782  env.Alias('build_PasoTests','build/$PLATFORM/paso/profiling/PasoTests')  env.Alias('build_PasoTests','$BUILD_DIR/$PLATFORM/paso/profiling/PasoTests')
783    
784  ##################### Targets to build the documentation #####################  ##################### Targets to build the documentation #####################
785    
786  env.Alias('api_epydoc','install_all')  env.Alias('api_epydoc','install_all')
787  env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'guide_html','install_pdf', 'cookbook_pdf'])  env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'user_pdf', 'install_pdf', 'cookbook_pdf'])
788  env.Alias('release_prep', ['docs', 'install_all'])  env.Alias('release_prep', ['docs', 'install_all'])
789    
790  if not IS_WINDOWS:  if not IS_WINDOWS:
# Line 775  if not IS_WINDOWS: Line 803  if not IS_WINDOWS:
803      # Make sure that the escript wrapper is in place      # Make sure that the escript wrapper is in place
804      if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):      if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):
805          print("Copying escript wrapper.")          print("Copying escript wrapper.")
806          Execute(Copy(os.path.join(env['bininstall'],'escript'), 'bin/run-escript'))          Execute(Copy(os.path.join(env['bininstall'],'run-escript'), 'bin/run-escript'))
807    

Legend:
Removed from v.3259  
changed lines
  Added in v.3466

  ViewVC Help
Powered by ViewVC 1.1.26