/[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 3851 by jfenwick, Wed Feb 29 05:23:30 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 *
19    import subprocess
20    from subprocess import PIPE, Popen
21    
22  # 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
23  # added or existing options changed.  # added or existing options changed.
24  REQUIRED_OPTS_VERSION=200  REQUIRED_OPTS_VERSION=201
25    
26  # MS Windows support, many thanks to PH  # MS Windows support, many thanks to PH
27  IS_WINDOWS = (os.name == 'nt')  IS_WINDOWS = (os.name == 'nt')
# Line 47  if not os.path.isfile(options_file): Line 49  if not os.path.isfile(options_file):
49  ############################### Build options ################################  ############################### Build options ################################
50    
51  default_prefix='/usr'  default_prefix='/usr'
52  mpi_flavours=('none', 'MPT', 'MPICH', 'MPICH2', 'OPENMPI', 'INTELMPI')  mpi_flavours=('no', 'none', 'MPT', 'MPICH', 'MPICH2', 'OPENMPI', 'INTELMPI')
53  lapack_flavours=('none', 'clapack', 'mkl')  lapack_flavours=('none', 'clapack', 'mkl')
54    
55  vars = Variables(options_file, ARGUMENTS)  vars = Variables(options_file, ARGUMENTS)
56  vars.AddVariables(  vars.AddVariables(
57    PathVariable('options_file', 'Path to options file', options_file, PathVariable.PathIsFile),    PathVariable('options_file', 'Path to options file', options_file, PathVariable.PathIsFile),
58    PathVariable('prefix', 'Installation prefix', Dir('#.').abspath, PathVariable.PathIsDirCreate),    PathVariable('prefix', 'Installation prefix', Dir('#.').abspath, PathVariable.PathIsDirCreate),
59      PathVariable('build_dir', 'Top-level build directory', Dir('#/build').abspath, PathVariable.PathIsDirCreate),
60    BoolVariable('verbose', 'Output full compile/link lines', False),    BoolVariable('verbose', 'Output full compile/link lines', False),
61  # Compiler/Linker options  # Compiler/Linker options
62    ('cc', 'Path to C compiler', 'default'),    ('cc', 'Path to C compiler', 'default'),
# Line 71  vars.AddVariables( Line 74  vars.AddVariables(
74    ('omp_ldflags', 'OpenMP linker flags', 'default'),    ('omp_ldflags', 'OpenMP linker flags', 'default'),
75  # Mandatory libraries  # Mandatory libraries
76    ('boost_prefix', 'Prefix/Paths of boost installation', default_prefix),    ('boost_prefix', 'Prefix/Paths of boost installation', default_prefix),
77    ('boost_libs', 'Boost libraries to link with', ['boost_python']),    ('boost_libs', 'Boost libraries to link with', ['boost_python-mt']),
78    # Mandatory for tests
79      ('cppunit_prefix', 'Prefix/Paths of CppUnit installation', default_prefix),
80      ('cppunit_libs', 'CppUnit libraries to link with', ['cppunit']),
81  # Optional libraries and options  # Optional libraries and options
82    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),
83    ('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix),    ('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix),
# Line 92  vars.AddVariables( Line 98  vars.AddVariables(
98    BoolVariable('umfpack', 'Enable UMFPACK', False),    BoolVariable('umfpack', 'Enable UMFPACK', False),
99    ('umfpack_prefix', 'Prefix/Paths to UMFPACK installation', default_prefix),    ('umfpack_prefix', 'Prefix/Paths to UMFPACK installation', default_prefix),
100    ('umfpack_libs', 'UMFPACK libraries to link with', ['umfpack']),    ('umfpack_libs', 'UMFPACK libraries to link with', ['umfpack']),
101      BoolVariable('boomeramg', 'Enable BoomerAMG', False),
102      ('boomeramg_prefix', 'Prefix/Paths to BoomerAMG installation', default_prefix),
103      ('boomeramg_libs', 'BoomerAMG libraries to link with', ['boomeramg']),
104    EnumVariable('lapack', 'Set LAPACK flavour', 'none', allowed_values=lapack_flavours),    EnumVariable('lapack', 'Set LAPACK flavour', 'none', allowed_values=lapack_flavours),
105    ('lapack_prefix', 'Prefix/Paths to LAPACK installation', default_prefix),    ('lapack_prefix', 'Prefix/Paths to LAPACK installation', default_prefix),
106    ('lapack_libs', 'LAPACK libraries to link with', []),    ('lapack_libs', 'LAPACK libraries to link with', []),
# Line 102  vars.AddVariables( Line 111  vars.AddVariables(
111    ('visit_prefix', 'Prefix/Paths to VisIt installation', default_prefix),    ('visit_prefix', 'Prefix/Paths to VisIt installation', default_prefix),
112    ('visit_libs', 'VisIt libraries to link with', ['simV2']),    ('visit_libs', 'VisIt libraries to link with', ['simV2']),
113    BoolVariable('pyvisi', 'Enable pyvisi (deprecated, requires VTK module)', False),    BoolVariable('pyvisi', 'Enable pyvisi (deprecated, requires VTK module)', False),
114      BoolVariable('vsl_random', 'Use VSL from intel for random data', False),
115  # Advanced settings  # Advanced settings
116    #dudley_assemble_flags = -funroll-loops      to actually do something    #dudley_assemble_flags = -funroll-loops      to actually do something
117    ('dudley_assemble_flags', 'compiler flags for some dudley optimisations', ''),    ('dudley_assemble_flags', 'compiler flags for some dudley optimisations', ''),
# Line 114  vars.AddVariables( Line 124  vars.AddVariables(
124    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')),
125    # finer control over library building, intel aggressive global optimisation    # finer control over library building, intel aggressive global optimisation
126    # works with dynamic libraries on windows.    # works with dynamic libraries on windows.
127    ('share_esysutils', 'Build a dynamic esysUtils library', False),    ('build_shared', 'Build dynamic libraries only', False),
   ('share_paso', 'Build a dynamic paso library', False),  
128    ('sys_libs', 'Extra libraries to link with', []),    ('sys_libs', 'Extra libraries to link with', []),
129    ('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)'),
130      ('SVN_VERSION', 'Do not use from options file', -2),
131      ('pythoncmd', 'which python to compile with','python'),
132  )  )
133    
134  ##################### Create environment and help text #######################  ##################### Create environment and help text #######################
# Line 125  vars.AddVariables( Line 136  vars.AddVariables(
136  # Intel's compiler uses regular expressions improperly and emits a warning  # Intel's compiler uses regular expressions improperly and emits a warning
137  # about failing to find the compilers. This warning can be safely ignored.  # about failing to find the compilers. This warning can be safely ignored.
138    
139  env = Environment(tools = ['default'], options = vars)  # PATH is needed so the compiler, linker and tools are found if they are not
140    # in default locations.
141    env = Environment(tools = ['default'], options = vars,
142                      ENV = {'PATH': os.environ['PATH']})
143  if env['tools_names'] != 'default':  if env['tools_names'] != 'default':
144      env = Environment(tools = ['default'] + env['tools_names'], options = vars)      env = Environment(tools = ['default'] + env['tools_names'], options = vars,
145                          ENV = {'PATH' : os.environ['PATH']})
146    
147  if options_file:  if options_file:
148      opts_valid=False      opts_valid=False
# Line 146  if options_file: Line 161  if options_file:
161  Help(vars.GenerateHelpText(env))  Help(vars.GenerateHelpText(env))
162    
163  # Check for superfluous options  # Check for superfluous options
164  for k in vars.UnknownVariables():  if len(vars.UnknownVariables())>0:
165      print("WARNING: Ignoring unknown option '%s'" % k)      for k in vars.UnknownVariables():
166            print("Unknown option '%s'" % k)
167        Exit(1)
168    
169  #################### Make sure install directories exist #####################  #################### Make sure install directories exist #####################
170    
171    env['BUILD_DIR']=env['build_dir']
172  prefix=Dir(env['prefix']).abspath  prefix=Dir(env['prefix']).abspath
173  env['incinstall'] = os.path.join(prefix, 'include')  env['incinstall'] = os.path.join(prefix, 'include')
174  env['bininstall'] = os.path.join(prefix, 'bin')  env['bininstall'] = os.path.join(prefix, 'bin')
# Line 194  if cc_name == 'icc': Line 212  if cc_name == 'icc':
212      cc_optim    = "-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias -ip"      cc_optim    = "-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias -ip"
213      cc_debug    = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"      cc_debug    = "-g -O0 -DDOASSERT -DDOPROF -DBOUNDS_CHECK"
214      omp_flags   = "-openmp -openmp_report0"      omp_flags   = "-openmp -openmp_report0"
215      omp_ldflags = "-openmp -openmp_report0 -lguide -lpthread"      omp_ldflags = "-openmp -openmp_report0 -lpthread"
216      fatalwarning = "-Werror"      fatalwarning = "-Werror"
217  elif cc_name[:3] == 'gcc':  elif cc_name[:3] == 'gcc':
218      # GNU C on any system      # GNU C on any system
# Line 269  env.Append(CCFLAGS = env['cc_flags']) Line 287  env.Append(CCFLAGS = env['cc_flags'])
287  # add system libraries  # add system libraries
288  env.AppendUnique(LIBS = env['sys_libs'])  env.AppendUnique(LIBS = env['sys_libs'])
289    
290  # Get the global Subversion revision number for the getVersion() method  
291  try:  global_revision=ARGUMENTS.get('SVN_VERSION', None)
292    if global_revision:
293        global_revision = re.sub(':.*', '', global_revision)
294        global_revision = re.sub('[^0-9]', '', global_revision)
295        if global_revision == '': global_revision='-2'
296    else:
297      # Get the global Subversion revision number for the getVersion() method
298      try:
299      global_revision = os.popen('svnversion -n .').read()      global_revision = os.popen('svnversion -n .').read()
300      global_revision = re.sub(':.*', '', global_revision)      global_revision = re.sub(':.*', '', global_revision)
301      global_revision = re.sub('[^0-9]', '', global_revision)      global_revision = re.sub('[^0-9]', '', global_revision)
302      if global_revision == '': global_revision='-2'      if global_revision == '': global_revision='-2'
303  except:    except:
304      global_revision = '-1'      global_revision = '-1'
305    env['svn_revision']=global_revision
306  env.Append(CPPDEFINES=['SVN_VERSION='+global_revision])  env.Append(CPPDEFINES=['SVN_VERSION='+global_revision])
307    
308  if IS_WINDOWS:  if IS_WINDOWS:
309      if not env['share_esysutils']:      if not env['build_shared']:
310          env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])          env.Append(CPPDEFINES = ['ESYSUTILS_STATIC_LIB'])
     if not env['share_paso']:  
