/[escript]/temp/SConstruct
ViewVC logotype

Diff of /temp/SConstruct

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

revision 1243 by phornby, Mon Aug 13 06:48:37 2007 UTC revision 1360 by ksteube, Thu Dec 13 05:05:00 2007 UTC
# Line 15  EnsurePythonVersion(2,3) Line 15  EnsurePythonVersion(2,3)
15  #===============================================================  #===============================================================
16  #   import tools:  #   import tools:
17  import glob  import glob
18  import sys, os  import sys, os, re
 import socket  
19  # Add our extensions  # Add our extensions
20  if sys.path.count('scons')==0: sys.path.append('scons')  if sys.path.count('scons')==0: sys.path.append('scons')
21  import scons_extensions  import scons_extensions
# Line 50  dir_packages = os.path.join(source_root, Line 49  dir_packages = os.path.join(source_root,
49  dir_examples = os.path.join(source_root,"examples")  dir_examples = os.path.join(source_root,"examples")
50  dir_libraries = os.path.join(source_root,"lib")  dir_libraries = os.path.join(source_root,"lib")
51    
52    print "Source root is : ",source_root
53  print " Default packages local installation:    ", dir_packages  print " Default packages local installation:    ", dir_packages
54  print " Default library local installation  ", dir_libraries  print " Default library local installation  ", dir_libraries
55  print " Default example local  installation:    ", dir_examples  print " Default example local  installation:    ", dir_examples
# Line 69  print "    Default example system installat Line 69  print "    Default example system installat
69  #      #    
70  #    get the options file if present:  #    get the options file if present:
71  #  #
72  if ARGUMENTS.get('options_file',0):  options_file = ARGUMENTS.get('options_file','')
73     options_file = ARGUMENTS.get('options_file',0)  
74  else:  if not os.path.isfile(options_file) :
75     from string import ascii_letters,digits      options_file = False
76     hostname=""  
77     for s in socket.gethostname().split('.')[0]:  if not options_file :
78        if s in ascii_letters+digits:     import socket
79           hostname+=s     hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])
80        else:     tmp = os.path.join("scons",hostname+"_options.py")
81           hostname+="_"  
82     options_file = os.path.join("scons",hostname+"_options.py")     if os.path.isfile(tmp) :
83            options_file = tmp
84  if os.path.isfile(options_file):  
85     print "option file is ",options_file,"."  IS_WINDOWS_PLATFORM = (os.name== "nt")
86  else:  
87     print "option file is ",options_file, "(not present)."  # If you're not going to tell me then......
88    # FIXME: add one for the altix too.
89    if not options_file :
90       if IS_WINDOWS_PLATFORM :
91          options_file = "scons/windows_mscv71_options.py"
92       else:
93          options_file = "scons/linux_gcc_eg_options.py"
94    
95  # and load it  # and load it
96  opts = Options(options_file, ARGUMENTS)  opts = Options(options_file, ARGUMENTS)
97  #================================================================  #================================================================
# Line 129  python_lib_default="python%s.%s"%(sys.ve Line 136  python_lib_default="python%s.%s"%(sys.ve
136  boost_path_default=os.path.join(tools_prefix,'include')  boost_path_default=os.path.join(tools_prefix,'include')
137  boost_lib_path_default=os.path.join(tools_prefix,'lib')  boost_lib_path_default=os.path.join(tools_prefix,'lib')
138  boost_lib_default=['boost_python']  boost_lib_default=['boost_python']
139    
140  #==========================================================================  #==========================================================================
141  #  #
142  #    check if netCDF is installed on the system:  #    check if netCDF is installed on the system:
143  #  #
144  netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3')  netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3')
145  netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3')  netCDF_lib_path_default=os.path.join(tools_prefix,'lib')
146    
147  if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default):  if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default):
148       useNetCDF_default='yes'       useNetCDF_default='yes'
# Line 147  else: Line 155  else:
155    
156  #==========================================================================  #==========================================================================
157  #  #
158    #  MPI:
159    #
160    if IS_WINDOWS_PLATFORM:
161       useMPI_default='no'
162       mpi_path_default=None
163       mpi_lib_path_default=None
164       mpi_libs_default=[]
165       mpi_run_default=None
166    else:
167       useMPI_default='no'
168       mpi_root='/usr/local'
169       mpi_path_default=os.path.join(mpi_root,'include')
170       mpi_lib_path_default=os.path.join(mpi_root,'lib')
171       mpi_libs_default=[ 'mpich' , 'pthread', 'rt' ]
172       mpi_run_default='mpiexec -np 1'
173    #
174    #==========================================================================
175    #
176  #    compile:  #    compile:
177  #  #
178  cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors'  cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi'
179  cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi -pedantic-errors'  cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi'
180  cxx_flags_default='--no-warn -ansi'  cxx_flags_default='--no-warn -ansi'
181  cxx_flags_debug_default='--no-warn -ansi -DDOASSERT'  cxx_flags_debug_default='--no-warn -ansi -DDOASSERT'
182    
183  #==============================================================================================      #==============================================================================================    
184  # Default options and options help text  # Default options and options help text
185  # These are defaults and can be overridden using command line arguments or an options file.  # These are defaults and can be overridden using command line arguments or an options file.
# Line 179  opts.AddOptions( Line 206  opts.AddOptions(
206    ('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"),    ('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"),
207  # Compilation options  # Compilation options
208    BoolOption('dodebug', 'Do you want a debug build?', 'no'),    BoolOption('dodebug', 'Do you want a debug build?', 'no'),
209      BoolOption('bounds_check', 'Do you want extra array bounds checking?', 'no'),
210    ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/<hostname>_options.py)", options_file),    ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/<hostname>_options.py)", options_file),
211    ('cc_defines','C/C++ defines to use', None),    ('cc_defines','C/C++ defines to use', None),
212    ('cc_flags','C compiler flags to use (Release build)', cc_flags_default),    ('cc_flags','C compiler flags to use (Release build)', cc_flags_default),
213    ('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default),    ('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default),
214    ('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default),    ('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default),
215    ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', cxx_flags_debug_default),    ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', cxx_flags_debug_default),
216      ('omp_flags', 'OpenMP compiler flags to use (Release build)', ''),
217      ('omp_flags_debug', 'OpenMP compiler flags to use (Debug build)', ''),
218    ('ar_flags', 'Static library archiver flags to use', None),    ('ar_flags', 'Static library archiver flags to use', None),
219    ('sys_libs', 'System libraries to link with', None),    ('sys_libs', 'System libraries to link with', None),
220    ('tar_flags','flags for zip files','-c -z'),    ('tar_flags','flags for zip files','-c -z'),
# Line 206  opts.AddOptions( Line 236  opts.AddOptions(
236    PathOption('amd_path', 'Path to AMD includes', amd_path_default),    PathOption('amd_path', 'Path to AMD includes', amd_path_default),
237    PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default),    PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default),
238    ('amd_libs', 'AMD libraries to link with', amd_libs_default),    ('amd_libs', 'AMD libraries to link with', amd_libs_default),
239    # TRILINOS
240      PathOption('trilinos_path', 'Path to TRILINOS includes', None),
241      PathOption('trilinos_lib_path', 'Path to TRILINOS libs', None),
242      ('trilinos_libs', 'TRILINOS libraries to link with', None),
243  # BLAS  # BLAS
244    PathOption('blas_path', 'Path to BLAS includes', None),    PathOption('blas_path', 'Path to BLAS includes', None),
245    PathOption('blas_lib_path', 'Path to BLAS libs', None),    PathOption('blas_lib_path', 'Path to BLAS libs', None),
# Line 233  opts.AddOptions( Line 267  opts.AddOptions(
267    PathOption('papi_path', 'Path to PAPI includes', None),    PathOption('papi_path', 'Path to PAPI includes', None),
268    PathOption('papi_lib_path', 'Path to PAPI libs', None),    PathOption('papi_lib_path', 'Path to PAPI libs', None),
269    ('papi_libs', 'PAPI libraries to link with', None),    ('papi_libs', 'PAPI libraries to link with', None),
270      ('papi_instrument_solver', 'use PAPI in Solver.c to instrument each iteration of the solver', None),
271  # MPI  # MPI
272    BoolOption('useMPI', 'Compile parallel version using MPI', 'no'),    BoolOption('useMPI', 'Compile parallel version using MPI', useMPI_default),
273      ('MPICH_IGNORE_CXX_SEEK', 'name of macro to ignore MPI settings of C++ SEEK macro (for MPICH)' , 'MPICH_IGNORE_CXX_SEEK'),
274      PathOption('mpi_path', 'Path to MPI includes', mpi_path_default),
275      ('mpi_run', 'mpirun name' , mpi_run_default),
276      PathOption('mpi_lib_path', 'Path to MPI libs (needs to be added to the LD_LIBRARY_PATH)',mpi_lib_path_default),
277      ('mpi_libs', 'MPI libraries to link with (needs to be shared!)', mpi_libs_default)
278  )  )
279  #=================================================================================================  #=================================================================================================
280  #  #
# Line 246  opts.AddOptions( Line 286  opts.AddOptions(
286  #   This doesn't impact linux and windows which will use the default compiler (g++ or msvc, or the intel compiler if it is installed on both platforms)  #   This doesn't impact linux and windows which will use the default compiler (g++ or msvc, or the intel compiler if it is installed on both platforms)
287  #   FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix  #   FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix
288  #  #
 IS_WINDOWS_PLATFORM = (os.name== "nt")  
