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

Diff of /branches/windows_from_1456_trunk_1574_merged_in/SConstruct

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

trunk/SConstruct revision 602 by gross, Fri Mar 17 06:57:46 2006 UTC branches/windows_from_1456_trunk_1522_merged_in/SConstruct revision 1536 by phornby, Tue Apr 29 08:08:58 2008 UTC
# Line 1  Line 1 
1    #         Copyright 2006 by ACcESS MNRF
2    #
3    #              http://www.access.edu.au
4    #       Primary Business: Queensland, Australia
5    #  Licensed under the Open Software License version 3.0
6    #     http://www.opensource.org/licenses/osl-3.0.php
7    
8  # top-level Scons configuration file for all esys13 modules  # top-level Scons configuration file for all esys13 modules
9    # Begin initialisation Section
10    # all of this section just intialises default environments and helper
11    # scripts. You shouldn't need to modify this section.
12    EnsureSConsVersion(0,96,91)
13    EnsurePythonVersion(2,3)
14    
15    #===============================================================
16    #   import tools:
17    import glob
18    import sys, os, re
19    # Add our extensions
20    if sys.path.count('scons')==0: sys.path.append('scons')
21    import scons_extensions
22    
23    # We may also need to know where python's site-packages subdirectory lives
24    python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1])
25    
26    #===============================================================
27    
28    tools_prefix="/usr"
29    
30    #==============================================================================================    
31    #    
32    #    get the installation prefix
33  #  #
34  # set appropriate defaults for configuration variables  prefix = ARGUMENTS.get('prefix', sys.prefix )
35    
36    # We may also need to know where python's site-packages subdirectory lives
37    python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1])
38    # Install as a standard python package in /usr/lib64 if available, else in /usr/lib
39    if os.path.isdir(  prefix+"/lib64/"+python_version+"/site-packages"):
40       sys_dir_packages =  prefix+"/lib64/"+python_version+"/site-packages/esys"
41       sys_dir_libraries = prefix+"/lib64"
42    else:
43       sys_dir_packages =  prefix+"/lib/"+python_version+"/site-packages/esys"
44       sys_dir_libraries = prefix+"/lib"
45    
46    sys_dir_examples = prefix+"/share/doc/esys"
47    
48  esysroot=str(Dir('.').abspath)  source_root = Dir('#.').abspath
 execfile(str(File(esysroot+"/scons/esys_options.py")))  
