/[escript]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 3942 by jfenwick, Fri Jul 27 01:04:48 2012 UTC revision 3977 by caltinay, Thu Sep 20 04:27:10 2012 UTC
# 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 132  vars.AddVariables( Line 131  vars.AddVariables(
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)',''),    ('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',''),    ('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 143  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 250  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 334  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 523  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 546  try: Line 552  try:
552  except:  except:
553      env['cppunit']=False      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    
565  netcdf_inc_path=''  netcdf_inc_path=''
# Line 691  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 745  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 805  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)  
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 925  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_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']

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

  ViewVC Help
Powered by ViewVC 1.1.26