289    
290  if IS_WINDOWS_PLATFORM:  if IS_WINDOWS_PLATFORM:
291        env = Environment(tools = ['default', 'msvc'], options = opts)        env = Environment(tools = ['default', 'msvc'], options = opts)
# Line 259  else: Line 298  else:
298        env = Environment(tools = ['default'], options = opts)        env = Environment(tools = ['default'], options = opts)
299  Help(opts.GenerateHelpText(env))  Help(opts.GenerateHelpText(env))
300    
301    if env['bounds_check']:
302       env.Append(CPPDEFINES = [ 'BOUNDS_CHECK' ])
303       env.Append(CXXDEFINES = [ 'BOUNDS_CHECK' ])
304       bounds_check = env['bounds_check']
305    else:
306       bounds_check = 0
307    
308  #=================================================================================================  #=================================================================================================
309  #  #
310  #     Initialise Scons Build Environment  #     Initialise Scons Build Environment
# Line 275  try: Line 321  try:
321     omp_num_threads = os.environ['OMP_NUM_THREADS']     omp_num_threads = os.environ['OMP_NUM_THREADS']
322  except KeyError:  except KeyError:
323     omp_num_threads = 1     omp_num_threads = 1
324    env['ENV']['OMP_NUM_THREADS'] = omp_num_threads
325    
326    try:
327       path = os.environ['PATH']
328       env['ENV']['PATH'] = path
329    except KeyError:
330       omp_num_threads = 1
331    
332  env['ENV']['OMP_NUM_THREADS'] = omp_num_threads  env['ENV']['OMP_NUM_THREADS'] = omp_num_threads
333    
334    
335    # Copy some variables from the system environment to the build environment
336  try:  try:
337     env['ENV']['DISPLAY'] = os.environ['DISPLAY']     env['ENV']['DISPLAY'] = os.environ['DISPLAY']
338     env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY']     env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY']
339       home_temp = os.environ['HOME']   # MPICH2's mpd needs $HOME to find $HOME/.mpd.conf
340       env['ENV']['HOME'] = home_temp
341  except KeyError:  except KeyError:
342     pass     pass
343    
# Line 302  except KeyError: Line 359  except KeyError:
359  py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)  py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
360  env.Append(BUILDERS = {'PyCompile' : py_builder});  env.Append(BUILDERS = {'PyCompile' : py_builder});
361    
362  # FIXME: use the inbuilt scons suffix variable.  runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed',
363  if IS_WINDOWS_PLATFORM:                                src_suffix=env['PROGSUFFIX'], single_source=True)
364     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)  
 else:  
    runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)  
