/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 3585 by caltinay, Wed Sep 7 06:16:08 2011 UTC revision 3977 by caltinay, Thu Sep 20 04:27:10 2012 UTC
# Line 1  Line 1 
1  ########################################################  ########################################################
2  #  #
3  # Copyright (c) 2003-2010 by University of Queensland  # Copyright (c) 2003-2012 by University of Queensland
4  # Earth Systems Science Computational Center (ESSCC)  # Earth Systems Science Computational Center (ESSCC)
5  # http://www.uq.edu.au/esscc  # http://www.uq.edu.au/esscc
6  #  #
# Line 16  EnsurePythonVersion(2,5) Line 16  EnsurePythonVersion(2,5)
16  import sys, os, platform, re  import sys, os, platform, re
17  from distutils import sysconfig  from distutils import sysconfig
18  from site_init import *  from site_init import *
19    from subprocess import PIPE, Popen
20    
21  # 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
22  # added or existing options changed.  # added or existing options changed.
23  REQUIRED_OPTS_VERSION=200  REQUIRED_OPTS_VERSION=201
24    
25  # MS Windows support, many thanks to PH  # MS Windows support, many thanks to PH
26  IS_WINDOWS = (os.name == 'nt')  IS_WINDOWS = (os.name == 'nt')
# Line 47  if not os.path.isfile(options_file): Line 48  if not os.path.isfile(options_file):
48  ############################### Build options ################################  ############################### Build options ################################
49    
50  default_prefix='/usr'  default_prefix='/usr'
51  mpi_flavours=('none', 'MPT', 'MPICH', 'MPICH2', 'OPENMPI', 'INTELMPI')  mpi_flavours=('no', 'none', 'MPT', 'MPICH', 'MPICH2', 'OPENMPI', 'INTELMPI')
52  lapack_flavours=('none', 'clapack', 'mkl')  lapack_flavours=('none', 'clapack', 'mkl')
53    
54  vars = Variables(options_file, ARGUMENTS)  vars = Variables(options_file, ARGUMENTS)
# Line 73  vars.AddVariables( Line 74  vars.AddVariables(
74  # Mandatory libraries  # Mandatory libraries
75    ('boost_prefix', 'Prefix/Paths of boost installation', default_prefix),    ('boost_prefix', 'Prefix/Paths of boost installation', default_prefix),
76    ('boost_libs', 'Boost libraries to link with', ['boost_python-mt']),    ('boost_libs', 'Boost libraries to link with', ['boost_python-mt']),
77    # Mandatory for tests
78      ('cppunit_prefix', 'Prefix/Paths of CppUnit installation', default_prefix),
79      ('cppunit_libs', 'CppUnit libraries to link with', ['cppunit']),
80  # Optional libraries and options  # Optional libraries and options
81    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),
82    ('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix),    ('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix),
# Line 105  vars.AddVariables( Line 109  vars.AddVariables(
109    BoolVariable('visit', 'Enable the VisIt simulation interface', False),    BoolVariable('visit', 'Enable the VisIt simulation interface', False),
110    ('visit_prefix', 'Prefix/Paths to VisIt installation', default_prefix),    ('visit_prefix', 'Prefix/Paths to VisIt installation', default_prefix),
111    ('visit_libs', 'VisIt libraries to link with', ['simV2']),    ('visit_libs', 'VisIt libraries to link with', ['simV2']),
   BoolVariable('pyvisi', 'Enable pyvisi (deprecated, requires VTK module)', False),  
