/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 3511 by lgao, Tue May 17 23:56:13 2011 UTC revision 3675 by jfenwick, Thu Nov 17 00:53:38 2011 UTC
# Line 19  from site_init import * Line 19  from site_init import *
19    
20  # Version number to check for in options file. Increment when new features are  # Version number to check for in options file. Increment when new features are
21  # added or existing options changed.  # added or existing options changed.
22  REQUIRED_OPTS_VERSION=200  REQUIRED_OPTS_VERSION=201
23    
24  # MS Windows support, many thanks to PH  # MS Windows support, many thanks to PH
25  IS_WINDOWS = (os.name == 'nt')  IS_WINDOWS = (os.name == 'nt')
# Line 47  if not os.path.isfile(options_file): Line 47  if not os.path.isfile(options_file):
47  ############################### Build options ################################  ############################### Build options ################################
48    
49  default_prefix='/usr'  default_prefix='/usr'
50  mpi_flavours=('none', 'MPT', 'MPICH', 'MPICH2', 'OPENMPI', 'INTELMPI')  mpi_flavours=('no', 'none', 'MPT', 'MPICH', 'MPICH2', 'OPENMPI', 'INTELMPI')
51  lapack_flavours=('none', 'clapack', 'mkl')  lapack_flavours=('none', 'clapack', 'mkl')
52    
53  vars = Variables(options_file, ARGUMENTS)  vars = Variables(options_file, ARGUMENTS)
# Line 73  vars.AddVariables( Line 73  vars.AddVariables(
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-mt']),    ('boost_libs', 'Boost libraries to link with', ['boost_python-mt']),
76    # Mandatory for tests
77      ('cppunit_prefix', 'Prefix/Paths of CppUnit installation', default_prefix),
78      ('cppunit_libs', 'CppUnit libraries to link with', ['cppunit']),
79  # Optional libraries and options  # Optional libraries and options
80    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),
81    ('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix),    ('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix),
# Line 119  vars.AddVariables( Line 122  vars.AddVariables(
122    EnumVariable('forcecollres', 'For testing use only - set the default value for force resolving collective ops', 'leave_alone', allowed_values=('leave_alone', 'on', 'off')),    EnumVariable('forcecollres', 'For testing use only - set the default value for force resolving collective ops', 'leave_alone', allowed_values=('leave_alone', 'on', 'off')),
123    # finer control over library building, intel aggressive global optimisation    # finer control over library building, intel aggressive global optimisation
124    # works with dynamic libraries on windows.    # works with dynamic libraries on windows.
125    ('share_esysutils', 'Build a dynamic esysUtils library', False),    ('build_shared', 'Build dynamic libraries only', False),
   ('share_paso', 'Build a dynamic paso library', False),  
126    ('sys_libs', 'Extra libraries to link with', []),    ('sys_libs', 'Extra libraries to link with', []),
127    ('escript_opts_version', 'Version of options file (do not specify on command line)'),    ('escript_opts_version', 'Version of options file (do not specify on command line)'),
128      ('SVN_VERSION', 'Do not use from options file', -2),
129  )  )
130    
131  ##################### Create environment and help text #######################  ##################### Create environment and help text #######################
# Line 281  env.Append(CCFLAGS = env['cc_flags']) Line 284  env.Append(CCFLAGS = env['cc_flags'])
284  # add system libraries  # add system libraries
285  env.AppendUnique(LIBS = env['sys_libs'])  env.AppendUnique(LIBS = env['sys_libs'])
286    
287  # Get the global Subversion revision number for the getVersion() method  
288  try:  global_revision=ARGUMENTS.get('SVN_VERSION', None)
289    if global_revision:
290        global_revision = re.sub(':.*', '', global_revision)
291        global_revision = re.sub('[^0-9]', '', global_revision)
292        if global_revision == '': global_revision='-2'
293    else:
294      # Get the global Subversion revision number for the getVersion() method
295      try:
296      global_revision = os.popen('svnversion -n .').read()      global_revision = os.popen('svnversion -n .').read()
297      global_revision = re.sub(':.*', '', global_revision)      global_revision = re.sub(':.*', '', global_revision)
298      global_revision = re.sub('[^0-9]', '', global_revision)      global_revision = re.sub('[^0-9]', '', global_revision)
299      if global_revision == '': global_revision='-2'      if global_revision == '': global_revision='-2'
300  except:    except:
301      global_revision = '-1'      global_revision = '-1'
302  env['svn_revision']=global_revision  env['svn_revision']=global_revision
303  env.Append(CPPDEFINES=['SVN_VERSION='+global_revision])  env.Append(CPPDEFINES=['SVN_VERSION='+global_revision])
304    
305  if IS_WINDOWS:  if IS_WINDOWS:
306      if not env['share_esysutils']:      if not env['build_shared']:
307          env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])          env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])
     if not env['share_paso']:  