365  env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});  env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
366    
367  runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)  runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
# Line 322  try: Line 377  try:
377     libinstall = env['libinstall']     libinstall = env['libinstall']
378     env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so     env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so
379     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
380     if env['PLATFORM'] == "win32":     if IS_WINDOWS_PLATFORM :
381        env.PrependENVPath('PATH', libinstall)        env.PrependENVPath('PATH', libinstall)
382        env.PrependENVPath('PATH', env['boost_lib_path'])        env.PrependENVPath('PATH', env['boost_lib_path'])
383  except KeyError:  except KeyError:
# Line 331  try: Line 386  try:
386     pyinstall = env['pyinstall'] # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc     pyinstall = env['pyinstall'] # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
387  except KeyError:  except KeyError:
388     pyinstall = None     pyinstall = None
389    
390    try:
391       cc_defines = env['cc_defines']
392       env.Append(CPPDEFINES = cc_defines)
393    except KeyError:
394       pass
395    try:
396       flags = env['ar_flags']
397       env.Append(ARFLAGS = flags)
398    except KeyError:
399       ar_flags = None
400    try:
401       sys_libs = env['sys_libs']
402    except KeyError:
403       sys_libs = []
404    
405    try:
406       tar_flags = env['tar_flags']
407       env.Replace(TARFLAGS = tar_flags)
408    except KeyError:
409       pass
410    
411  try:  try:
412     exinstall = env['exinstall']     exinstall = env['exinstall']
413  except KeyError:  except KeyError:
# Line 347  try: Line 424  try:
424     sys_exinstall = env['sys_exinstall']     sys_exinstall = env['sys_exinstall']
425  except KeyError:  except KeyError:
426     sys_exinstall = None     sys_exinstall = None
427    
428    # ====================== debugging ===================================
429  try:  try:
430     dodebug = env['dodebug']     dodebug = env['dodebug']
431  except KeyError:  except KeyError:
432     dodebug = None     dodebug = None
433    
434    # === switch on omp ===================================================
435  try:  try:
436     useMPI = env['useMPI']    omp_flags = env['omp_flags']
437  except KeyError:  except KeyError:
438     useMPI = None    omp_flags = ''
439    
440  try:  try:
441     cc_defines = env['cc_defines']    omp_flags_debug = env['omp_flags_debug']
    env.Append(CPPDEFINES = cc_defines)  