112    BoolVariable('vsl_random', 'Use VSL from intel for random data', False),    BoolVariable('vsl_random', 'Use VSL from intel for random data', False),
113  # Advanced settings  # Advanced settings
114    #dudley_assemble_flags = -funroll-loops      to actually do something    #dudley_assemble_flags = -funroll-loops      to actually do something
# 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      ('pythoncmd', 'which python to compile with','python'),
130      ('usepython3', 'Is this a python3 build? (experimental)', False),
131      ('pythonlibname', 'Name of the python library to link. (This is found automatically for python2.X.)', ''),
132      ('pythonlibpath', 'Path to the python library. (You should not need to set this unless your python has moved)',''),
133      ('pythonincpath','Path to python include files. (You should not need to set this unless your python has moved',''),
134      BoolVariable('BADPYTHONMACROS','Extra \#include to get around a python bug.', True),
135  )  )
136    
137  ##################### Create environment and help text #######################  ##################### Create environment and help text #######################
# Line 134  vars.AddVariables( Line 143  vars.AddVariables(
143  # in default locations.  # in default locations.
144  env = Environment(tools = ['default'], options = vars,  env = Environment(tools = ['default'], options = vars,
145                    ENV = {'PATH': os.environ['PATH']})                    ENV = {'PATH': os.environ['PATH']})
146                      
147    
148    #set the vars for clang
149    def mkclang(env):
150      env['CC']='clang'
151      env['CXX']='clang++'
152                      
153                      
154  if env['tools_names'] != 'default':  if env['tools_names'] != 'default':
155        zz=env['tools_names']
156        if 'clang' in zz:
157            zz.remove('clang')
158            zz.insert(0, mkclang)
159      env = Environment(tools = ['default'] + env['tools_names'], options = vars,      env = Environment(tools = ['default'] + env['tools_names'], options = vars,
160                        ENV = {'PATH' : os.environ['PATH']})                        ENV = {'PATH' : os.environ['PATH']})
161    
# Line 206  if cc_name == 'icc': Line 227  if cc_name == 'icc':
227      cc_optim    = "-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias -ip"      cc_optim    = "-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias -ip"
228      cc_debug    = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"      cc_debug    = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"
229      omp_flags   = "-openmp -openmp_report0"      omp_flags   = "-openmp -openmp_report0"
230      omp_ldflags = "-openmp -openmp_report0 -lguide -lpthread"      omp_ldflags = "-openmp -openmp_report0 -lpthread"
231      fatalwarning = "-Werror"      fatalwarning = "-Werror"
232  elif cc_name[:3] == 'gcc':  elif cc_name[:3] == 'gcc':
233      # GNU C on any system      # GNU C on any system
# Line 241  if env['cc_extra']  != '': env.Append(CF Line 262  if env['cc_extra']  != '': env.Append(CF
262  if env['cxx_extra'] != '': env.Append(CXXFLAGS = env['cxx_extra'])  if env['cxx_extra'] != '': env.Append(CXXFLAGS = env['cxx_extra'])
263  if env['ld_extra']  != '': env.Append(LINKFLAGS = env['ld_extra'])  if env['ld_extra']  != '': env.Append(LINKFLAGS = env['ld_extra'])
264    
265    if env['BADPYTHONMACROS']: env.Append(CXXFLAGS = ' -DBADPYTHONMACROS')
266    
267    if env['usepython3']:
268        env.Append(CPPDEFINES=['ESPYTHON3'])
269    
270  # set up the autolazy values  # set up the autolazy values
271  if env['forcelazy'] == 'on':  if env['forcelazy'] == 'on':
272      env.Append(CPPDEFINES=['FAUTOLAZYON'])      env.Append(CPPDEFINES=['FAUTOLAZYON'])
# Line 281  env.Append(CCFLAGS = env['cc_flags']) Line 307  env.Append(CCFLAGS = env['cc_flags'])
307  # add system libraries  # add system libraries
308  env.AppendUnique(LIBS = env['sys_libs'])  env.AppendUnique(LIBS = env['sys_libs'])
309    
310  # Get the global Subversion revision number for the getVersion() method  
311  try:  global_revision=ARGUMENTS.get('SVN_VERSION', None)
312    if global_revision:
313        global_revision = re.sub(':.*', '', global_revision)
314        global_revision = re.sub('[^0-9]', '', global_revision)
315        if global_revision == '': global_revision='-2'
316    else:
317      # Get the global Subversion revision number for the getVersion() method
318      try:
319      global_revision = os.popen('svnversion -n .').read()      global_revision = os.popen('svnversion -n .').read()
320      global_revision = re.sub(':.*', '', global_revision)      global_revision = re.sub(':.*', '', global_revision)
321      global_revision = re.sub('[^0-9]', '', global_revision)      global_revision = re.sub('[^0-9]', '', global_revision)
322      if global_revision == '': global_revision='-2'      if global_revision == '': global_revision='-2'
323  except:    except:
324      global_revision = '-1'      global_revision = '-1'
325  env['svn_revision']=global_revision  env['svn_revision']=global_revision
326  env.Append(CPPDEFINES=['SVN_VERSION='+global_revision])  env.Append(CPPDEFINES=['SVN_VERSION='+global_revision])
327    
328  if IS_WINDOWS:  if IS_WINDOWS:
329      if not env['share_esysutils']:      if not env['build_shared']:
330          env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])          env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])
     if not env['share_paso']:  