308          env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])          env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])
309    
310  ###################### Copy required environment vars ########################  ###################### Copy required environment vars ########################
# Line 440  except ImportError: Line 449  except ImportError:
449      print("Cannot import numpy, you need to set your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY)      print("Cannot import numpy, you need to set your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY)
450      Exit(1)      Exit(1)
451    
452    ######## CppUnit (required for tests)
453    
454    try:
455        cppunit_inc_path,cppunit_lib_path=findLibWithHeader(env, env['cppunit_libs'], 'cppunit/TestFixture.h', env['cppunit_prefix'], lang='c++')
456        env.AppendUnique(CPPPATH = [cppunit_inc_path])
457        env.AppendUnique(LIBPATH = [cppunit_lib_path])
458        env.PrependENVPath(LD_LIBRARY_PATH_KEY, cppunit_lib_path)
459        env['cppunit']=True
460    except:
461        env['cppunit']=False
462    
463  ######## VTK (optional)  ######## VTK (optional)
464    
465  if env['pyvisi']:  if env['pyvisi']:
# Line 545  if env['visit']: Line 565  if env['visit']:
565    
566  ######## MPI (optional)  ######## MPI (optional)
567    
568    if env['mpi']=='no':
569        env['mpi']='none'
570    
571  env['usempi'] = env['mpi']!='none'  env['usempi'] = env['mpi']!='none'
572  mpi_inc_path=''  mpi_inc_path=''
573  mpi_lib_path=''  mpi_lib_path=''
# Line 563  if env['usempi']: Line 586  if env['usempi']:
586    
587  ######## BOOMERAMG (optional)  ######## BOOMERAMG (optional)
588    
 #if env['boomeramg'] and env['mpi'] == 'none':  
 #    print("boomeramg requires mpi!")  
 #    Exit(1)  
589  if env['mpi'] == 'none': env['boomeramg'] = False  if env['mpi'] == 'none': env['boomeramg'] = False
590    
591  boomeramg_inc_path=''  boomeramg_inc_path=''
# Line 574  if env['boomeramg']: Line 594  if env['boomeramg']:
594      boomeramg_inc_path,boomeramg_lib_path=findLibWithHeader(env, env['boomeramg_libs'], 'HYPRE.h', env['boomeramg_prefix'], lang='c')      boomeramg_inc_path,boomeramg_lib_path=findLibWithHeader(env, env['boomeramg_libs'], 'HYPRE.h', env['boomeramg_prefix'], lang='c')
595      env.AppendUnique(CPPPATH = [boomeramg_inc_path])      env.AppendUnique(CPPPATH = [boomeramg_inc_path])
596      env.AppendUnique(LIBPATH = [boomeramg_lib_path])      env.AppendUnique(LIBPATH = [boomeramg_lib_path])
     # Note that we do not add the libs since they are only needed for the  
     # weipa library and tools.  