442  except KeyError:  except KeyError:
443     pass    omp_flags_debug = ''
444    
445    # ========= use mpi? =====================================================
446    try:
447       useMPI = env['useMPI']
448    except KeyError:
449       useMPI = None
450    # ========= set compiler flags ===========================================
451    
452    # Can't use MPI and OpenMP simultaneously at this time
453    if useMPI:
454        omp_flags=''
455        omp_flags_debug=''
456    
457  if dodebug:  if dodebug:
   if useMPI:  
     try:  
       flags = env['cc_flags_debug_MPI']  
       env.Append(CCFLAGS = flags)  
     except KeyError:  
       pass  
   else:  
458      try:      try:
459        flags = env['cc_flags_debug']        flags = env['cc_flags_debug'] + ' ' + omp_flags_debug
460        env.Append(CCFLAGS = flags)        env.Append(CCFLAGS = flags)
461      except KeyError:      except KeyError:
462        pass        pass
463  else:  else:
   if useMPI:  
464     try:     try:
465       flags = env['cc_flags_MPI']        flags = env['cc_flags'] + ' ' + omp_flags
      env.Append(CCFLAGS = flags)  
    except KeyError:  
       pass  
   else:  
    try:  
       flags = env['cc_flags']  
466        env.Append(CCFLAGS = flags)        env.Append(CCFLAGS = flags)
467     except KeyError:     except KeyError:
468        pass        pass
469  if dodebug:  if dodebug:
    if useMPI:  
      try:  
         flags = env['cxx_flags_debug_MPI']  
         env.Append(CXXFLAGS = flags)  
      except KeyError:  
         pass  
    else:  