311          env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])          env.Append(CPPDEFINES = ['PASO_STATIC_LIB'])
312    
313  ###################### Copy required environment vars ########################  ###################### Copy required environment vars ########################
# Line 294  if IS_WINDOWS: Line 319  if IS_WINDOWS:
319  else:  else:
320      LD_LIBRARY_PATH_KEY='LD_LIBRARY_PATH'      LD_LIBRARY_PATH_KEY='LD_LIBRARY_PATH'
321    
322  # 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.  
323    
324  for key in 'OMP_NUM_THREADS', 'ESCRIPT_NUM_PROCS', 'ESCRIPT_NUM_NODES':  for key in 'OMP_NUM_THREADS', 'ESCRIPT_NUM_PROCS', 'ESCRIPT_NUM_NODES':
325      try:      try:
# Line 304  for key in 'OMP_NUM_THREADS', 'ESCRIPT_N Line 328  for key in 'OMP_NUM_THREADS', 'ESCRIPT_N
328          env['ENV'][key] = 1          env['ENV'][key] = 1
329    
330  env_export=env['env_export']  env_export=env['env_export']
331  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'])
332    
333  for key in set(env_export):  for key in set(env_export):
334      try:      try:
# Line 331  except KeyError: Line 355  except KeyError:
355    
356  ######################## Add some custom builders ############################  ######################## Add some custom builders ############################
357    
358  py_builder = Builder(action = build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)  if env['pythoncmd']=='python':
359        py_builder = Builder(action = build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
360    else:
361        py_builder = Builder(action = "scripts/testcomp.py $SOURCE $TARGET", suffix = '.pyc', src_suffix = '.py', single_source=True)
362  env.Append(BUILDERS = {'PyCompile' : py_builder});  env.Append(BUILDERS = {'PyCompile' : py_builder});
363    
364  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 373  if conf.CheckFunc('gethostname'): Line 400  if conf.CheckFunc('gethostname'):
400  python_inc_path=sysconfig.get_python_inc()  python_inc_path=sysconfig.get_python_inc()
401  if IS_WINDOWS:  if IS_WINDOWS:
402      python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs')      python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs')
403    elif env['PLATFORM']=='darwin':
404        python_lib_path=sysconfig.get_config_var('LIBPL')
405  else:  else:
406      python_lib_path=sysconfig.get_config_var('LIBDIR')      python_lib_path=sysconfig.get_config_var('LIBDIR')
407  #python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux  #python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux
# Line 381  if IS_WINDOWS: Line 410  if IS_WINDOWS:
410  else:  else:
411      python_libs=['python'+sysconfig.get_python_version()]      python_libs=['python'+sysconfig.get_python_version()]
412    
413    #if we want to use a python other than the one scons is running
414    if env['pythoncmd']!='python':
415       py3scons=False   # Is scons running on python3?
416       initstring='from __future__ import print_function;from distutils import sysconfig;'
417       if IS_WINDOWS:
418          cmd='print("python%s%s"%(sys.version_info[0], sys.version_info[1]))'
419       else:
420          cmd='print("python"+sysconfig.get_python_version())'
421       p=Popen([env['pythoncmd'], '-c', initstring+cmd], stdout=PIPE)
422       python_libs=p.stdout.readline()
423       if type(python_libs)!=str():
424          py3scons=True
425          python_libs=python_libs.encode()
426       p.wait()
427       python_libs=python_libs.strip()
428       # Now we know whether we are using python3 or not
429       p=Popen([env['pythoncmd'], '-c',  initstring+'print(sysconfig.get_python_inc())'], stdout=PIPE)
430       python_inc_path=p.stdout.readline()
431       if py3scons:
432             python_inc_path=python_inc_path.encode()
433       p.wait()  
434       python_inc_path=python_inc_path.strip()
435       if IS_WINDOWS:
436            cmd="os.path.join(sysconfig.get_config_var('prefix'), 'libs')"
437       elif env['PLATFORM']=='darwin':
438            cmd="sysconfig.get_config_var(\"LIBPL\")"
439       else:
440            cmd="sysconfig.get_config_var(\"LIBDIR\")"
441    
442       p=Popen([env['pythoncmd'], '-c', initstring+'print('+cmd+')'], stdout=PIPE)
443       python_lib_path=p.stdout.readline()
444       if py3scons:
445          python_lib_path=python_lib_path.decode()
446       p.wait()
447       python_lib_path=python_lib_path.strip()
448    
449    
450    
451    
452  if sysheaderopt == '':  if sysheaderopt == '':
453      conf.env.AppendUnique(CPPPATH = [python_inc_path])      conf.env.AppendUnique(CPPPATH = [python_inc_path])
454  else:  else:
# Line 398  if not conf.CheckFunc('Py_Exit'): Line 466  if not conf.CheckFunc('Py_Exit'):
466      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))
467      Exit(1)      Exit(1)
468    
469    # reuse conf to check for numpy header (optional)
470    if conf.CheckCXXHeader(['Python.h','numpy/ndarrayobject.h']):
471        conf.env.Append(CPPDEFINES = ['HAVE_NUMPY_H'])
472        conf.env['numpy_h']=True
473    else:
474        conf.env['numpy_h']=False
475    
476  # Commit changes to environment  # Commit changes to environment
477  env = conf.Finish()  env = conf.Finish()
478    
# Line 420  env.PrependENVPath(LD_LIBRARY_PATH_KEY, Line 495  env.PrependENVPath(LD_LIBRARY_PATH_KEY,
495    
496  ######## numpy (required)  ######## numpy (required)
497    
498    if env['pythoncmd']=='python':
499        try:
500          from numpy import identity
501        except ImportError:
502          print("Cannot import numpy, you need to set your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY)
503          Exit(1)
504    else:
505        p=subprocess.call([env['pythoncmd'],'-c','import numpy'])
506        if p!=0:
507          print("Cannot import numpy, you need to set your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY)
508          Exit(1)
509    
510    ######## CppUnit (required for tests)
511    
512  try:  try:
513      from numpy import identity      cppunit_inc_path,cppunit_lib_path=findLibWithHeader(env, env['cppunit_libs'], 'cppunit/TestFixture.h', env['cppunit_prefix'], lang='c++')
514  except ImportError:      env.AppendUnique(CPPPATH = [cppunit_inc_path])
515      print("Cannot import numpy, you need to set your PYTHONPATH and probably %s"%LD_LIBRARY_PATH_KEY)      env.AppendUnique(LIBPATH = [cppunit_lib_path])
516      Exit(1)      env.PrependENVPath(LD_LIBRARY_PATH_KEY, cppunit_lib_path)
517        env['cppunit']=True
518    except:
519        env['cppunit']=False
520    
521  ######## VTK (optional)  ######## VTK (optional)
522    
# Line 516  if env['silo']: Line 608  if env['silo']:
608      # weipa library and tools.      # weipa library and tools.
609      #env.AppendUnique(LIBS = [env['silo_libs']])      #env.AppendUnique(LIBS = [env['silo_libs']])
610    
611    ######## VSL random numbers (optional)
612    if env['vsl_random']:
613        env.Append(CPPDEFINES = ['MKLRANDOM'])
614    
615  ######## VisIt (optional)  ######## VisIt (optional)
616    
617  visit_inc_path=''  visit_inc_path=''
# Line 527  if env['visit']: Line 623  if env['visit']:
623    
624  ######## MPI (optional)  ######## MPI (optional)
625    
626    if env['mpi']=='no':
627        env['mpi']='none'
628    
629  env['usempi'] = env['mpi']!='none'  env['usempi'] = env['mpi']!='none'
630  mpi_inc_path=''  mpi_inc_path=''
631  mpi_lib_path=''  mpi_lib_path=''
# Line 543  if env['usempi']: Line 642  if env['usempi']:
642      if env['netcdf'] and env['mpi'] in ['MPT','OPENMPI']:      if env['netcdf'] and env['mpi'] in ['MPT','OPENMPI']:
643          env.Append(CPPDEFINES = ['MPI_INCLUDED'])          env.Append(CPPDEFINES = ['MPI_INCLUDED'])
644    
645    ######## BOOMERAMG (optional)
646    
647    if env['mpi'] == 'none': env['boomeramg'] = False
648    
649    boomeramg_inc_path=''
650    boomeramg_lib_path=''
651    if env['boomeramg']:
652        boomeramg_inc_path,boomeramg_lib_path=findLibWithHeader(env, env['boomeramg_libs'], 'HYPRE.h', env['boomeramg_prefix'], lang='c')
653        env.AppendUnique(CPPPATH = [boomeramg_inc_path])
654        env.AppendUnique(LIBPATH = [boomeramg_lib_path])
655        env.AppendUnique(LIBS = env['boomeramg_libs'])
656        env.PrependENVPath(LD_LIBRARY_PATH_KEY, boomeramg_lib_path)
657        env.Append(CPPDEFINES = ['BOOMERAMG'])
658    
659  ######## ParMETIS (optional)  ######## ParMETIS (optional)
660    
661  if not env['usempi']: env['parmetis'] = False  if not env['usempi']: env['parmetis'] = False
# Line 557  if env['parmetis']: Line 670  if env['parmetis']:
670      env.PrependENVPath(LD_LIBRARY_PATH_KEY, parmetis_lib_path)      env.PrependENVPath(LD_LIBRARY_PATH_KEY, parmetis_lib_path)
671      env.Append(CPPDEFINES = ['USE_PARMETIS'])      env.Append(CPPDEFINES = ['USE_PARMETIS'])
672    
673    ######## gmsh (optional, for tests)
674    
675    try:
676        import subprocess
677        p=subprocess.Popen(['gmsh', '-info'], stderr=subprocess.PIPE)
678        _,e=p.communicate()
679        if e.split().count("MPI"):
680            env['gmsh']='m'
681        else:
682            env['gmsh']='s'
683    except OSError:
684        env['gmsh']=False
685    
686    ######## PDFLaTeX (for documentation)
687    if 'PDF' in dir(env) and '.tex' in env.PDF.builder.src_suffixes(env):
688        env['pdflatex']=True
689    else:
690        env['pdflatex']=False
691    
692  ######################## Summarize our environment ###########################  ######################## Summarize our environment ###########################
693    
694  # 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 704  if not env['verbose']:
704      env['ARCOMSTR'] = "Linking $TARGET"      env['ARCOMSTR'] = "Linking $TARGET"
705      env['LINKCOMSTR'] = "Linking $TARGET"      env['LINKCOMSTR'] = "Linking $TARGET"
706      env['SHLINKCOMSTR'] = "Linking $TARGET"      env['SHLINKCOMSTR'] = "Linking $TARGET"
707        env['PDFLATEXCOMSTR'] = "Building $TARGET from LaTeX input $SOURCES"
708        env['BIBTEXCOMSTR'] = "Generating bibliography $TARGET"
709        env['MAKEINDEXCOMSTR'] = "Generating index $TARGET"
710        env['PDFLATEXCOMSTR'] = "Building $TARGET from LaTeX input $SOURCES"
711      #Progress(['Checking -\r', 'Checking \\\r', 'Checking |\r', 'Checking /\r'], interval=17)      #Progress(['Checking -\r', 'Checking \\\r', 'Checking |\r', 'Checking /\r'], interval=17)
712    
713  print("")  print("")
# Line 591  else: Line 727  else:
727      print("          LAPACK:  DISABLED")      print("          LAPACK:  DISABLED")
728  d_list=[]  d_list=[]
729  e_list=[]  e_list=[]
730  for i in 'debug','openmp','netcdf','parmetis','papi','mkl','umfpack','silo','visit','pyvisi':  for i in 'debug','openmp','netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit','vsl_random':
731      if env[i]: e_list.append(i)      if env[i]: e_list.append(i)
732      else: d_list.append(i)      else: d_list.append(i)
733  for i in e_list:  for i in e_list:
734      print("%16s:  YES"%i)      print("%16s:  YES"%i)
735  for i in d_list:  for i in d_list:
736      print("%16s:  DISABLED"%i)      print("%16s:  DISABLED"%i)
737    if env['cppunit']:
738        print("         CppUnit:  FOUND")
739    else:
740        print("         CppUnit:  NOT FOUND")
741    if env['gmsh']=='m':
742        print("            gmsh:  FOUND, MPI-ENABLED")
743    elif env['gmsh']=='s':
744        print("            gmsh:  FOUND")
745    else:
746        print("            gmsh:  NOT FOUND")
747    if env['numpy_h']:
748        print("   numpy headers:  FOUND")
749    else:
750        print("   numpy headers:  NOT FOUND")
751    print("   vsl_random:  %s"%env['vsl_random'])
752        
753  if ((fatalwarning != '') and (env['werror'])):  if ((fatalwarning != '') and (env['werror'])):
754      print("  Treating warnings as errors")      print("  Treating warnings as errors")
755  else:  else:
# Line 626  Export( Line 778  Export(
778    ]    ]
779  )  )
780    
781  env.SConscript(dirs = ['tools/CppUnitTest/src'], variant_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)  env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='$BUILD_DIR/$PLATFORM/tools/escriptconvert', duplicate=0)
782  env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='build/$PLATFORM/tools/escriptconvert', duplicate=0)  env.SConscript(dirs = ['paso/src'], variant_dir='$BUILD_DIR/$PLATFORM/paso', duplicate=0)
783  env.SConscript(dirs = ['paso/src'], variant_dir='build/$PLATFORM/paso', duplicate=0)  env.SConscript(dirs = ['weipa/src'], variant_dir='$BUILD_DIR/$PLATFORM/weipa', duplicate=0)
784  env.SConscript(dirs = ['weipa/src'], variant_dir='build/$PLATFORM/weipa', duplicate=0)  env.SConscript(dirs = ['escript/src'], variant_dir='$BUILD_DIR/$PLATFORM/escript', duplicate=0)
785  env.SConscript(dirs = ['escript/src'], variant_dir='build/$PLATFORM/escript', duplicate=0)  env.SConscript(dirs = ['esysUtils/src'], variant_dir='$BUILD_DIR/$PLATFORM/esysUtils', duplicate=0)
786  env.SConscript(dirs = ['esysUtils/src'], variant_dir='build/$PLATFORM/esysUtils', duplicate=0)  env.SConscript(dirs = ['pasowrap/src'], variant_dir='$BUILD_DIR/$PLATFORM/pasowrap', duplicate=0)
787  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)
788  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)
789  env.SConscript(dirs = ['modellib/py_src'], variant_dir='build/$PLATFORM/modellib', duplicate=0)  env.SConscript(dirs = ['ripley/src'], variant_dir='$BUILD_DIR/$PLATFORM/ripley', duplicate=0)
790  env.SConscript(dirs = ['doc'], variant_dir='build/$PLATFORM/doc', duplicate=0)  env.SConscript(dirs = ['modellib/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/modellib', duplicate=0)
791  env.SConscript(dirs = ['pyvisi/py_src'], variant_dir='build/$PLATFORM/pyvisi', duplicate=0)  env.SConscript(dirs = ['doc'], variant_dir='$BUILD_DIR/$PLATFORM/doc', duplicate=0)
792  env.SConscript(dirs = ['pycad/py_src'], variant_dir='build/$PLATFORM/pycad', duplicate=0)  env.SConscript(dirs = ['pyvisi/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pyvisi', duplicate=0)
793  env.SConscript(dirs = ['pythonMPI/src'], variant_dir='build/$PLATFORM/pythonMPI', duplicate=0)  env.SConscript(dirs = ['pycad/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pycad', duplicate=0)
794  env.SConscript(dirs = ['paso/profiling'], variant_dir='build/$PLATFORM/paso/profiling', duplicate=0)  env.SConscript(dirs = ['pythonMPI/src'], variant_dir='$BUILD_DIR/$PLATFORM/pythonMPI', duplicate=0)
795    env.SConscript(dirs = ['paso/profiling'], variant_dir='$BUILD_DIR/$PLATFORM/paso/profiling', duplicate=0)
796    
797  ######################## Populate the buildvars file #########################  ######################## Populate the buildvars file #########################
798    
# Line 665  buildvars.write("svn_revision="+str(glob Line 818  buildvars.write("svn_revision="+str(glob
818  buildvars.write("prefix="+prefix+"\n")  buildvars.write("prefix="+prefix+"\n")
819  buildvars.write("cc="+env['CC']+"\n")  buildvars.write("cc="+env['CC']+"\n")
820  buildvars.write("cxx="+env['CXX']+"\n")  buildvars.write("cxx="+env['CXX']+"\n")
821  buildvars.write("python="+sys.executable+"\n")  if env['pythoncmd']=='python':
822  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")
823        buildvars.write("python_version="+str(sys.version_info[0])+"."+str(sys.version_info[1])+"."+str(sys.version_info[2])+"\n")
824    else:
825        buildvars.write("python="+env['pythoncmd']+"\n")
826        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)
827        verstring=p.stdout.readline().strip()
828        p.wait()
829        buildvars.write("python version="+verstring+"\n")
830  buildvars.write("boost_inc_path="+boost_inc_path+"\n")  buildvars.write("boost_inc_path="+boost_inc_path+"\n")
831  buildvars.write("boost_lib_path="+boost_lib_path+"\n")  buildvars.write("boost_lib_path="+boost_lib_path+"\n")
832  buildvars.write("boost_version="+boostversion+"\n")  buildvars.write("boost_version="+boostversion+"\n")
# Line 677  buildvars.write("mpi_inc_path=%s\n"%mpi_ Line 837  buildvars.write("mpi_inc_path=%s\n"%mpi_
837  buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path)  buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path)
838  buildvars.write("lapack=%s\n"%env['lapack'])  buildvars.write("lapack=%s\n"%env['lapack'])
839  buildvars.write("pyvisi=%d\n"%env['pyvisi'])  buildvars.write("pyvisi=%d\n"%env['pyvisi'])
840  for i in 'netcdf','parmetis','papi','mkl','umfpack','silo','visit':  buildvars.write("vsl_random=%d\n"%int(env['vsl_random']))
841    for i in 'netcdf','parmetis','papi','mkl','umfpack','boomeramg','silo','visit':
842      buildvars.write("%s=%d\n"%(i, int(env[i])))      buildvars.write("%s=%d\n"%(i, int(env[i])))
843      if env[i]:      if env[i]:
844          buildvars.write("%s_inc_path=%s\n"%(i, eval(i+'_inc_path')))          buildvars.write("%s_inc_path=%s\n"%(i, eval(i+'_inc_path')))
# Line 686  buildvars.close() Line 847  buildvars.close()
847    
848  ################### Targets to build and install libraries ###################  ################### Targets to build and install libraries ###################
849    
850  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'))
851  env.Alias('target_init', [target_init])  env.Alias('target_init', [target_init])
852    # delete buildvars upon cleanup
853    env.Clean('target_init', os.path.join(env['libinstall'], 'buildvars'))
854    
855  # 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
856  # #include <paso/Common.h>  # #include <paso/Common.h>
# Line 700  env.Alias('install_paso', ['build_paso', Line 863  env.Alias('install_paso', ['build_paso',
863  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'])
864  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'])
865    
866    env.Alias('build_pasowrap', ['install_pasowrap_headers', 'build_pasowrap_lib', 'build_pasowrapcpp_lib'])
867    env.Alias('install_pasowrap', ['build_pasowrap', 'install_pasowrap_lib', 'install_pasowrapcpp_lib', 'install_pasowrap_py'])
868    
869    
870  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'])
871  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'])
872    
873  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'])
874  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'])
875    
876    env.Alias('build_ripley', ['install_ripley_headers', 'build_ripley_lib', 'build_ripleycpp_lib'])
877    env.Alias('install_ripley', ['build_ripley', 'install_ripley_lib', 'install_ripleycpp_lib', 'install_ripley_py'])
878    
879  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'])
880  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'])
881    
# Line 717  build_all_list = [] Line 887  build_all_list = []
887  build_all_list += ['build_esysUtils']  build_all_list += ['build_esysUtils']
888  build_all_list += ['build_paso']  build_all_list += ['build_paso']
889  build_all_list += ['build_escript']  build_all_list += ['build_escript']
890    build_all_list += ['build_pasowrap']
891  build_all_list += ['build_dudley']  build_all_list += ['build_dudley']
892  build_all_list += ['build_finley']  build_all_list += ['build_finley']
893    build_all_list += ['build_ripley']
894  build_all_list += ['build_weipa']  build_all_list += ['build_weipa']
895  if not IS_WINDOWS: build_all_list += ['build_escriptreader']  if not IS_WINDOWS: build_all_list += ['build_escriptreader']
896  if env['usempi']:   build_all_list += ['build_pythonMPI']  if env['usempi']:   build_all_list += ['build_pythonMPI']
# Line 730  install_all_list += ['target_init'] Line 902  install_all_list += ['target_init']
902  install_all_list += ['install_esysUtils']  install_all_list += ['install_esysUtils']
903  install_all_list += ['install_paso']  install_all_list += ['install_paso']
904  install_all_list += ['install_escript']  install_all_list += ['install_escript']
905    install_all_list += ['install_pasowrap']
906  install_all_list += ['install_dudley']  install_all_list += ['install_dudley']
907  install_all_list += ['install_finley']  install_all_list += ['install_finley']
908    install_all_list += ['install_ripley']
909  install_all_list += ['install_weipa']  install_all_list += ['install_weipa']
910  if not IS_WINDOWS: install_all_list += ['install_escriptreader']  if not IS_WINDOWS: install_all_list += ['install_escriptreader']
911  install_all_list += ['install_pyvisi_py']  #install_all_list += ['install_pyvisi_py']
912  install_all_list += ['install_modellib_py']  install_all_list += ['install_modellib_py']
913  install_all_list += ['install_pycad_py']  install_all_list += ['install_pycad_py']
914  if env['usempi']:   install_all_list += ['install_pythonMPI']  if env['usempi']:   install_all_list += ['install_pythonMPI']
# Line 746  env.Default('install_all') Line 920  env.Default('install_all')
920    
921  ################## Targets to build and run the test suite ###################  ################## Targets to build and run the test suite ###################
922    
923  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')
924  env.Alias('install_cppunittest', ['build_cppunittest', 'install_cppunittest_lib'])  if not env['cppunit']:
925  env.Alias('run_tests', ['install_all', 'install_cppunittest_lib'])      env.Alias('run_tests', test_msg)
926  env.Alias('all_tests', ['install_all', 'install_cppunittest_lib', 'run_tests', 'py_tests'])  env.Alias('run_tests', ['install_all'])
927    env.Alias('all_tests', ['install_all', 'run_tests', 'py_tests'])
928  env.Alias('build_full',['install_all','build_tests','build_py_tests'])  env.Alias('build_full',['install_all','build_tests','build_py_tests'])
929  env.Alias('build_PasoTests','build/$PLATFORM/paso/profiling/PasoTests')  env.Alias('build_PasoTests','$BUILD_DIR/$PLATFORM/paso/profiling/PasoTests')
930    
931  ##################### Targets to build the documentation #####################  ##################### Targets to build the documentation #####################
932    
933  env.Alias('api_epydoc','install_all')  env.Alias('api_epydoc','install_all')
934  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'])
935  env.Alias('release_prep', ['docs', 'install_all'])  env.Alias('release_prep', ['docs', 'install_all'])
936    
937  if not IS_WINDOWS:  if not IS_WINDOWS:
938      try:      try:
939          utest=open('utest.sh','w')          utest=open('utest.sh','w')
940          utest.write(GroupTest.makeHeader(env['PLATFORM']))          utest.write(GroupTest.makeHeader(env['PLATFORM'], prefix))
941          for tests in TestGroups:          for tests in TestGroups:
942              utest.write(tests.makeString())              utest.write(tests.makeString())
943          utest.close()          utest.close()
944          Execute(Chmod('utest.sh', 0755))          Execute(Chmod('utest.sh', 0o755))
945          print("Generated utest.sh.")          print("Generated utest.sh.")
946      except IOError:      except IOError:
947          print("Error attempting to write unittests file.")          print("Error attempting to write unittests file.")
948          Exit(1)          Exit(1)
949    
950        # delete utest.sh upon cleanup
951        env.Clean('target_init', 'utest.sh')
952    
953      # Make sure that the escript wrapper is in place      # Make sure that the escript wrapper is in place
954      if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):      if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):
955          print("Copying escript wrapper.")          print("Copying escript wrapper.")
956          Execute(Copy(os.path.join(env['bininstall'],'escript'), 'bin/run-escript'))          Execute(Copy(os.path.join(env['bininstall'],'run-escript'), 'bin/run-escript'))
957    

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

  ViewVC Help
Powered by ViewVC 1.1.26