597      env.AppendUnique(LIBS = env['boomeramg_libs'])      env.AppendUnique(LIBS = env['boomeramg_libs'])
598      env.PrependENVPath(LD_LIBRARY_PATH_KEY, boomeramg_lib_path)      env.PrependENVPath(LD_LIBRARY_PATH_KEY, boomeramg_lib_path)
599      env.Append(CPPDEFINES = ['BOOMERAMG'])      env.Append(CPPDEFINES = ['BOOMERAMG'])
# Line 598  if env['parmetis']: Line 616  if env['parmetis']:
616    
617  try:  try:
618      import subprocess      import subprocess
619      p=subprocess.Popen(['gmsh', '-version'], stderr=subprocess.PIPE)      p=subprocess.Popen(['gmsh', '-info'], stderr=subprocess.PIPE)
620      p.poll()      _,e=p.communicate()
621      env['gmsh']=True      if e.split().count("MPI"):
622            env['gmsh']='m'
623        else:
624            env['gmsh']='s'
625  except OSError:  except OSError:
626      env['gmsh']=False      env['gmsh']=False
627    
628    ######## PDFLaTeX (for documentation)
629    if 'PDF' in dir(env) and '.tex' in env.PDF.builder.src_suffixes(env):
630        env['pdflatex']=True
631    else:
632        env['pdflatex']=False
633    
634  ######################## Summarize our environment ###########################  ######################## Summarize our environment ###########################
635    
636  # 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 649  for i in e_list: Line 676  for i in e_list:
676      print("%16s:  YES"%i)      print("%16s:  YES"%i)
677  for i in d_list:  for i in d_list:
678      print("%16s:  DISABLED"%i)      print("%16s:  DISABLED"%i)
679  if env['gmsh']:  if env['cppunit']:
680        print("         CppUnit:  FOUND")
681    else:
682        print("         CppUnit:  NOT FOUND")
683    if env['gmsh']=='m':
684        print("            gmsh:  FOUND, MPI-ENABLED")
685    elif env['gmsh']=='s':
686      print("            gmsh:  FOUND")      print("            gmsh:  FOUND")
687  else:  else:
688      print("            gmsh:  NOT FOUND")      print("            gmsh:  NOT FOUND")
# Line 683  Export( Line 716  Export(
716    ]    ]
717  )  )
718    
 env.SConscript(dirs = ['tools/CppUnitTest/src'], variant_dir='$BUILD_DIR/$PLATFORM/tools/CppUnitTest', duplicate=0)  