470       try:       try:
471          flags = env['cxx_flags_debug']          flags = env['cxx_flags_debug']
472          env.Append(CXXFLAGS = flags)          env.Append(CXXFLAGS = flags)
473       except KeyError:       except KeyError:
474          pass          pass
475  else:  else:
    if useMPI:  
      try:  
         flags = env['cxx_flags_MPI']  
         env.Append(CXXFLAGS = flags)  
      except KeyError:  
         pass  
    else:  
476       try:       try:
477          flags = env['cxx_flags']          flags = env['cxx_flags']
478          env.Append(CXXFLAGS = flags)          env.Append(CXXFLAGS = flags)
479       except KeyError:       except KeyError:
480          pass          pass
481  try:  try:
482     flags = env['ar_flags']       if env['CC'] == 'gcc': env.Append(CCFLAGS = "-pedantic-errors -Wno-long-long")
483     env.Append(ARFLAGS = flags)  except:
484  except KeyError:       pass
485     ar_flags = None  
486  try:  # ============= Remember what options were used in the compile =====================================
487     sys_libs = env['sys_libs']  if not IS_WINDOWS_PLATFORM:
488  except KeyError:    env.Execute("/bin/rm -f " + libinstall + "/Compiled.with.*")
489     sys_libs = []    if dodebug:       env.Execute("touch " + libinstall + "/Compiled.with.debug")
490      if useMPI:        env.Execute("touch " + libinstall + "/Compiled.with.mpi")
491      if omp_flags != '':   env.Execute("touch " + libinstall + "/Compiled.with.OpenMP")
492      if bounds_check:  env.Execute("touch " + libinstall + "/Compiled.with.bounds_check")
493    
494  try:  # ============= set mkl (but only of no MPI) =====================================
495     tar_flags = env['tar_flags']  if not useMPI:
496     env.Replace(TARFLAGS = tar_flags)     try:
497  except KeyError:        includes = env['mkl_path']
498     pass        env.Append(CPPPATH = [includes,])
499       except KeyError:
500  try:        pass
    includes = env['mkl_path']  
    env.Append(CPPPATH = [includes,])  
 except KeyError:  
    pass  
501    
502  try:     try:
503     lib_path = env['mkl_lib_path']        lib_path = env['mkl_lib_path']
504     env.Append(LIBPATH = [lib_path,])        env.Append(LIBPATH = [lib_path,])
505  except KeyError:     except KeyError:
506     pass        pass
507    
 if useMPI:  
    mkl_libs = []  
 else:  
508     try:     try:
509        mkl_libs = env['mkl_libs']        mkl_libs = env['mkl_libs']
510     except KeyError:     except KeyError:
511        mkl_libs = []        mkl_libs = []
512    else:
513         mkl_libs = []
514    
515  try:  # ============= set scsl (but only of no MPI) =====================================
516     includes = env['scsl_path']  if not useMPI:
517     env.Append(CPPPATH = [includes,])     try:
518  except KeyError:        includes = env['scsl_path']
519     pass        env.Append(CPPPATH = [includes,])
520       except KeyError:
521          pass
522    
523  try:     try:
524     lib_path = env['scsl_lib_path']        lib_path = env['scsl_lib_path']
525     env.Append(LIBPATH = [lib_path,])        env.Append(LIBPATH = [lib_path,])
526  except KeyError:     except KeyError:
527     pass        pass
528      
529       try:
530          scsl_libs = env['scsl_libs']
531       except KeyError:
532          scsl_libs = [ ]
533    
534  if useMPI:  else:
535    try:      scsl_libs =  []
     scsl_libs = env['scsl_libs_MPI']  
   except KeyError:  
     scsl_libs = []  
 else:  
   try:  
     scsl_libs = env['scsl_libs']  
   except KeyError:  
     scsl_libs = []  
