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

Annotation of /branches/dirac/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1459 - (hide annotations)
Thu Mar 27 01:49:10 2008 UTC (11 years, 7 months ago) by ksteube
Original Path: trunk/SConstruct
File size: 32647 byte(s)
Implemented ParMETIS for mesh partition optimization under MPI.
Documented optimize=True in User Guide for Brick() and Rectangle().

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

  ViewVC Help
Powered by ViewVC 1.1.26