719  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)
720  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)
721  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)
722  env.SConscript(dirs = ['escript/src'], variant_dir='$BUILD_DIR/$PLATFORM/escript', duplicate=0)  env.SConscript(dirs = ['escript/src'], variant_dir='$BUILD_DIR/$PLATFORM/escript', duplicate=0)
723  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)
724    env.SConscript(dirs = ['pasowrap/src'], variant_dir='$BUILD_DIR/$PLATFORM/pasowrap', duplicate=0)
725  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)
726  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)
727  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)
# Line 734  buildvars.write("mpi_inc_path=%s\n"%mpi_ Line 767  buildvars.write("mpi_inc_path=%s\n"%mpi_
767  buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path)  buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path)
768  buildvars.write("lapack=%s\n"%env['lapack'])  buildvars.write("lapack=%s\n"%env['lapack'])
769  buildvars.write("pyvisi=%d\n"%env['pyvisi'])  buildvars.write("pyvisi=%d\n"%env['pyvisi'])
770  buildvars.write("vsl_random=%d"%int(env['vsl_random']))  buildvars.write("vsl_random=%d\n"%int(env['vsl_random']))
771  for i in 'netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit':  for i in 'netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit':
772      buildvars.write("%s=%d\n"%(i, int(env[i])))      buildvars.write("%s=%d\n"%(i, int(env[i])))
773      if env[i]:      if env[i]:
# Line 744  buildvars.close() Line 777  buildvars.close()
777    
778  ################### Targets to build and install libraries ###################  ################### Targets to build and install libraries ###################
779    
780  target_init = env.Command(env['pyinstall']+'/__init__.py', None, Touch('$TARGET'))  target_init = env.Command(os.path.join(env['pyinstall'],'__init__.py'), None, Touch('$TARGET'))
781  env.Alias('target_init', [target_init])  env.Alias('target_init', [target_init])
782    # delete buildvars upon cleanup
783    env.Clean('target_init', os.path.join(env['libinstall'], 'buildvars'))
784    
785  # The headers have to be installed prior to build in order to satisfy  # The headers have to be installed prior to build in order to satisfy
786  # #include <paso/Common.h>  # #include <paso/Common.h>
# Line 758  env.Alias('install_paso', ['build_paso', Line 793  env.Alias('install_paso', ['build_paso',
793  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'])
794  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_escript_py'])
795    
796    env.Alias('build_pasowrap', ['install_pasowrap_headers', 'build_pasowrap_lib', 'build_pasowrapcpp_lib'])
797    env.Alias('install_pasowrap', ['build_pasowrap', 'install_pasowrap_lib', 'install_pasowrapcpp_lib', 'install_pasowrap_py'])
798    
799    
800  env.Alias('build_dudley', ['install_dudley_headers', 'build_dudley_lib', 'build_dudleycpp_lib'])  env.Alias('build_dudley', ['install_dudley_headers', 'build_dudley_lib', 'build_dudleycpp_lib'])
801  env.Alias('install_dudley', ['build_dudley', 'install_dudley_lib', 'install_dudleycpp_lib', 'install_dudley_py'])  env.Alias('install_dudley', ['build_dudley', 'install_dudley_lib', 'install_dudleycpp_lib', 'install_dudley_py'])
802    
# Line 775  build_all_list = [] Line 814  build_all_list = []
814  build_all_list += ['build_esysUtils']  build_all_list += ['build_esysUtils']
815  build_all_list += ['build_paso']  build_all_list += ['build_paso']
816  build_all_list += ['build_escript']  build_all_list += ['build_escript']
817    build_all_list += ['build_pasowrap']
818  build_all_list += ['build_dudley']  build_all_list += ['build_dudley']
819  build_all_list += ['build_finley']  build_all_list += ['build_finley']
820  build_all_list += ['build_weipa']  build_all_list += ['build_weipa']
# Line 788  install_all_list += ['target_init'] Line 828  install_all_list += ['target_init']
828  install_all_list += ['install_esysUtils']  install_all_list += ['install_esysUtils']
829  install_all_list += ['install_paso']  install_all_list += ['install_paso']
830  install_all_list += ['install_escript']  install_all_list += ['install_escript']
831    install_all_list += ['install_pasowrap']
832  install_all_list += ['install_dudley']  install_all_list += ['install_dudley']
833  install_all_list += ['install_finley']  install_all_list += ['install_finley']
834  install_all_list += ['install_weipa']  install_all_list += ['install_weipa']
# Line 804  env.Default('install_all') Line 845  env.Default('install_all')
845    
846  ################## Targets to build and run the test suite ###################  ################## Targets to build and run the test suite ###################
847    
848  env.Alias('build_cppunittest', ['install_cppunittest_headers', 'build_cppunittest_lib'])  test_msg = env.Command('.dummy.', None, '@echo "Cannot run C/C++ unit tests, CppUnit not found!";exit 1')
849  env.Alias('install_cppunittest', ['build_cppunittest', 'install_cppunittest_lib'])  if not env['cppunit']:
850  env.Alias('run_tests', ['install_all', 'install_cppunittest_lib'])      env.Alias('run_tests', test_msg)
851  env.Alias('all_tests', ['install_all', 'install_cppunittest_lib', 'run_tests', 'py_tests'])  env.Alias('run_tests', ['install_all'])
852    env.Alias('all_tests', ['install_all', 'run_tests', 'py_tests'])
853  env.Alias('build_full',['install_all','build_tests','build_py_tests'])  env.Alias('build_full',['install_all','build_tests','build_py_tests'])
854  env.Alias('build_PasoTests','$BUILD_DIR/$PLATFORM/paso/profiling/PasoTests')  env.Alias('build_PasoTests','$BUILD_DIR/$PLATFORM/paso/profiling/PasoTests')
855    
# Line 830  if not IS_WINDOWS: Line 872  if not IS_WINDOWS:
872          print("Error attempting to write unittests file.")          print("Error attempting to write unittests file.")
873          Exit(1)          Exit(1)
874    
875        # delete utest.sh upon cleanup
876        env.Clean('target_init', 'utest.sh')
877    
878      # Make sure that the escript wrapper is in place      # Make sure that the escript wrapper is in place
879      if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):      if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):
880          print("Copying escript wrapper.")          print("Copying escript wrapper.")

Legend:
Removed from v.3511  
changed lines
  Added in v.3675

  ViewVC Help
Powered by ViewVC 1.1.26