331          env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])          env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])
332    
333  ###################### Copy required environment vars ########################  ###################### Copy required environment vars ########################
# Line 316  for key in 'OMP_NUM_THREADS', 'ESCRIPT_N Line 348  for key in 'OMP_NUM_THREADS', 'ESCRIPT_N
348          env['ENV'][key] = 1          env['ENV'][key] = 1
349    
350  env_export=env['env_export']  env_export=env['env_export']
351  env_export.extend(['ESCRIPT_NUM_THREADS','ESCRIPT_HOSTFILE','DISPLAY','XAUTHORITY','PATH','HOME','TMPDIR','TEMP','TMP'])  env_export.extend(['ESCRIPT_NUM_THREADS','ESCRIPT_HOSTFILE','DISPLAY','XAUTHORITY','PATH','HOME','KMP_MONITOR_STACKSIZE','TMPDIR','TEMP','TMP'])
352    
353  for key in set(env_export):  for key in set(env_export):
354      try:      try:
# Line 343  except KeyError: Line 375  except KeyError:
375    
376  ######################## Add some custom builders ############################  ######################## Add some custom builders ############################
377    
378  py_builder = Builder(action = build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)  if env['pythoncmd']=='python':
379        py_builder = Builder(action = build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
380    else:
381        py_builder = Builder(action = env['pythoncmd']+" scripts/py_comp.py $SOURCE $TARGET", suffix = '.pyc', src_suffix = '.py', single_source=True)
382  env.Append(BUILDERS = {'PyCompile' : py_builder});  env.Append(BUILDERS = {'PyCompile' : py_builder});
383    
384  runUnitTest_builder = Builder(action = runUnitTest, suffix = '.passed', src_suffix=env['PROGSUFFIX'], single_source=True)  runUnitTest_builder = Builder(action = runUnitTest, suffix = '.passed', src_suffix=env['PROGSUFFIX'], single_source=True)
# Line 382  if conf.CheckFunc('gethostname'): Line 417  if conf.CheckFunc('gethostname'):
417    
418  ######## Python headers & library (required)  ######## Python headers & library (required)
419    
420  python_inc_path=sysconfig.get_python_inc()  #First we check to see if the config file has specified
421  if IS_WINDOWS:  ##Where to find the filae. Ideally, this should be automatic
422      python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs')  #But we need to deal with the case where python is not in its INSTALL
423  elif env['PLATFORM']=='darwin':  #Directory
424      python_lib_path=sysconfig.get_config_var('LIBPL')  # Use the python scons is running
425  else:  if env['pythoncmd']=='python':
426      python_lib_path=sysconfig.get_config_var('LIBDIR')      python_inc_path=sysconfig.get_python_inc()
427  #python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux      if IS_WINDOWS:
428  if IS_WINDOWS:          python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs')
429      python_libs=['python%s%s'%(sys.version_info[0], sys.version_info[1])]      elif env['PLATFORM']=='darwin':
430            python_lib_path=sysconfig.get_config_var('LIBPL')
431        else:
432            python_lib_path=sysconfig.get_config_var('LIBDIR')
433    
434        #python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux
435        if IS_WINDOWS:
436            python_libs=['python%s%s'%(sys.version_info[0], sys.version_info[1])]
437        else:
438            python_libs=['python'+sysconfig.get_python_version()]
439    
440    #if we want to use a python other than the one scons is running
441  else:  else:
442      python_libs=['python'+sysconfig.get_python_version()]      initstring='from __future__ import print_function;from distutils import sysconfig;'
443        if env['pythonlibname']!='':
444            python_libs=env['pythonlibname']
445        else:   # work it out by calling python    
446            if IS_WINDOWS:
447                cmd='print("python%s%s"%(sys.version_info[0], sys.version_info[1]))'
448            else:
449                cmd='print("python"+sysconfig.get_python_version())'
450            p=Popen([env['pythoncmd'], '-c', initstring+cmd], stdout=PIPE)
451            python_libs=p.stdout.readline()
452            if env['usepython3']:       # This is to convert unicode str into py2 string
453                python_libs=python_libs.encode() # If scons runs on py3 then this must be rethought
454            p.wait()
455            python_libs=python_libs.strip()
456    
457      
458        # Now we know whether we are using python3 or not
459        p=Popen([env['pythoncmd'], '-c',  initstring+'print(sysconfig.get_python_inc())'], stdout=PIPE)
460        python_inc_path=p.stdout.readline()
461        if env['usepython3']:
462             python_inc_path=python_inc_path.encode()
463        p.wait()  
464        python_inc_path=python_inc_path.strip()
465        if IS_WINDOWS:
466            cmd="os.path.join(sysconfig.get_config_var('prefix'), 'libs')"
467        elif env['PLATFORM']=='darwin':
468            cmd="sysconfig.get_config_var(\"LIBPL\")"
469        else:
470            cmd="sysconfig.get_config_var(\"LIBDIR\")"
471    
472        p=Popen([env['pythoncmd'], '-c', initstring+'print('+cmd+')'], stdout=PIPE)
473        python_lib_path=p.stdout.readline()
474        if env['usepython3']:
475            python_lib_path=python_lib_path.decode()
476        p.wait()
477        python_lib_path=python_lib_path.strip()
478    
479    #Check for an override from the config file.
480    #Ideally, this should be automatic
481    #But we need to deal with the case where python is not in its INSTALL
482    #Directory
483    if env['pythonlibpath']!='':
484        python_lib_path=env['pythonlibpath']
485    
486    if env['pythonincpath']!='':
487        python_inc_path=env['pythonincpath']
488    
489    
490  if sysheaderopt == '':  if sysheaderopt == '':
491      conf.env.AppendUnique(CPPPATH = [python_inc_path])      conf.env.AppendUnique(CPPPATH = [python_inc_path])
# Line 412  if not conf.CheckFunc('Py_Exit'): Line 504  if not conf.CheckFunc('Py_Exit'):
504      print("Cannot find python library method Py_Main (tried %s in directory %s)" % (python_libs, python_lib_path))      print("Cannot find python library method Py_Main (tried %s in directory %s)" % (python_libs, python_lib_path))
505      Exit(1)      Exit(1)
506    
507    ## reuse conf to check for numpy header (optional)
508    if env['usepython3']:
509        # FIXME: This is until we can work out how to make the checks in python 3
510        conf.env['numpy_h']=False
511    else:
512        if conf.CheckCXXHeader(['Python.h','numpy/ndarrayobject.h']):
513            conf.env.Append(CPPDEFINES = ['HAVE_NUMPY_H'])
514            conf.env['numpy_h']=True
515        else:
516            conf.env['numpy_h']=False
517    
518  # Commit changes to environment  # Commit changes to environment
519  env = conf.Finish()  env = conf.Finish()
520    
# Line 434  env.PrependENVPath(LD_LIBRARY_PATH_KEY, Line 537  env.PrependENVPath(LD_LIBRARY_PATH_KEY,
537    
538  ######## numpy (required)  ######## numpy (required)
539    
540  try:  if not detectModule(env, 'numpy'):
541      from numpy import identity      print("Cannot import numpy. If it is installed try setting your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY)
 except ImportError:  
     print("Cannot import numpy, you need to set your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY)  
542      Exit(1)      Exit(1)
543    
544  ######## VTK (optional)  ######## CppUnit (required for tests)
545    
546  if env['pyvisi']:  try:
547      try:      cppunit_inc_path,cppunit_lib_path=findLibWithHeader(env, env['cppunit_libs'], 'cppunit/TestFixture.h', env['cppunit_prefix'], lang='c++')
548          import vtk      env.AppendUnique(CPPPATH = [cppunit_inc_path])
549          env['pyvisi'] = True      env.AppendUnique(LIBPATH = [cppunit_lib_path])
550      except ImportError:      env.PrependENVPath(LD_LIBRARY_PATH_KEY, cppunit_lib_path)
551          print("Cannot import vtk, disabling pyvisi.")      env['cppunit']=True
552          env['pyvisi'] = False  except:
553        env['cppunit']=False
554    
555    ######## sympy (optional)
556    
557    if detectModule(env, 'sympy'):
558        env['sympy'] = True
559    else:
560        print("Cannot import sympy. Symbolic toolbox and nonlinear PDEs will not be available.")
561        env['sympy'] = False
562    
563  ######## netCDF (optional)  ######## netCDF (optional)
564    
# Line 545  if env['visit']: Line 655  if env['visit']:
655    
656  ######## MPI (optional)  ######## MPI (optional)
657    
658    if env['mpi']=='no':
659        env['mpi']='none'
660    
661  env['usempi'] = env['mpi']!='none'  env['usempi'] = env['mpi']!='none'
662  mpi_inc_path=''  mpi_inc_path=''
663  mpi_lib_path=''  mpi_lib_path=''
# Line 563  if env['usempi']: Line 676  if env['usempi']:
676    
677  ######## BOOMERAMG (optional)  ######## BOOMERAMG (optional)
678    
 #if env['boomeramg'] and env['mpi'] == 'none':  
 #    print("boomeramg requires mpi!")  
 #    Exit(1)  
679  if env['mpi'] == 'none': env['boomeramg'] = False  if env['mpi'] == 'none': env['boomeramg'] = False
680    
681  boomeramg_inc_path=''  boomeramg_inc_path=''
# Line 574  if env['boomeramg']: Line 684  if env['boomeramg']:
684      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')
685      env.AppendUnique(CPPPATH = [boomeramg_inc_path])      env.AppendUnique(CPPPATH = [boomeramg_inc_path])
686      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.  
687      env.AppendUnique(LIBS = env['boomeramg_libs'])      env.AppendUnique(LIBS = env['boomeramg_libs'])
688      env.PrependENVPath(LD_LIBRARY_PATH_KEY, boomeramg_lib_path)      env.PrependENVPath(LD_LIBRARY_PATH_KEY, boomeramg_lib_path)
689      env.Append(CPPDEFINES = ['BOOMERAMG'])      env.Append(CPPDEFINES = ['BOOMERAMG'])
# Line 597  if env['parmetis']: Line 705  if env['parmetis']:
705  ######## gmsh (optional, for tests)  ######## gmsh (optional, for tests)
706    
707  try:  try:
708      import subprocess      p=Popen(['gmsh', '-info'], stderr=PIPE)
     p=subprocess.Popen(['gmsh', '-info'], stderr=subprocess.PIPE)  
709      _,e=p.communicate()      _,e=p.communicate()
710      if e.split().count("MPI"):      if e.split().count("MPI"):
711          env['gmsh']='m'          env['gmsh']='m'
# Line 607  try: Line 714  try:
714  except OSError:  except OSError:
715      env['gmsh']=False      env['gmsh']=False
716    
717    ######## PDFLaTeX (for documentation)
718    if 'PDF' in dir(env) and '.tex' in env.PDF.builder.src_suffixes(env):
719        env['pdflatex']=True
720    else:
721        env['pdflatex']=False
722    
723  ######################## Summarize our environment ###########################  ######################## Summarize our environment ###########################
724    
725  # 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 645  else: Line 758  else:
758      print("          LAPACK:  DISABLED")      print("          LAPACK:  DISABLED")
759  d_list=[]  d_list=[]
760  e_list=[]  e_list=[]
761  for i in 'debug','openmp','netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit':  for i in 'debug','openmp','boomeramg','mkl','netcdf','papi','parmetis','silo','sympy','umfpack','visit','vsl_random':
762      if env[i]: e_list.append(i)      if env[i]: e_list.append(i)
763      else: d_list.append(i)      else: d_list.append(i)
764  for i in e_list:  for i in e_list:
765      print("%16s:  YES"%i)      print("%16s:  YES"%i)
766  for i in d_list:  for i in d_list:
767      print("%16s:  DISABLED"%i)      print("%16s:  DISABLED"%i)
768    if env['cppunit']:
769        print("         CppUnit:  FOUND")
770    else:
771        print("         CppUnit:  NOT FOUND")
772  if env['gmsh']=='m':  if env['gmsh']=='m':
773      print("            gmsh:  FOUND, MPI-ENABLED")      print("            gmsh:  FOUND, MPI-ENABLED")
774  elif env['gmsh']=='s':  elif env['gmsh']=='s':
775      print("            gmsh:  FOUND")      print("            gmsh:  FOUND")
776  else:  else:
777      print("            gmsh:  NOT FOUND")      print("            gmsh:  NOT FOUND")
778  print("      vsl_random:  %s"%env['vsl_random'])  if env['numpy_h']:
779        print("   numpy headers:  FOUND")
780    else:
781        print("   numpy headers:  NOT FOUND")
782    print("   vsl_random:  %s"%env['vsl_random'])
783            
784  if ((fatalwarning != '') and (env['werror'])):  if ((fatalwarning != '') and (env['werror'])):
785      print("  Treating warnings as errors")      print("  Treating warnings as errors")
# Line 688  Export( Line 809  Export(
809    ]    ]
810  )  )
811    
 env.SConscript(dirs = ['tools/CppUnitTest/src'], variant_dir='$BUILD_DIR/$PLATFORM/tools/CppUnitTest', duplicate=0)  