536    
537  try:  # ============= set TRILINOS (but only with MPI) =====================================
538     includes = env['umf_path']  if useMPI:
539     env.Append(CPPPATH = [includes,])     try:
540  except KeyError:        includes = env['trilinos_path']
541     pass        env.Append(CPPPATH = [includes,])
542       except KeyError:
543          pass
544    
545  try:     try:
546     lib_path = env['umf_lib_path']        lib_path = env['trilinos_lib_path']
547     env.Append(LIBPATH = [lib_path,])        env.Append(LIBPATH = [lib_path,])
548  except KeyError:     except KeyError:
549     pass        pass
550    
551  if useMPI:     try:
552      umf_libs = []        trilinos_libs = env['trilinos_libs']
553       except KeyError:
554          trilinos_libs = []
555  else:  else:
556         trilinos_libs = []
557    
558    
559    # ============= set umfpack (but only without MPI) =====================================
560    umf_libs=[ ]
561    if not useMPI:
562       try:
563          includes = env['umf_path']
564          env.Append(CPPPATH = [includes,])
565       except KeyError:
566          pass
567    
568       try:
569          lib_path = env['umf_lib_path']
570          env.Append(LIBPATH = [lib_path,])
571       except KeyError:
572          pass
573    
574     try:     try:
575        umf_libs = env['umf_libs']        umf_libs = env['umf_libs']
576          umf_libs+=umf_libs
577     except KeyError:     except KeyError:
578        umf_libs = []        pass
579    
580  try:     try:
581     includes = env['ufc_path']        includes = env['ufc_path']
582     env.Append(CPPPATH = [includes,])        env.Append(CPPPATH = [includes,])
583  except KeyError:     except KeyError:
584     pass        pass
585    
586  try:     try:
587     includes = env['amd_path']        includes = env['amd_path']
588     env.Append(CPPPATH = [includes,])        env.Append(CPPPATH = [includes,])
589  except KeyError:     except KeyError:
590     pass        pass
591    
592  try:     try:
593     lib_path = env['amd_lib_path']        lib_path = env['amd_lib_path']
594     env.Append(LIBPATH = [lib_path,])        env.Append(LIBPATH = [lib_path,])
595  except KeyError:     except KeyError:
596     pass        pass
597    
 if useMPI:  
     amd_libs = []  
 else:  
598     try:     try:
599        amd_libs = env['amd_libs']        amd_libs = env['amd_libs']
600          umf_libs+=amd_libs
601       except KeyError:
602          pass
603    
604    # ============= set TRILINOS (but only with MPI) =====================================
605    if useMPI:
606       try:
607          includes = env['trilinos_path']
608          env.Append(CPPPATH = [includes,])
609       except KeyError:
610          pass
611    
612       try:
613          lib_path = env['trilinos_lib_path']
614          env.Append(LIBPATH = [lib_path,])
615     except KeyError:     except KeyError:
616        amd_libs = []        pass
617    
618       try:
619          trilinos_libs = env['trilinos_libs']
620       except KeyError:
621          trilinos_libs = []
622    else:
623         trilinos_libs = []
624    
625    # ============= set blas =====================================
626  try:  try:
627     includes = env['blas_path']     includes = env['blas_path']
628     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
# Line 533  except KeyError: Line 638  except KeyError:
638  try:  try:
639     blas_libs = env['blas_libs']     blas_libs = env['blas_libs']
640  except KeyError:  except KeyError:
641     blas_libs = []     blas_libs = [ ]
642    
643    # ========== netcdf ====================================
644  try:  try:
645     useNetCDF = env['useNetCDF']     useNetCDF = env['useNetCDF']
646  except KeyError:  except KeyError:
647     useNetCDF = 'yes'     useNetCDF = 'yes'
648     pass     pass
649        
 if not useNetCDF == 'yes':  
    print "Warning: Installation is not configured with netCDF. Some I/O function may not be available."  
     
650  if useNetCDF == 'yes':  if useNetCDF == 'yes':
651     try:     try:
652          netCDF_libs = env['netCDF_libs']
653       except KeyError:
654          pass
655    
656       env.Append(LIBS = netCDF_libs)
657       env.Append(CPPDEFINES = [ 'USE_NETCDF' ])
658       try:
659        includes = env['netCDF_path']        includes = env['netCDF_path']
660        env.Append(CPPPATH = [includes,])        env.Append(CPPPATH = [includes,])
661     except KeyError:     except KeyError:
# Line 553  if useNetCDF == 'yes': Line 663  if useNetCDF == 'yes':
663    
664     try:     try:
665        lib_path = env['netCDF_lib_path']        lib_path = env['netCDF_lib_path']
       if IS_WINDOWS_PLATFORM: env['ENV']['PATH']+=";"+lib_path  
