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

Diff of /branches/inv2jf/SConstruct

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

revision 3896 by caltinay, Fri May 11 01:31:29 2012 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 *
 import subprocess  
19  from subprocess import PIPE, Popen  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
# Line 110  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 131  vars.AddVariables( Line 129  vars.AddVariables(
129    ('pythoncmd', 'which python to compile with','python'),    ('pythoncmd', 'which python to compile with','python'),
130    ('usepython3', 'Is this a python3 build? (experimental)', False),    ('usepython3', 'Is this a python3 build? (experimental)', False),
131    ('pythonlibname', 'Name of the python library to link. (This is found automatically for python2.X.)', ''),    ('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 142  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 249  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']:  if env['usepython3']:
268      env.Append(CPPDEFINES=['ESPYTHON3'])      env.Append(CPPDEFINES=['ESPYTHON3'])
269    
# Line 333  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 402  if conf.CheckFunc('gethostname'): Line 417  if conf.CheckFunc('gethostname'):
417    
418  ######## Python headers & library (required)  ######## Python headers & library (required)
419    
420    #First we check to see if the config file has specified
421    ##Where to find the filae. Ideally, this should be automatic
422    #But we need to deal with the case where python is not in its INSTALL
423    #Directory
424  # Use the python scons is running  # Use the python scons is running
425  if env['pythoncmd']=='python':  if env['pythoncmd']=='python':
426      python_inc_path=sysconfig.get_python_inc()      python_inc_path=sysconfig.get_python_inc()
# Line 457  else: Line 476  else:
476      p.wait()      p.wait()
477      python_lib_path=python_lib_path.strip()      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])
492  else:  else:
# Line 507  env.PrependENVPath(LD_LIBRARY_PATH_KEY, Line 537  env.PrependENVPath(LD_LIBRARY_PATH_KEY,
537    
538  ######## numpy (required)  ######## numpy (required)
539    
540  if env['pythoncmd']=='python':  if not detectModule(env, 'numpy'):
541      try:      print("Cannot import numpy. If it is installed try setting your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY)
542        from numpy import identity      Exit(1)
     except ImportError:  
       print("Cannot import numpy, you need to set your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY)  
       Exit(1)  
 else:  
     p=subprocess.call([env['pythoncmd'],'-c','import numpy'])  
     if p!=0:  
       print("Cannot import numpy, you need to set your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY)  
       Exit(1)  
543    
544  ######## CppUnit (required for tests)  ######## CppUnit (required for tests)
545    
# Line 530  try: Line 552  try:
552  except:  except:
553      env['cppunit']=False      env['cppunit']=False
554    
555  ######## VTK (optional)  ######## sympy (optional)
556    
557  if env['pyvisi']:  if detectModule(env, 'sympy'):
558      try:      env['sympy'] = True
559          import vtk  else:
560          env['pyvisi'] = True      print("Cannot import sympy. Symbolic toolbox and nonlinear PDEs will not be available.")
561      except ImportError:      env['sympy'] = False
         print("Cannot import vtk, disabling pyvisi.")  
         env['pyvisi'] = False  
562    
563  ######## netCDF (optional)  ######## netCDF (optional)
564    
# Line 685  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 739  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','vsl_random':  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:
# Line 799  env.SConscript(dirs = ['pasowrap/src'], Line 818  env.SConscript(dirs = ['pasowrap/src'],
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)  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    
# Line 850  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 921  install_all_list += ['install_finley'] Line 939  install_all_list += ['install_finley']
939  install_all_list += ['install_ripley']  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 933  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    
 test_msg = env.Command('.dummy.', None, '@echo "Cannot run C/C++ unit tests, CppUnit not found!";exit 1')  
954  if not env['cppunit']:  if not env['cppunit']:
955        test_msg = env.Command('.dummy.', None, '@echo "Cannot run C/C++ unit tests, CppUnit not found!";exit 1')
956      env.Alias('run_tests', test_msg)      env.Alias('run_tests', test_msg)
957  env.Alias('run_tests', ['install_all'])  env.Alias('run_tests', ['install_all'])
958  env.Alias('all_tests', ['install_all', 'run_tests', 'py_tests'])  env.Alias('all_tests', ['install_all', 'run_tests', 'py_tests'])

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

  ViewVC Help
Powered by ViewVC 1.1.26