812  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)
813  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)
814  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)
815  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)
816  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)
817    env.SConscript(dirs = ['pasowrap/src'], variant_dir='$BUILD_DIR/$PLATFORM/pasowrap', duplicate=0)
818  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)
819  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)
820    env.SConscript(dirs = ['ripley/src'], variant_dir='$BUILD_DIR/$PLATFORM/ripley', duplicate=0)
821    env.SConscript(dirs = ['downunder/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/downunder', duplicate=0)
822  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)
 env.SConscript(dirs = ['doc'], variant_dir='$BUILD_DIR/$PLATFORM/doc', duplicate=0)  
 env.SConscript(dirs = ['pyvisi/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pyvisi', duplicate=0)  
823  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)
824  env.SConscript(dirs = ['pythonMPI/src'], variant_dir='$BUILD_DIR/$PLATFORM/pythonMPI', duplicate=0)  env.SConscript(dirs = ['pythonMPI/src'], variant_dir='$BUILD_DIR/$PLATFORM/pythonMPI', duplicate=0)
825    env.SConscript(dirs = ['doc'], variant_dir='$BUILD_DIR/$PLATFORM/doc', duplicate=0)
826  env.SConscript(dirs = ['paso/profiling'], variant_dir='$BUILD_DIR/$PLATFORM/paso/profiling', duplicate=0)  env.SConscript(dirs = ['paso/profiling'], variant_dir='$BUILD_DIR/$PLATFORM/paso/profiling', duplicate=0)
827    
828    
829  ######################## Populate the buildvars file #########################  ######################## Populate the buildvars file #########################
830    
831  # remove obsolete file  # remove obsolete file
# Line 722  except StopIteration: Line 845  except StopIteration:
845      pass      pass
846  boosthpp.close()  boosthpp.close()
847    
848    
849  buildvars=open(os.path.join(env['libinstall'], 'buildvars'), 'w')  buildvars=open(os.path.join(env['libinstall'], 'buildvars'), 'w')
850  buildvars.write("svn_revision="+str(global_revision)+"\n")  buildvars.write("svn_revision="+str(global_revision)+"\n")
851  buildvars.write("prefix="+prefix+"\n")  buildvars.write("prefix="+prefix+"\n")
852  buildvars.write("cc="+env['CC']+"\n")  buildvars.write("cc="+env['CC']+"\n")
853  buildvars.write("cxx="+env['CXX']+"\n")  buildvars.write("cxx="+env['CXX']+"\n")
854  buildvars.write("python="+sys.executable+"\n")  if env['pythoncmd']=='python':
855  buildvars.write("python_version="+str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2])+"\n")      buildvars.write("python="+sys.executable+"\n")
856        buildvars.write("python_version="+str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2])+"\n")
857    else:
858        buildvars.write("python="+env['pythoncmd']+"\n")
859        p=Popen([env['pythoncmd'], '-c', 'from __future__ import print_function;import sys;print(str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2]))'], stdout=PIPE)
860        verstring=p.stdout.readline().strip()
861        p.wait()
862        buildvars.write("python_version="+verstring+"\n")
863  buildvars.write("boost_inc_path="+boost_inc_path+"\n")  buildvars.write("boost_inc_path="+boost_inc_path+"\n")
864  buildvars.write("boost_lib_path="+boost_lib_path+"\n")  buildvars.write("boost_lib_path="+boost_lib_path+"\n")
865  buildvars.write("boost_version="+boostversion+"\n")  buildvars.write("boost_version="+boostversion+"\n")
# Line 738  buildvars.write("mpi=%s\n"%env['mpi']) Line 869  buildvars.write("mpi=%s\n"%env['mpi'])
869  buildvars.write("mpi_inc_path=%s\n"%mpi_inc_path)  buildvars.write("mpi_inc_path=%s\n"%mpi_inc_path)
870  buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path)  buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path)
871  buildvars.write("lapack=%s\n"%env['lapack'])  buildvars.write("lapack=%s\n"%env['lapack'])
 buildvars.write("pyvisi=%d\n"%env['pyvisi'])  