666        env.Append(LIBPATH = [ lib_path, ])        env.Append(LIBPATH = [ lib_path, ])
667          if IS_WINDOWS_PLATFORM :
668             env.PrependENVPath('PATH', lib_path)
669     except KeyError:     except KeyError:
670        pass        pass
   
    try:  
       netCDF_libs = env['netCDF_libs']  
    except KeyError:  
       netCDF_libs = [ ]  
671  else:  else:
672       print "Warning: Installation is not configured with netCDF. Some I/O function may not be available."
673     netCDF_libs=[ ]     netCDF_libs=[ ]
674    
675    # ====================== boost ======================================
676  try:  try:
677     includes = env['boost_path']     includes = env['boost_path']
678     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
# Line 573  except KeyError: Line 681  except KeyError:
681  try:  try:
682     lib_path = env['boost_lib_path']     lib_path = env['boost_lib_path']
683     env.Append(LIBPATH = [lib_path,])     env.Append(LIBPATH = [lib_path,])
684       if IS_WINDOWS_PLATFORM :
685          env.PrependENVPath('PATH', lib_path)
686  except KeyError:  except KeyError:
687     pass     pass
688  try:  try:
689     boost_lib = env['boost_lib']     boost_lib = env['boost_lib']
690  except KeyError:  except KeyError:
691     boost_lib = None     boost_lib = None
692    # ====================== python ======================================
693  try:  try:
694     includes = env['python_path']     includes = env['python_path']
695     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
# Line 593  try: Line 704  try:
704     python_lib = env['python_lib']     python_lib = env['python_lib']
705  except KeyError:  except KeyError:
706     python_lib = None     python_lib = None
707    # =============== documentation =======================================
708  try:  try:
709     doxygen_path = env['doxygen_path']     doxygen_path = env['doxygen_path']
710  except KeyError:  except KeyError:
# Line 601  try: Line 713  try:
713     epydoc_path = env['epydoc_path']     epydoc_path = env['epydoc_path']
714  except KeyError:  except KeyError:
715     epydoc_path = None     epydoc_path = None
716    # =============== PAPI =======================================
717  try:  try:
718     includes = env['papi_path']     includes = env['papi_path']
719     env.Append(CPPPATH = [includes,])     env.Append(CPPPATH = [includes,])
# Line 615  try: Line 728  try:
728     papi_libs = env['papi_libs']     papi_libs = env['papi_libs']
729  except KeyError:  except KeyError:
730     papi_libs = None     papi_libs = None
731    # ============= set mpi =====================================
732    if useMPI:
733       env.Append(CPPDEFINES=['PASO_MPI',])
734       try:
735          includes = env['mpi_path']
736          env.Append(CPPPATH = [includes,])
737       except KeyError:
738          pass
739       try:
740          lib_path = env['mpi_lib_path']
741          env.Append(LIBPATH = [lib_path,])
742          env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
743       except KeyError:
744          pass
745       try:
746          mpi_libs = env['mpi_libs']
747       except KeyError:
748          mpi_libs = []
749    
750       try:
751          mpi_run = env['mpi_run']
752       except KeyError:
753          mpi_run = ''
754    
755       try:
756           mpich_ignore_cxx_seek=env['MPICH_IGNORE_CXX_SEEK']
757           env.Append(CPPDEFINES = [ mpich_ignore_cxx_seek ] )
758       except KeyError:
759          pass
760    else:
761      mpi_libs=[]
762      mpi_run = mpi_run_default
763    # =========== zip files ===========================================
764    try:
765       includes = env['papi_path']
766       env.Append(CPPPATH = [includes,])
767    except KeyError:
768       pass
769    try:
770       lib_path = env['papi_lib_path']
771       env.Append(LIBPATH = [lib_path,])
772    except KeyError:
773       pass
774    try:
775       papi_libs = env['papi_libs']
776    except KeyError:
777       papi_libs = None
778    try:
779       papi_instrument_solver = env['papi_instrument_solver']
780    except KeyError:
781       papi_instrument_solver = None
782    
783    
784    # ============= and some helpers =====================================
785    try:
786       doxygen_path = env['doxygen_path']
787    except KeyError:
788       doxygen_path = None
789    try:
790       epydoc_path = env['epydoc_path']
791    except KeyError:
792       epydoc_path = None
793  try:  try:
794     src_zipfile = env.File(env['src_zipfile'])     src_zipfile = env.File(env['src_zipfile'])
795  except KeyError:  except KeyError:
# Line 663  try: Line 836  try:
836  except KeyError:  except KeyError:
837     api_doxygen = None     api_doxygen = None
838    
839    try:
840       svn_pipe = os.popen("svnversion -n .")
841       global_revision = svn_pipe.readlines()
842       svn_pipe.close()
843       global_revision = re.sub(":.*", "", global_revision[0])
844       global_revision = re.sub("[^0-9]", "", global_revision)
845    except:
846       global_revision = "0"
847    env.Append(CPPDEFINES = "SVN_VERSION="+global_revision)
848    
849    # Python install - esys __init__.py
850    init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET'))
851    
852  # FIXME: exinstall and friends related to examples are not working.  # FIXME: exinstall and friends related to examples are not working.
853  build_target = env.Alias('build',[libinstall,incinstall,pyinstall])  build_target = env.Alias('build',[libinstall,incinstall,pyinstall,init_target])
854    
855  env.Default(build_target)  env.Default(build_target)
856    
# Line 682  env.Alias('guide_pdf', guide_pdf) Line 867  env.Alias('guide_pdf', guide_pdf)
867  env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index])  env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index])
868  env.Alias('release', ['release_src', 'release_tests', 'docs'])  env.Alias('release', ['release_src', 'release_tests', 'docs'])
869    
870  env.Alias('build_tests')    # target to build all C++ tests  env.Alias('build_tests',build_target)    # target to build all C++ tests
871  env.Alias('build_py_tests') # target to build all python tests  env.Alias('build_py_tests',build_target) # target to build all python tests
872  env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests  env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests
873  env.Alias('run_tests', 'build_tests')   # target to run all C++ test  env.Alias('run_tests', 'build_tests')   # target to run all C++ test
874  env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests  env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests
875  env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests  env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests
876    
 # Python install - esys __init__.py  
 init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET'))  
 env.Alias(init_target)  