49    
50    dir_packages = os.path.join(source_root,"esys")
51    dir_examples = os.path.join(source_root,"examples")
52    dir_libraries = os.path.join(source_root,"lib")
53    
54    print "Source root is : ",source_root
55    print " Default packages local installation:    ", dir_packages
56    print " Default library local installation  ", dir_libraries
57    print " Default example local  installation:    ", dir_examples
58    print "Install prefix is: ", prefix
59    print " Default packages system installation:   ", sys_dir_packages
60    print " Default library system installation     ", sys_dir_libraries
61    print " Default example system installation:    ", sys_dir_examples
62    
63    #==============================================================================================    
64    
65    # Default options and options help text
66    # These are defaults and can be overridden using command line arguments or an options file.
67    # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
68    # DO NOT CHANGE THEM HERE
69    # Where to install?
70    #==============================================================================================    
71    #    
72    #    get the options file if present:
73  #  #
74  # call appropriate SConscripts  options_file = ARGUMENTS.get('options_file','')
75    
76    if not os.path.isfile(options_file) :
77        options_file = False
78    
79    if not options_file :
80       import socket
81       hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])
82       tmp = os.path.join("scons",hostname+"_options.py")
83    
84       if os.path.isfile(tmp) :
85          options_file = tmp
86    
87    IS_WINDOWS_PLATFORM = (os.name== "nt")
88    
89    # If you're not going to tell me then......
90    # FIXME: add one for the altix too.
91    if not options_file :
92       if IS_WINDOWS_PLATFORM :
93          options_file = "scons/windows_mscv71_options.py"
94       else:
95          options_file = "scons/linux_gcc_eg_options.py"
96    
97    # and load it
98    opts = Options(options_file, ARGUMENTS)
99    #================================================================
100    #
101    #   check if UMFPACK is installed on the system:
102    #
103    uf_root=None
104    for i in [ 'UMFPACK', 'umfpack', 'ufsparse', 'UFSPARSE']:
105       if os.path.isdir(os.path.join(tools_prefix,'include',i)):
106           uf_root=i
107           print i," is used form ",tools_prefix
108           break
109    if not uf_root==None:
110       umf_path_default=os.path.join(tools_prefix,'include',uf_root)
111       umf_lib_path_default=os.path.join(tools_prefix,'lib')
112       umf_libs_default=['umfpack']
113       amd_path_default=os.path.join(tools_prefix,'include',uf_root)
114       amd_lib_path_default=os.path.join(tools_prefix,'lib')
115       amd_libs_default=['amd']
116       ufc_path_default=os.path.join(tools_prefix,'include',uf_root)
117    else:
118       umf_path_default=None
119       umf_lib_path_default=None
120       umf_libs_default=None
121       amd_path_default=None
122       amd_lib_path_default=None
123       amd_libs_default=None
124       ufc_path_default=None
125    #
126    #==========================================================================
127    #
128    #    python installation:
129    #
130    python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1]))
131    python_lib_path_default=os.path.join(tools_prefix,'lib')
132    python_lib_default="python%s.%s"%(sys.version_info[0],sys.version_info[1])
133    
134    #==========================================================================
135    #
136    #    boost installation:
137    #
138    boost_path_default=os.path.join(tools_prefix,'include')
139    boost_lib_path_default=os.path.join(tools_prefix,'lib')
140    boost_lib_default=['boost_python']
141    
142    #==========================================================================
143    #
144    #    check if netCDF is installed on the system:
145    #
146    netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3')
147    netCDF_lib_path_default=os.path.join(tools_prefix,'lib')
148    
149    if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default):
150         useNetCDF_default='yes'
151         netCDF_libs_default=[ 'netcdf_c++', 'netcdf' ]
152    else:
153         useNetCDF_default='no'
154         netCDF_path_default=None
155         netCDF_lib_path_default=None
156         netCDF_libs_default=None
157    
158    #==========================================================================
159    #
160    #  MPI:
161    #
162    if IS_WINDOWS_PLATFORM:
163       useMPI_default='no'
164       mpi_path_default=None
165       mpi_lib_path_default=None
166       mpi_libs_default=[]
167       mpi_run_default=None
168    else:
169       useMPI_default='no'
170       mpi_root='/usr/local'
171       mpi_path_default=os.path.join(mpi_root,'include')
172       mpi_lib_path_default=os.path.join(mpi_root,'lib')
173       mpi_libs_default=[ 'mpich' , 'pthread', 'rt' ]
174       mpi_run_default='mpiexec -np 1'
175    #
176    #==========================================================================
177    #
178    #    compile:
179    #
180    cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi'
181    cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi'
182    cxx_flags_default='--no-warn -ansi'
183    cxx_flags_debug_default='--no-warn -ansi -DDOASSERT'
184    
185    #==============================================================================================    
186    # Default options and options help text
187    # These are defaults and can be overridden using command line arguments or an options file.
188    # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
189    # DO NOT CHANGE THEM HERE
190    opts.AddOptions(
191    # Where to install esys stuff
192      ('incinstall', 'where the esys headers will be installed',             Dir('#.').abspath+'/include'),
193      ('libinstall', 'where the esys libraries will be installed',           dir_libraries),
194      ('pyinstall', 'where the esys python modules will be installed',       dir_packages),
195      ('exinstall', 'where the esys examples will be installed',             dir_examples),
196      ('sys_libinstall', 'where the system esys libraries will be installed',       sys_dir_libraries),
197      ('sys_pyinstall', 'where the system esys python modules will be installed',   sys_dir_packages),
198      ('sys_exinstall', 'where the system esys examples will be installed',         sys_dir_examples),
199      ('src_zipfile', 'the source zip file will be installed.',              Dir('#.').abspath+"/release/escript_src.zip"),
200      ('test_zipfile', 'the test zip file will be installed.',               Dir('#.').abspath+"/release/escript_tests.zip"),
201      ('src_tarfile', 'the source tar file will be installed.',              Dir('#.').abspath+"/release/escript_src.tar.gz"),
202      ('test_tarfile', 'the test tar file will be installed.',               Dir('#.').abspath+"/release/escript_tests.tar.gz"),
203      ('examples_tarfile', 'the examples tar file will be installed.',       Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"),
204      ('examples_zipfile', 'the examples zip file will be installed.',       Dir('#.').abspath+"/release/doc/escript_examples.zip"),
205      ('guide_pdf', 'name of the user guide in pdf format',                  Dir('#.').abspath+"/release/doc/user/guide.pdf"),
206      ('api_epydoc', 'name of the epydoc api docs directory',                Dir('#.').abspath+"/release/doc/epydoc"),
207      ('guide_html', 'name of the directory for user guide in html format',  Dir('#.').abspath+"/release/doc/user/html"),
208      ('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"),
209    # Compilation options
210      BoolOption('dodebug', 'Do you want a debug build?', 'no'),
211      BoolOption('bounds_check', 'Do you want extra array bounds checking?', 'no'),
212      ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/<hostname>_options.py)", options_file),
213      ('cc_defines','C/C++ defines to use', None),
214      ('cc_flags','C compiler flags to use (Release build)', cc_flags_default),
215      ('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default),
216      ('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default),
217      ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', cxx_flags_debug_default),
218      ('link_flags', 'Linker flags to use (Release build)', None),
219      ('link_flags_debug', 'Linker flags to use (Debug build)', None),
220    
221      ('omp_flags', 'OpenMP compiler flags to use (Release build)', ''),
222      ('omp_flags_debug', 'OpenMP compiler flags to use (Debug build)', ''),
223      ('ar_flags', 'Static library archiver flags to use', None),
224      ('sys_libs', 'System libraries to link with', None),
225      ('tar_flags','flags for zip files','-c -z'),
226    # MKL
227      PathOption('mkl_path', 'Path to MKL includes', None),
228      PathOption('mkl_lib_path', 'Path to MKL libs', None),
229      ('mkl_libs', 'MKL libraries to link with', None),
230    # SCSL
231      PathOption('scsl_path', 'Path to SCSL includes', None),
232      PathOption('scsl_lib_path', 'Path to SCSL libs', None),
233      ('scsl_libs', 'SCSL libraries to link with', None),
234      ('scsl_libs_MPI', 'SCSL libraries to link with for MPI build', None),
235    # UMFPACK
236      PathOption('ufc_path', 'Path to UFconfig includes', ufc_path_default),
237      PathOption('umf_path', 'Path to UMFPACK includes', umf_path_default),
238      PathOption('umf_lib_path', 'Path to UMFPACK libs', umf_lib_path_default),
239      ('umf_libs', 'UMFPACK libraries to link with', umf_libs_default),
240    # AMD (used by UMFPACK)
241      PathOption('amd_path', 'Path to AMD includes', amd_path_default),
242      PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default),
243      ('amd_libs', 'AMD libraries to link with', amd_libs_default),
244    # ParMETIS
245      ('parmetis_path', 'Path to ParMETIS includes', ''),
246      ('parmetis_lib_path', 'Path to ParMETIS library', ''),
247      ('parmetis_lib', 'ParMETIS library to link with', []),
248    # TRILINOS
249      PathOption('trilinos_path', 'Path to TRILINOS includes', None),
250      PathOption('trilinos_lib_path', 'Path to TRILINOS libs', None),
251      ('trilinos_libs', 'TRILINOS libraries to link with', None),
252    # BLAS
253      PathOption('blas_path', 'Path to BLAS includes', None),
254      PathOption('blas_lib_path', 'Path to BLAS libs', None),
255      ('blas_libs', 'BLAS libraries to link with', None),
256    # netCDF
257      ('useNetCDF', 'switch on/off the usage of netCDF', useNetCDF_default),
258      PathOption('netCDF_path', 'Path to netCDF includes', netCDF_path_default),
259      PathOption('netCDF_lib_path', 'Path to netCDF libs', netCDF_lib_path_default),
260      ('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default),
261    # Python
262    # locations of include files for python
263    # FIXME: python_path should be python_inc_path and the same for boost etc.
264      PathOption('python_path', 'Path to Python includes', python_path_default),
265      PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default),
266      ('python_lib', 'Python libraries to link with', python_lib_default),
267      ('python_cmd', 'Python command', 'python'),
268    # Boost
269      PathOption('boost_path', 'Path to Boost includes', boost_path_default),
270      PathOption('boost_lib_path', 'Path to Boost libs', boost_lib_path_default),
271      ('boost_lib', 'Boost libraries to link with', boost_lib_default),
272    # Doc building
273    #  PathOption('doxygen_path', 'Path to Doxygen executable', None),
274    #  PathOption('epydoc_path', 'Path to Epydoc executable', None),
275    # PAPI
276      PathOption('papi_path', 'Path to PAPI includes', None),
277      PathOption('papi_lib_path', 'Path to PAPI libs', None),
278      ('papi_libs', 'PAPI libraries to link with', None),
279      ('papi_instrument_solver', 'use PAPI in Solver.c to instrument each iteration of the solver', None),
280    # MPI
281      BoolOption('useMPI', 'Compile parallel version using MPI', useMPI_default),
282      ('MPICH_IGNORE_CXX_SEEK', 'name of macro to ignore MPI settings of C++ SEEK macro (for MPICH)' , 'MPICH_IGNORE_CXX_SEEK'),
283      PathOption('mpi_path', 'Path to MPI includes', mpi_path_default),
284      ('mpi_run', 'mpirun name' , mpi_run_default),
285      PathOption('mpi_lib_path', 'Path to MPI libs (needs to be added to the LD_LIBRARY_PATH)',mpi_lib_path_default),
286      ('mpi_libs', 'MPI libraries to link with (needs to be shared!)', mpi_libs_default)
287    )
288    #=================================================================================================
289    #
290    #   Note: On the Altix the intel compilers are not automatically
291    #   detected by scons intelc.py script. The Altix has a different directory
292    #   path and in some locations the "modules" facility is used to support
293    #   multiple compiler versions. This forces the need to import the users PATH
294    #   environment which isn't the "scons way"
295    #   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)
296    #   FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix
297    #
298    
299    if IS_WINDOWS_PLATFORM:
300          env = Environment(tools = ['default', 'msvc'], options = opts)
301          #env = Environment(tools = ['default', 'intelc'], options = opts)
302    else:
303       if os.uname()[4]=='ia64':
304          env = Environment(tools = ['default', 'intelc'], options = opts)
305          if env['CXX'] == 'icpc':
306             env['LINK'] = env['CXX'] # version >=9 of intel c++ compiler requires use of icpc to link in C++ runtimes (icc does not). FIXME: this behaviour could be directly incorporated into scons intelc.py
307       else:
308          env = Environment(tools = ['default'], options = opts)
309    Help(opts.GenerateHelpText(env))
310    
311    if env['bounds_check']:
312       env.Append(CPPDEFINES = [ 'BOUNDS_CHECK' ])
313       env.Append(CXXDEFINES = [ 'BOUNDS_CHECK' ])
314       bounds_check = env['bounds_check']
315    else:
316       bounds_check = 0
317    
318    #=================================================================================================
319    #
320    #     Initialise Scons Build Environment
321    #     check for user environment variables we are interested in
322    try:
323       tmp = os.environ['PYTHONPATH']
324       env['ENV']['PYTHONPATH'] = tmp
325    except KeyError:
326       pass
327    
328    env.PrependENVPath('PYTHONPATH', source_root)
329    
330    try:
331       omp_num_threads = os.environ['OMP_NUM_THREADS']
332    except KeyError:
333       omp_num_threads = 1
334    env['ENV']['OMP_NUM_THREADS'] = omp_num_threads
335    
336    try:
337       path = os.environ['PATH']
338       env['ENV']['PATH'] = path
339    except KeyError:
340       omp_num_threads = 1
341    
342    env['ENV']['OMP_NUM_THREADS'] = omp_num_threads
343    
344    
345    # Copy some variables from the system environment to the build environment
346    try:
347       env['ENV']['DISPLAY'] = os.environ['DISPLAY']
348       env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY']
349       home_temp = os.environ['HOME']   # MPICH2's mpd needs $HOME to find $HOME/.mpd.conf
350       env['ENV']['HOME'] = home_temp
351    except KeyError:
352       pass
353    
354    try:
355       tmp = os.environ['PATH']
356       env['ENV']['PATH'] = tmp
357    except KeyError:
358       pass
359    
360    try:
361       tmp = os.environ['LD_LIBRARY_PATH']
362       print tmp
363       env['ENV']['LD_LIBRARY_PATH'] = tmp
364    except KeyError:
365       pass
366    #==========================================================================
367    #
368    #    Add some customer builders
369    #
370    py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
371    env.Append(BUILDERS = {'PyCompile' : py_builder});
372    
373    runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed',
374                                  src_suffix=env['PROGSUFFIX'], single_source=True)
375    
376    env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
377    
378    runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
379    env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
380    
381    # Convert the options which are held in environment variable into python variables for ease of handling and configure compilation options
382    try:
383       incinstall = env['incinstall']
384       env.Append(CPPPATH = [incinstall,])
385    except KeyError:
386       incinstall = None
387    try:
388       libinstall = env['libinstall']
389       env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so
390       env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
391       if IS_WINDOWS_PLATFORM :
392          env.PrependENVPath('PATH', libinstall)
393          env.PrependENVPath('PATH', env['boost_lib_path'])
394    except KeyError:
395       libinstall = None
396    try:
397       pyinstall = env['pyinstall'] # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
398    except KeyError:
399       pyinstall = None
400    
401    try:
402       cc_defines = env['cc_defines']
403       env.Append(CPPDEFINES = cc_defines)
404    except KeyError:
405       pass
406    try:
407       flags = env['ar_flags']
408       env.Append(ARFLAGS = flags)
409    except KeyError:
410       ar_flags = None
411    try:
412       sys_libs = env['sys_libs']
413    except KeyError:
414       sys_libs = []
415    
416    try:
417       tar_flags = env['tar_flags']
418       env.Replace(TARFLAGS = tar_flags)
419    except KeyError:
420       pass
421    
422    try:
423       exinstall = env['exinstall']
424    except KeyError:
425       exinstall = None
426    try:
427       sys_libinstall = env['sys_libinstall']
428    except KeyError:
429       sys_libinstall = None
430    try:
431       sys_pyinstall = env['sys_pyinstall']
432    except KeyError:
433       sys_pyinstall = None
434    try:
435       sys_exinstall = env['sys_exinstall']
436    except KeyError:
437       sys_exinstall = None
438    
439    # ====================== debugging ===================================
440    try:
441       dodebug = env['dodebug']
442    except KeyError:
443       dodebug = None
444    
445    # === switch on omp ===================================================
446    try:
447      omp_flags = env['omp_flags']
448    except KeyError:
449      omp_flags = ''
450    
451    try:
452      omp_flags_debug = env['omp_flags_debug']
453    except KeyError:
454      omp_flags_debug = ''
455    
456    # ========= use mpi? =====================================================
457    try:
458       useMPI = env['useMPI']
459    except KeyError:
460       useMPI = None
461    # ========= set compiler flags ===========================================
462    
463    if dodebug:
464        try:
465          flags = env['cc_flags_debug'] + ' ' + omp_flags_debug
466          env.Append(CCFLAGS = flags)
467        except KeyError:
468          pass
469    else:
470       try:
471          flags = env['cc_flags'] + ' ' + omp_flags
472          env.Append(CCFLAGS = flags)
473       except KeyError:
474          pass
475    if dodebug:
476         try:
477            flags = env['cxx_flags_debug']
478            env.Append(CXXFLAGS = flags)
479         except KeyError:
480            pass
481    else:
482         try:
483            flags = env['cxx_flags']
484            env.Append(CXXFLAGS = flags)
485         except KeyError:
486            pass
487    try:
488         if env['CC'] == 'gcc': env.Append(CCFLAGS = "-pedantic-errors -Wno-long-long")
489    except:
490         pass
491    if dodebug:
492         try:
493            flags = env['link_flags_debug']
494            env.Append(LINKFLAGS = flags)
495         except KeyError:
496            pass
497    else:
498         try:
499            flags = env['link_flags']
500            env.Append(LINKFLAGS = flags)
501         except KeyError:
502            pass
503    
504    # ============= Remember what options were used in the compile =====================================
505    if not IS_WINDOWS_PLATFORM:
506      env.Execute("/bin/rm -f " + libinstall + "/Compiled.with.*")
507      if dodebug:       env.Execute("touch " + libinstall + "/Compiled.with.debug")
508      if useMPI:        env.Execute("touch " + libinstall + "/Compiled.with.mpi")
509      if omp_flags != '':   env.Execute("touch " + libinstall + "/Compiled.with.OpenMP")
510      if bounds_check:  env.Execute("touch " + libinstall + "/Compiled.with.bounds_check")
511    
512    # ============= set mkl (but only of no MPI) =====================================
513    if not useMPI:
514       try:
515          includes = env['mkl_path']
516          env.Append(CPPPATH = [includes,])
517       except KeyError:
518          pass
519    
520       try:
521          lib_path = env['mkl_lib_path']
522          env.Append(LIBPATH = [lib_path,])
523          env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
524       except KeyError:
525          pass
526    
527       try:
528          mkl_libs = env['mkl_libs']
529       except KeyError:
530          mkl_libs = []
531    else:
532         mkl_libs = []
533    
534    # ============= set scsl (but only of no MPI) =====================================
535    if not useMPI:
536       try:
537          includes = env['scsl_path']
538          env.Append(CPPPATH = [includes,])
539       except KeyError:
540          pass
541    
542       try:
543          lib_path = env['scsl_lib_path']
544          env.Append(LIBPATH = [lib_path,])
545          env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
546       except KeyError:
547          pass
548      
549       try:
550          scsl_libs = env['scsl_libs']
551       except KeyError:
552          scsl_libs = [ ]
553    
554    else:
555        scsl_libs =  []
556    
557    # ============= set TRILINOS (but only with MPI) =====================================
558    if useMPI:
559       try:
560          includes = env['trilinos_path']
561          env.Append(CPPPATH = [includes,])
562       except KeyError:
563          pass
564    
565       try:
566          lib_path = env['trilinos_lib_path']
567          env.Append(LIBPATH = [lib_path,])
568       except KeyError:
569          pass
570    
571       try:
572          trilinos_libs = env['trilinos_libs']
573       except KeyError:
574          trilinos_libs = []
575    else:
576         trilinos_libs = []
577    
578    
579    # ============= set umfpack (but only without MPI) =====================================
580    umf_libs=[ ]
581    if not useMPI:
582       try:
583          includes = env['umf_path']
584          env.Append(CPPPATH = [includes,])
585       except KeyError:
586          pass
587    
588       try:
589          lib_path = env['umf_lib_path']
590          env.Append(LIBPATH = [lib_path,])
591       except KeyError:
592          pass
593    
594       try:
595          umf_libs = env['umf_libs']
596          umf_libs+=umf_libs
597       except KeyError:
598          pass
599    
600       try:
601          includes = env['ufc_path']
602          env.Append(CPPPATH = [includes,])
603       except KeyError:
604          pass
605    
606       try:
607          includes = env['amd_path']
608          env.Append(CPPPATH = [includes,])
609       except KeyError:
610          pass
611    
612       try:
613          lib_path = env['amd_lib_path']
614          env.Append(LIBPATH = [lib_path,])
615       except KeyError:
616          pass
617    
618       try:
619          amd_libs = env['amd_libs']
620          umf_libs+=amd_libs
621       except KeyError:
622          pass
623    
624    # ============= set TRILINOS (but only with MPI) =====================================
625    if useMPI:
626       try:
627          includes = env['trilinos_path']
628          env.Append(CPPPATH = [includes,])
629       except KeyError:
630          pass
631    
632       try:
633          lib_path = env['trilinos_lib_path']
634          env.Append(LIBPATH = [lib_path,])
635       except KeyError:
636          pass
637    
638       try:
639          trilinos_libs = env['trilinos_libs']
640       except KeyError:
641          trilinos_libs = []
642    else:
643         trilinos_libs = []
644    
645    # ============= set blas =====================================
646    try:
647       includes = env['blas_path']
648       env.Append(CPPPATH = [includes,])
649    except KeyError:
650       pass
651    
652    try:
653       lib_path = env['blas_lib_path']
654       env.Append(LIBPATH = [lib_path,])
655    except KeyError:
656       pass
657    
658    try:
659       blas_libs = env['blas_libs']
660    except KeyError:
661       blas_libs = [ ]
662    
663    # ========== netcdf ====================================
664    try:
665       useNetCDF = env['useNetCDF']
666    except KeyError:
667       useNetCDF = 'yes'
668       pass
669        
670    if useNetCDF == 'yes':
671       try:
672          netCDF_libs = env['netCDF_libs']
673       except KeyError:
674          pass
675    
676       env.Append(LIBS = netCDF_libs)
677       env.Append(CPPDEFINES = [ 'USE_NETCDF' ])
678       try:
679          includes = env['netCDF_path']
680          env.Append(CPPPATH = [includes,])
681       except KeyError:
682          pass
683    
684       try:
685          lib_path = env['netCDF_lib_path']
686          env.Append(LIBPATH = [ lib_path, ])
687          env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
688          if IS_WINDOWS_PLATFORM :
689             env.PrependENVPath('PATH', lib_path)
690       except KeyError:
691          pass
692    else:
693       print "Warning: Installation is not configured with netCDF. Some I/O function may not be available."
694       netCDF_libs=[ ]
695    
696    # ====================== boost ======================================
697    try:
698       includes = env['boost_path']
699       env.Append(CPPPATH = [includes,])
700    except KeyError:
701       pass
702    try:
703       lib_path = env['boost_lib_path']
704       env.Append(LIBPATH = [lib_path,])
705       env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
706       if IS_WINDOWS_PLATFORM :
707          env.PrependENVPath('PATH', lib_path)
708    except KeyError:
709       pass
710    try:
711       boost_lib = env['boost_lib']
712    except KeyError:
713       boost_lib = None
714    # ====================== python ======================================
715    try:
716       includes = env['python_path']
717       env.Append(CPPPATH = [includes,])
718    except KeyError:
719       pass
720    try:
721       lib_path = env['python_lib_path']
722       env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
723       env.Append(LIBPATH = [lib_path,])
724    except KeyError:
725       pass
726    try:
727       python_lib = env['python_lib']
728    except KeyError:
729       python_lib = None
730    # =============== documentation =======================================
731    try:
732       doxygen_path = env['doxygen_path']
733    except KeyError:
734       doxygen_path = None
735    try:
736       epydoc_path = env['epydoc_path']
737    except KeyError:
738       epydoc_path = None
739    # =============== ParMETIS =======================================
740    try:
741       parmetis_path = env['parmetis_path']
742       parmetis_lib_path = env['parmetis_lib_path']
743       parmetis_lib = env['parmetis_lib']
744    except KeyError:
745       parmetis_path = ''
746       parmetis_lib_path = ''
747       parmetis_lib = ''
748    
749    if useMPI and os.path.isdir(parmetis_lib_path):
750       env.Append(CPPDEFINES = [ 'PARMETIS' ])
751       env.Append(CXXDEFINES = [ 'PARMETIS' ])
752       env.Append(CPPPATH = [parmetis_path])
753       env.Append(LIBPATH = [parmetis_lib_path])
754       env.Append(LIBS = parmetis_lib)
755    # =============== PAPI =======================================
756    try:
757       includes = env['papi_path']
758       env.Append(CPPPATH = [includes,])
759    except KeyError:
760       pass
761    try:
762       lib_path = env['papi_lib_path']
763       env.Append(LIBPATH = [lib_path,])
764    except KeyError:
765       pass
766    try:
767       papi_libs = env['papi_libs']
768    except KeyError:
769       papi_libs = None
770    # ============= set mpi =====================================
771    if useMPI:
772       env.Append(CPPDEFINES=['PASO_MPI',])
773       try:
774          includes = env['mpi_path']
775          env.Append(CPPPATH = [includes,])
776       except KeyError:
777          pass
778       try:
779          lib_path = env['mpi_lib_path']
780          env.Append(LIBPATH = [lib_path,])
781          env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path
782       except KeyError:
783          pass
784       try:
785          mpi_libs = env['mpi_libs']
786       except KeyError:
787          mpi_libs = []
788    
789       try:
790          mpi_run = env['mpi_run']
791       except KeyError:
792          mpi_run = ''
793    
794       try:
795           mpich_ignore_cxx_seek=env['MPICH_IGNORE_CXX_SEEK']
796           env.Append(CPPDEFINES = [ mpich_ignore_cxx_seek ] )
797       except KeyError:
798          pass
799    else:
800      mpi_libs=[]
801      mpi_run = mpi_run_default
802    # =========== zip files ===========================================
803    try:
804       includes = env['papi_path']
805       env.Append(CPPPATH = [includes,])
806    except KeyError:
807       pass
808    try:
809       lib_path = env['papi_lib_path']
810       env.Append(LIBPATH = [lib_path,])
811    except KeyError:
812       pass
813    try:
814       papi_libs = env['papi_libs']
815    except KeyError:
816       papi_libs = None
817    try:
818       papi_instrument_solver = env['papi_instrument_solver']
819    except KeyError:
820       papi_instrument_solver = None
821    
822    
823    # ============= and some helpers =====================================
824    try:
825       doxygen_path = env['doxygen_path']
826    except KeyError:
827       doxygen_path = None
828    try:
829       epydoc_path = env['epydoc_path']
830    except KeyError:
831       epydoc_path = None
832    try:
833       src_zipfile = env.File(env['src_zipfile'])
834    except KeyError:
835       src_zipfile = None
836    try:
837       test_zipfile = env.File(env['test_zipfile'])
838    except KeyError:
839       test_zipfile = None
840    try:
841       examples_zipfile = env.File(env['examples_zipfile'])
842    except KeyError:
843       examples_zipfile = None
844    
845    try:
846       src_tarfile = env.File(env['src_tarfile'])
847    except KeyError:
848       src_tarfile = None
849    try:
850       test_tarfile = env.File(env['test_tarfile'])
851    except KeyError:
852       test_tarfile = None
853    try:
854       examples_tarfile = env.File(env['examples_tarfile'])
855    except KeyError:
856       examples_tarfile = None
857    
858    try:
859       guide_pdf = env.File(env['guide_pdf'])
860    except KeyError:
861       guide_pdf = None
862    
863    try:
864       guide_html_index = env.File('index.htm',env['guide_html'])
865    except KeyError:
866       guide_html_index = None
867    
868    try:
869       api_epydoc = env.Dir(env['api_epydoc'])
870    except KeyError:
871       api_epydoc = None
872    
873    try:
874       api_doxygen = env.Dir(env['api_doxygen'])
875    except KeyError:
876       api_doxygen = None
877    
878    try:
879       svn_pipe = os.popen("svnversion -n .")
880       global_revision = svn_pipe.readlines()
881       svn_pipe.close()
882       global_revision = re.sub(":.*", "", global_revision[0])
883       global_revision = re.sub("[^0-9]", "", global_revision)
884    except:
885       global_revision="-1"
886       print "Warning: unable to recover global revsion number."
887    if global_revision == "": global_revision="0"
888    print "Revision number is %s."%global_revision
889    env.Append(CPPDEFINES = "SVN_VERSION="+global_revision)
890    
891    # Python install - esys __init__.py
892    init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET'))
893    
894    # FIXME: exinstall and friends related to examples are not working.
895    build_target = env.Alias('build',[libinstall,incinstall,pyinstall,init_target])
896    
897    env.Default(build_target)
898    
899    # Zipgets
900    env.Alias('release_src',[ src_zipfile, src_tarfile ])
901    env.Alias('release_tests',[ test_zipfile, test_tarfile])
902    env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
903    env.Alias('examples_zipfile',examples_zipfile)
904    env.Alias('examples_tarfile',examples_tarfile)
905    env.Alias('api_epydoc',api_epydoc)
906    env.Alias('api_doxygen',api_doxygen)
907    env.Alias('guide_html_index',guide_html_index)
908    env.Alias('guide_pdf', guide_pdf)
909    env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index])
910    env.Alias('release', ['release_src', 'release_tests', 'docs'])
911    
912    env.Alias('build_tests',build_target)    # target to build all C++ tests
913    env.Alias('build_py_tests',build_target) # target to build all python tests
914    env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests
915    env.Alias('run_tests', 'build_tests')   # target to run all C++ test
916    env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests
917    env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests
918    
919    
920    # Allow sconscripts to see the env
921    Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "blas_libs", "netCDF_libs", "useNetCDF", "mpi_run",
922        "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs",
923            "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile", "trilinos_libs", "mpi_libs", "papi_instrument_solver",
924            "guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ])
925    
926    # End initialisation section
927    # Begin configuration section
928    # adds this file and the scons option directore to the source tar
929    release_srcfiles=[env.File('SConstruct'),env.Dir('lib'),env.Dir('include'),]+[ env.File(x) for x in glob.glob('scons/*.py') ]
930    release_testfiles=[env.File('README_TESTS'),]
931    env.Zip(src_zipfile, release_srcfiles)
932    env.Zip(test_zipfile, release_testfiles)
933    try:
934       env.Tar(src_tarfile, release_srcfiles)
935       env.Tar(test_tarfile, release_testfiles)
936    except AttributeError:
937       pass
938    # Insert new components to be build here
939    # FIXME: might be nice to replace this verbosity with a list of targets and some
940    # FIXME: nifty python to create the lengthy but very similar env.Sconscript lines
941    # Third Party libraries
942    env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
943    # C/C++ Libraries
944    env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
945    env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
946    env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
947    # bruce is removed for now as it doesn't really do anything
948    # env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
949    env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
950    env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)
951    env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
952    env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)
953    env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)
954    env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
955    #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)
956    
957    
958  target_scripts = ['tools/CppUnitTest/SConstruct',  syslib_install_target = env.installDirectory(sys_libinstall,libinstall)
959                    'tools/mmio/SConstruct',  syspy_install_target = env.installDirectory(sys_pyinstall,pyinstall,recursive=True)
                   'esysUtils/SConstruct',  
                   'escript/SConstruct',  
                   'bruce/SConstruct',  
                   'paso/SConstruct',  
                   'finley/SConstruct',  
                   'modellib/SConstruct']  
                   # 'pyvisi/SConstruct',  
                   # 'doc/SConstruct']  
                   # 'doc/SConstruct']  
960    
961  SConscript(target_scripts, duplicate=0)  install_target = env.Alias("install", env.Flatten([syslib_install_target, syspy_install_target]) )

Legend:
Removed from v.602  
changed lines
  Added in v.1536

  ViewVC Help
Powered by ViewVC 1.1.26