872  buildvars.write("vsl_random=%d\n"%int(env['vsl_random']))  buildvars.write("vsl_random=%d\n"%int(env['vsl_random']))
873  for i in 'netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit':  for i in 'netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit':
874      buildvars.write("%s=%d\n"%(i, int(env[i])))      buildvars.write("%s=%d\n"%(i, int(env[i])))
# Line 749  buildvars.close() Line 879  buildvars.close()
879    
880  ################### Targets to build and install libraries ###################  ################### Targets to build and install libraries ###################
881    
882  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'))
883  env.Alias('target_init', [target_init])  env.Alias('target_init', [target_init])
884    # delete buildvars upon cleanup
885    env.Clean('target_init', os.path.join(env['libinstall'], 'buildvars'))
886    
887  # 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
888  # #include <paso/Common.h>  # #include <paso/Common.h>
# Line 763  env.Alias('install_paso', ['build_paso', Line 895  env.Alias('install_paso', ['build_paso',
895  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'])
896  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'])
897    
898    env.Alias('build_pasowrap', ['install_pasowrap_headers', 'build_pasowrap_lib', 'build_pasowrapcpp_lib'])
899    env.Alias('install_pasowrap', ['build_pasowrap', 'install_pasowrap_lib', 'install_pasowrapcpp_lib', 'install_pasowrap_py'])
900    
901  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'])
902  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'])
903    
904  env.Alias('build_finley', ['install_finley_headers', 'build_finley_lib', 'build_finleycpp_lib'])  env.Alias('build_finley', ['install_finley_headers', 'build_finley_lib', 'build_finleycpp_lib'])
905  env.Alias('install_finley', ['build_finley', 'install_finley_lib', 'install_finleycpp_lib', 'install_finley_py'])  env.Alias('install_finley', ['build_finley', 'install_finley_lib', 'install_finleycpp_lib', 'install_finley_py'])
906    
907    env.Alias('build_ripley', ['install_ripley_headers', 'build_ripley_lib', 'build_ripleycpp_lib'])
908    env.Alias('install_ripley', ['build_ripley', 'install_ripley_lib', 'install_ripleycpp_lib', 'install_ripley_py'])
909    
910  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'])
911  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'])
912    
# Line 780  build_all_list = [] Line 918  build_all_list = []
918  build_all_list += ['build_esysUtils']  build_all_list += ['build_esysUtils']
919  build_all_list += ['build_paso']  build_all_list += ['build_paso']
920  build_all_list += ['build_escript']  build_all_list += ['build_escript']
921    build_all_list += ['build_pasowrap']
922  build_all_list += ['build_dudley']  build_all_list += ['build_dudley']
923  build_all_list += ['build_finley']  build_all_list += ['build_finley']
924    build_all_list += ['build_ripley']
925  build_all_list += ['build_weipa']  build_all_list += ['build_weipa']
926  if not IS_WINDOWS: build_all_list += ['build_escriptreader']  if not IS_WINDOWS: build_all_list += ['build_escriptreader']
927  if env['usempi']:   build_all_list += ['build_pythonMPI']  if env['usempi']:   build_all_list += ['build_pythonMPI']
# Line 793  install_all_list += ['target_init'] Line 933  install_all_list += ['target_init']
933  install_all_list += ['install_esysUtils']  install_all_list += ['install_esysUtils']
934  install_all_list += ['install_paso']  install_all_list += ['install_paso']
935  install_all_list += ['install_escript']  install_all_list += ['install_escript']
936    install_all_list += ['install_pasowrap']
937  install_all_list += ['install_dudley']  install_all_list += ['install_dudley']
938  install_all_list += ['install_finley']  install_all_list += ['install_finley']
939    install_all_list += ['install_ripley']
940  install_all_list += ['install_weipa']  install_all_list += ['install_weipa']
941  if not IS_WINDOWS: install_all_list += ['install_escriptreader']  if not IS_WINDOWS: install_all_list += ['install_escriptreader']
942  install_all_list += ['install_pyvisi_py']  install_all_list += ['install_downunder_py']
943  install_all_list += ['install_modellib_py']  install_all_list += ['install_modellib_py']
944  install_all_list += ['install_pycad_py']  install_all_list += ['install_pycad_py']
945  if env['usempi']:   install_all_list += ['install_pythonMPI']  if env['usempi']:   install_all_list += ['install_pythonMPI']
# Line 809  env.Default('install_all') Line 951  env.Default('install_all')
951    
952  ################## Targets to build and run the test suite ###################  ################## Targets to build and run the test suite ###################
953    
954  env.Alias('build_cppunittest', ['install_cppunittest_headers', 'build_cppunittest_lib'])  if not env['cppunit']:
955  env.Alias('install_cppunittest', ['build_cppunittest', 'install_cppunittest_lib'])      test_msg = env.Command('.dummy.', None, '@echo "Cannot run C/C++ unit tests, CppUnit not found!";exit 1')
956  env.Alias('run_tests', ['install_all', 'install_cppunittest_lib'])      env.Alias('run_tests', test_msg)
957  env.Alias('all_tests', ['install_all', 'install_cppunittest_lib', 'run_tests', 'py_tests'])  env.Alias('run_tests', ['install_all'])
958    env.Alias('all_tests', ['install_all', 'run_tests', 'py_tests'])
959  env.Alias('build_full',['install_all','build_tests','build_py_tests'])  env.Alias('build_full',['install_all','build_tests','build_py_tests'])
960  env.Alias('build_PasoTests','$BUILD_DIR/$PLATFORM/paso/profiling/PasoTests')  env.Alias('build_PasoTests','$BUILD_DIR/$PLATFORM/paso/profiling/PasoTests')
961    
# Line 825  env.Alias('release_prep', ['docs', 'inst Line 968  env.Alias('release_prep', ['docs', 'inst
968  if not IS_WINDOWS:  if not IS_WINDOWS:
969      try:      try:
970          utest=open('utest.sh','w')          utest=open('utest.sh','w')
971          utest.write(GroupTest.makeHeader(env['PLATFORM']))          utest.write(GroupTest.makeHeader(env['PLATFORM'], prefix))
972          for tests in TestGroups:          for tests in TestGroups:
973              utest.write(tests.makeString())              utest.write(tests.makeString())
974          utest.close()          utest.close()
975          Execute(Chmod('utest.sh', 0755))          Execute(Chmod('utest.sh', 0o755))
976          print("Generated utest.sh.")          print("Generated utest.sh.")
977      except IOError:      except IOError:
978          print("Error attempting to write unittests file.")          print("Error attempting to write unittests file.")
979          Exit(1)          Exit(1)
980    
981        # delete utest.sh upon cleanup
982        env.Clean('target_init', 'utest.sh')
983    
984      # Make sure that the escript wrapper is in place      # Make sure that the escript wrapper is in place
985      if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):      if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):
986          print("Copying escript wrapper.")          print("Copying escript wrapper.")

Legend:
Removed from v.3585  
changed lines
  Added in v.3977

  ViewVC Help
Powered by ViewVC 1.1.26