877    
878  # Allow sconscripts to see the env  # Allow sconscripts to see the env
879  Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", "netCDF_libs", "useNetCDF",  Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "blas_libs", "netCDF_libs", "useNetCDF", "mpi_run",
880      "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs",      "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs",
881          "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile",          "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile", "trilinos_libs", "mpi_libs", "papi_instrument_solver",
882          "guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ])          "guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ])
883    
884  # End initialisation section  # End initialisation section
885  # Begin configuration section  # Begin configuration section
886  # adds this file and the scons option directore to the source tar  # adds this file and the scons option directore to the source tar
887  release_srcfiles=[env.File('SConstruct'),]+[ env.File(x) for x in glob.glob('scons/*.py') ]  release_srcfiles=[env.File('SConstruct'),env.Dir('lib'),env.Dir('include'),]+[ env.File(x) for x in glob.glob('scons/*.py') ]
888  release_testfiles=[env.File('README_TESTS'),]  release_testfiles=[env.File('README_TESTS'),]
889  env.Zip(src_zipfile, release_srcfiles)  env.Zip(src_zipfile, release_srcfiles)
890  env.Zip(test_zipfile, release_testfiles)  env.Zip(test_zipfile, release_testfiles)
# Line 727  env.SConscript(dirs = ['modellib/py_src' Line 909  env.SConscript(dirs = ['modellib/py_src'
909  env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)  env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
910  env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)  env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)
911  env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)  env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)
   
 # added by Ben Cumming  
912  env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)  env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
913  #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)  #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)
914    

Legend:
Removed from v.1243  
changed lines
  Added in v.1360

  ViewVC Help
Powered by ViewVC 1.1.26