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

Annotation of /branches/refine/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1360 - (hide annotations)
Thu Dec 13 05:05:00 2007 UTC (11 years, 5 months ago) by ksteube
Original Path: trunk/SConstruct
File size: 31400 byte(s)
Partial implementation of ReadMeshMPI.
Will eventually replace ReadMesh but for now has a different name.

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 1133 #===============================================================
24 gross 806
25 phornby 1232 tools_prefix="/usr"
26 gross 806
27 gross 1133 #==============================================================================================
28     #
29 ksteube 1215 # get the installation prefix
30 gross 1133 #
31 phornby 1243 prefix = ARGUMENTS.get('prefix', '/usr')
32 ksteube 1217
33     # We may also need to know where python's site-packages subdirectory lives
34     python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1])
35    
36 phornby 1243 # Install as a standard python package in /usr/lib64 if available, else in /usr/lib
37     if os.path.isdir( prefix+"/lib64/"+python_version+"/site-packages"):
38     sys_dir_packages = prefix+"/lib64/"+python_version+"/site-packages/esys"
39     sys_dir_libraries = prefix+"/lib64"
40 ksteube 1217 else:
41 phornby 1243 sys_dir_packages = prefix+"/lib/"+python_version+"/site-packages/esys"
42     sys_dir_libraries = prefix+"/lib"
43 ksteube 1217
44 phornby 1243 sys_dir_examples = prefix+"/share/doc/esys"
45    
46     source_root = Dir('#.').abspath
47    
48     dir_packages = os.path.join(source_root,"esys")
49     dir_examples = os.path.join(source_root,"examples")
50     dir_libraries = os.path.join(source_root,"lib")
51    
52 ksteube 1312 print "Source root is : ",source_root
53 phornby 1243 print " Default packages local installation: ", dir_packages
54     print " Default library local installation ", dir_libraries
55     print " Default example local installation: ", dir_examples
56 gross 1133 print "Install prefix is: ", prefix
57 phornby 1243 print " Default packages system installation: ", sys_dir_packages
58     print " Default library system installation ", sys_dir_libraries
59     print " Default example system installation: ", sys_dir_examples
60 gross 806
61 ksteube 1217 #==============================================================================================
62    
63 robwdcock 682 # Default options and options help text
64     # These are defaults and can be overridden using command line arguments or an options file.
65     # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
66     # DO NOT CHANGE THEM HERE
67 ksteube 1083 # Where to install?
68 gross 1133 #==============================================================================================
69     #
70     # get the options file if present:
71     #
72 phornby 1246 options_file = ARGUMENTS.get('options_file','')
73    
74     if not os.path.isfile(options_file) :
75     options_file = False
76    
77     if not options_file :
78     import socket
79 ksteube 1250 hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0])
80 phornby 1246 tmp = os.path.join("scons",hostname+"_options.py")
81    
82     if os.path.isfile(tmp) :
83     options_file = tmp
84    
85     IS_WINDOWS_PLATFORM = (os.name== "nt")
86    
87     # 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 gross 1133 # and load it
96     opts = Options(options_file, ARGUMENTS)
97     #================================================================
98     #
99     # check if UMFPACK is installed on the system:
100     #
101 gross 1149 uf_root=None
102     for i in [ 'UMFPACK', 'umfpack', 'ufsparse', 'UFSPARSE']:
103     if os.path.isdir(os.path.join(tools_prefix,'include',i)):
104     uf_root=i
105     print i," is used form ",tools_prefix
106     break
107     if not uf_root==None:
108     umf_path_default=os.path.join(tools_prefix,'include',uf_root)
109     umf_lib_path_default=os.path.join(tools_prefix,'lib')
110     umf_libs_default=['umfpack']
111     amd_path_default=os.path.join(tools_prefix,'include',uf_root)
112     amd_lib_path_default=os.path.join(tools_prefix,'lib')
113     amd_libs_default=['amd']
114     ufc_path_default=os.path.join(tools_prefix,'include',uf_root)
115 gross 1133 else:
116 gross 1149 umf_path_default=None
117     umf_lib_path_default=None
118     umf_libs_default=None
119     amd_path_default=None
120     amd_lib_path_default=None
121     amd_libs_default=None
122     ufc_path_default=None
123     #
124 gross 1133 #==========================================================================
125     #
126     # python installation:
127     #
128 phornby 1232 python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1]))
129     python_lib_path_default=os.path.join(tools_prefix,'lib')
130 phornby 1235 python_lib_default="python%s.%s"%(sys.version_info[0],sys.version_info[1])
131 gross 1149
132 gross 1133 #==========================================================================
133     #
134     # boost installation:
135     #
136 phornby 1232 boost_path_default=os.path.join(tools_prefix,'include')
137 phornby 1235 boost_lib_path_default=os.path.join(tools_prefix,'lib')
138     boost_lib_default=['boost_python']
139 ksteube 1312
140 gross 1133 #==========================================================================
141     #
142     # check if netCDF is installed on the system:
143     #
144 phornby 1232 netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3')
145 ksteube 1312 netCDF_lib_path_default=os.path.join(tools_prefix,'lib')
146 gross 1149
147     if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default):
148     useNetCDF_default='yes'
149     netCDF_libs_default=[ 'netcdf_c++', 'netcdf' ]
150     else:
151     useNetCDF_default='no'
152     netCDF_path_default=None
153     netCDF_lib_path_default=None
154     netCDF_libs_default=None
155    
156 gross 1133 #==========================================================================
157     #
158 ksteube 1312 # 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 gross 1133 # compile:
177     #
178 ksteube 1312 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'
180 phornby 1232 cxx_flags_default='--no-warn -ansi'
181     cxx_flags_debug_default='--no-warn -ansi -DDOASSERT'
182 ksteube 1312
183 gross 1133 #==============================================================================================
184     # Default options and options help text
185     # These are defaults and can be overridden using command line arguments or an options file.
186     # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
187     # DO NOT CHANGE THEM HERE
188 robwdcock 682 opts.AddOptions(
189     # Where to install esys stuff
190 ksteube 1217 ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),
191     ('libinstall', 'where the esys libraries will be installed', dir_libraries),
192     ('pyinstall', 'where the esys python modules will be installed', dir_packages),
193     ('exinstall', 'where the esys examples will be installed', dir_examples),
194 phornby 1243 ('sys_libinstall', 'where the system esys libraries will be installed', sys_dir_libraries),
195     ('sys_pyinstall', 'where the system esys python modules will be installed', sys_dir_packages),
196     ('sys_exinstall', 'where the system esys examples will be installed', sys_dir_examples),
197 ksteube 1217 ('src_zipfile', 'the source zip file will be installed.', Dir('#.').abspath+"/release/escript_src.zip"),
198     ('test_zipfile', 'the test zip file will be installed.', Dir('#.').abspath+"/release/escript_tests.zip"),
199     ('src_tarfile', 'the source tar file will be installed.', Dir('#.').abspath+"/release/escript_src.tar.gz"),
200     ('test_tarfile', 'the test tar file will be installed.', Dir('#.').abspath+"/release/escript_tests.tar.gz"),
201     ('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"),
202     ('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"),
203     ('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"),
204     ('api_epydoc', 'name of the epydoc api docs directory', Dir('#.').abspath+"/release/doc/epydoc"),
205     ('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"),
206 ksteube 1215 ('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"),
207 robwdcock 682 # Compilation options
208 gross 700 BoolOption('dodebug', 'Do you want a debug build?', 'no'),
209 ksteube 1312 BoolOption('bounds_check', 'Do you want extra array bounds checking?', 'no'),
210 gross 1133 ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/<hostname>_options.py)", options_file),
211 robwdcock 682 ('cc_defines','C/C++ defines to use', None),
212 gross 1133 ('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),
214     ('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),
216 ksteube 1312 ('omp_flags', 'OpenMP compiler flags to use (Release build)', ''),
217     ('omp_flags_debug', 'OpenMP compiler flags to use (Debug build)', ''),
218 robwdcock 682 ('ar_flags', 'Static library archiver flags to use', None),
219     ('sys_libs', 'System libraries to link with', None),
220 gross 700 ('tar_flags','flags for zip files','-c -z'),
221 robwdcock 682 # MKL
222 matt 863 PathOption('mkl_path', 'Path to MKL includes', None),
223     PathOption('mkl_lib_path', 'Path to MKL libs', None),
224 robwdcock 682 ('mkl_libs', 'MKL libraries to link with', None),
225     # SCSL
226 matt 863 PathOption('scsl_path', 'Path to SCSL includes', None),
227     PathOption('scsl_lib_path', 'Path to SCSL libs', None),
228 robwdcock 682 ('scsl_libs', 'SCSL libraries to link with', None),
229 bcumming 759 ('scsl_libs_MPI', 'SCSL libraries to link with for MPI build', None),
230 matt 863 # UMFPACK
231     PathOption('ufc_path', 'Path to UFconfig includes', ufc_path_default),
232     PathOption('umf_path', 'Path to UMFPACK includes', umf_path_default),
233     PathOption('umf_lib_path', 'Path to UMFPACK libs', umf_lib_path_default),
234 gross 806 ('umf_libs', 'UMFPACK libraries to link with', umf_libs_default),
235     # AMD (used by UMFPACK)
236 matt 863 PathOption('amd_path', 'Path to AMD includes', amd_path_default),
237     PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default),
238 gross 806 ('amd_libs', 'AMD libraries to link with', amd_libs_default),
239 ksteube 1312 # 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 gross 805 # BLAS
244 matt 863 PathOption('blas_path', 'Path to BLAS includes', None),
245     PathOption('blas_lib_path', 'Path to BLAS libs', None),
246 gross 806 ('blas_libs', 'BLAS libraries to link with', None),
247 gross 950 # netCDF
248 gross 1133 ('useNetCDF', 'switch on/off the usage of netCDF', useNetCDF_default),
249 gross 1028 PathOption('netCDF_path', 'Path to netCDF includes', netCDF_path_default),
250     PathOption('netCDF_lib_path', 'Path to netCDF libs', netCDF_lib_path_default),
251 gross 1133 ('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default),
252 robwdcock 682 # Python
253 gross 685 # locations of include files for python
254 phornby 1243 # FIXME: python_path should be python_inc_path and the same for boost etc.
255 gross 1133 PathOption('python_path', 'Path to Python includes', python_path_default),
256     PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default),
257 phornby 1235 ('python_lib', 'Python libraries to link with', python_lib_default),
258 phornby 1243 ('python_cmd', 'Python command', 'python'),
259 robwdcock 682 # Boost
260 gross 1133 PathOption('boost_path', 'Path to Boost includes', boost_path_default),
261 phornby 1235 PathOption('boost_lib_path', 'Path to Boost libs', boost_lib_path_default),
262     ('boost_lib', 'Boost libraries to link with', boost_lib_default),
263 robwdcock 682 # Doc building
264 ksteube 1216 # PathOption('doxygen_path', 'Path to Doxygen executable', None),
265 matt 863 # PathOption('epydoc_path', 'Path to Epydoc executable', None),
266 robwdcock 682 # PAPI
267 matt 863 PathOption('papi_path', 'Path to PAPI includes', None),
268     PathOption('papi_lib_path', 'Path to PAPI libs', None),
269 robwdcock 682 ('papi_libs', 'PAPI libraries to link with', None),
270 ksteube 1312 ('papi_instrument_solver', 'use PAPI in Solver.c to instrument each iteration of the solver', None),
271 bcumming 759 # MPI
272 ksteube 1312 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 robwdcock 682 )
279 gross 1133 #=================================================================================================
280     #
281     # Note: On the Altix the intel compilers are not automatically
282     # detected by scons intelc.py script. The Altix has a different directory
283     # path and in some locations the "modules" facility is used to support
284     # multiple compiler versions. This forces the need to import the users PATH
285     # environment which isn't the "scons way"
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)
287     # FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix
288     #
289 phornby 1232
290 gross 1133 if IS_WINDOWS_PLATFORM:
291     env = Environment(tools = ['default', 'msvc'], options = opts)
292 robwdcock 682 else:
293 gross 1133 if os.uname()[4]=='ia64':
294     env = Environment(tools = ['default', 'intelc'], options = opts)
295     if env['CXX'] == 'icpc':
296     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
297     else:
298     env = Environment(tools = ['default'], options = opts)
299     Help(opts.GenerateHelpText(env))
300 phornby 1232
301 ksteube 1312 if env['bounds_check']:
302     env.Append(CPPDEFINES = [ 'BOUNDS_CHECK' ])
303     env.Append(CXXDEFINES = [ 'BOUNDS_CHECK' ])
304 ksteube 1348 bounds_check = env['bounds_check']
305     else:
306     bounds_check = 0
307 ksteube 1312
308 gross 1133 #=================================================================================================
309     #
310     # Initialise Scons Build Environment
311     # check for user environment variables we are interested in
312 gross 1024 try:
313 phornby 1243 tmp = os.environ['PYTHONPATH']
314     env['ENV']['PYTHONPATH'] = tmp
315 gross 1024 except KeyError:
316 phornby 1243 pass
317 gross 1024
318 phornby 1243 env.PrependENVPath('PYTHONPATH', source_root)
319    
320 gross 1024 try:
321 gross 1160 omp_num_threads = os.environ['OMP_NUM_THREADS']
322     except KeyError:
323     omp_num_threads = 1
324 ksteube 1312 env['ENV']['OMP_NUM_THREADS'] = omp_num_threads
325 phornby 1243
326 ksteube 1312 try:
327     path = os.environ['PATH']
328     env['ENV']['PATH'] = path
329     except KeyError:
330     omp_num_threads = 1
331    
332 gross 1160 env['ENV']['OMP_NUM_THREADS'] = omp_num_threads
333    
334 ksteube 1312
335     # Copy some variables from the system environment to the build environment
336 gross 1160 try:
337 gross 1163 env['ENV']['DISPLAY'] = os.environ['DISPLAY']
338 jongui 1164 env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY']
339 ksteube 1312 home_temp = os.environ['HOME'] # MPICH2's mpd needs $HOME to find $HOME/.mpd.conf
340     env['ENV']['HOME'] = home_temp
341 gross 1163 except KeyError:
342     pass
343    
344     try:
345 phornby 1243 tmp = os.environ['PATH']
346     env['ENV']['PATH'] = tmp
347 gross 1024 except KeyError:
348 phornby 1243 pass
349    
350 gross 1024 try:
351 phornby 1243 tmp = os.environ['LD_LIBRARY_PATH']
352     env['ENV']['LD_LIBRARY_PATH'] = tmp
353 gross 1024 except KeyError:
354 phornby 1243 pass
355 gross 1133 #==========================================================================
356     #
357     # Add some customer builders
358     #
359 robwdcock 682 py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
360     env.Append(BUILDERS = {'PyCompile' : py_builder});
361    
362 phornby 1244 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed',
363     src_suffix=env['PROGSUFFIX'], single_source=True)
364    
365 robwdcock 682 env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
366    
367     runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
368     env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
369    
370     # Convert the options which are held in environment variable into python variables for ease of handling and configure compilation options
371     try:
372     incinstall = env['incinstall']
373     env.Append(CPPPATH = [incinstall,])
374     except KeyError:
375 matt 863 incinstall = None
376 robwdcock 682 try:
377     libinstall = env['libinstall']
378 ksteube 1215 env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so
379 robwdcock 682 env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
380 phornby 1248 if IS_WINDOWS_PLATFORM :
381 woo409 757 env.PrependENVPath('PATH', libinstall)
382 ksteube 1312 env.PrependENVPath('PATH', env['boost_lib_path'])
383 robwdcock 682 except KeyError:
384 matt 863 libinstall = None
385 robwdcock 682 try:
386 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
387 robwdcock 682 except KeyError:
388 matt 863 pyinstall = None
389 ksteube 1312
390 robwdcock 682 try:
391 ksteube 1312 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:
412 ksteube 1217 exinstall = env['exinstall']
413     except KeyError:
414     exinstall = None
415     try:
416 phornby 1243 sys_libinstall = env['sys_libinstall']
417     except KeyError:
418     sys_libinstall = None
419     try:
420     sys_pyinstall = env['sys_pyinstall']
421     except KeyError:
422     sys_pyinstall = None
423     try:
424     sys_exinstall = env['sys_exinstall']
425     except KeyError:
426     sys_exinstall = None
427 ksteube 1312
428     # ====================== debugging ===================================
429 phornby 1243 try:
430 robwdcock 682 dodebug = env['dodebug']
431     except KeyError:
432 matt 863 dodebug = None
433 ksteube 1312
434     # === switch on omp ===================================================
435 robwdcock 682 try:
436 ksteube 1312 omp_flags = env['omp_flags']
437 bcumming 759 except KeyError:
438 ksteube 1312 omp_flags = ''
439    
440 bcumming 759 try:
441 ksteube 1312 omp_flags_debug = env['omp_flags_debug']
442 robwdcock 682 except KeyError:
443 ksteube 1312 omp_flags_debug = ''
444 ksteube 817
445 ksteube 1312 # ========= use mpi? =====================================================
446     try:
447     useMPI = env['useMPI']
448     except KeyError:
449     useMPI = None
450     # ========= set compiler flags ===========================================
451 phornby 1246
452 ksteube 1348 # Can't use MPI and OpenMP simultaneously at this time
453     if useMPI:
454     omp_flags=''
455     omp_flags_debug=''
456    
457 robwdcock 682 if dodebug:
458 bcumming 759 try:
459 ksteube 1312 flags = env['cc_flags_debug'] + ' ' + omp_flags_debug
460 bcumming 759 env.Append(CCFLAGS = flags)
461     except KeyError:
462     pass
463 robwdcock 682 else:
464     try:
465 ksteube 1312 flags = env['cc_flags'] + ' ' + omp_flags
466 robwdcock 682 env.Append(CCFLAGS = flags)
467     except KeyError:
468     pass
469     if dodebug:
470 bcumming 759 try:
471     flags = env['cxx_flags_debug']
472     env.Append(CXXFLAGS = flags)
473     except KeyError:
474     pass
475 robwdcock 682 else:
476 bcumming 759 try:
477     flags = env['cxx_flags']
478     env.Append(CXXFLAGS = flags)
479     except KeyError:
480     pass
481 robwdcock 682 try:
482 ksteube 1312 if env['CC'] == 'gcc': env.Append(CCFLAGS = "-pedantic-errors -Wno-long-long")
483     except:
484     pass
485 robwdcock 682
486 ksteube 1348 # ============= Remember what options were used in the compile =====================================
487 ksteube 1360 if not IS_WINDOWS_PLATFORM:
488     env.Execute("/bin/rm -f " + libinstall + "/Compiled.with.*")
489     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 ksteube 1348
494 ksteube 1312 # ============= set mkl (but only of no MPI) =====================================
495     if not useMPI:
496     try:
497     includes = env['mkl_path']
498     env.Append(CPPPATH = [includes,])
499     except KeyError:
500     pass
501 gross 700
502 ksteube 1312 try:
503     lib_path = env['mkl_lib_path']
504     env.Append(LIBPATH = [lib_path,])
505     except KeyError:
506     pass
507 gross 700
508 gross 806 try:
509     mkl_libs = env['mkl_libs']
510     except KeyError:
511 gross 1133 mkl_libs = []
512 ksteube 1312 else:
513     mkl_libs = []
514 gross 806
515 ksteube 1312 # ============= set scsl (but only of no MPI) =====================================
516     if not useMPI:
517     try:
518     includes = env['scsl_path']
519     env.Append(CPPPATH = [includes,])
520     except KeyError:
521     pass
522 gross 806
523 ksteube 1312 try:
524     lib_path = env['scsl_lib_path']
525     env.Append(LIBPATH = [lib_path,])
526     except KeyError:
527     pass
528    
529     try:
530     scsl_libs = env['scsl_libs']
531     except KeyError:
532     scsl_libs = [ ]
533 gross 806
534 matt 863 else:
535 ksteube 1312 scsl_libs = []
536 gross 805
537 ksteube 1312 # ============= set TRILINOS (but only with MPI) =====================================
538     if useMPI:
539     try:
540     includes = env['trilinos_path']
541     env.Append(CPPPATH = [includes,])
542     except KeyError:
543     pass
544 gross 805
545 ksteube 1312 try:
546     lib_path = env['trilinos_lib_path']
547     env.Append(LIBPATH = [lib_path,])
548     except KeyError:
549     pass
550 gross 805
551 ksteube 1312 try:
552     trilinos_libs = env['trilinos_libs']
553     except KeyError:
554     trilinos_libs = []
555 gross 806 else:
556 ksteube 1312 trilinos_libs = []
557    
558    
559     # ============= set umfpack (but only without MPI) =====================================
560     umf_libs=[ ]
561     if not useMPI:
562 gross 806 try:
563 ksteube 1312 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:
575 gross 806 umf_libs = env['umf_libs']
576 ksteube 1312 umf_libs+=umf_libs
577 gross 806 except KeyError:
578 ksteube 1312 pass
579 gross 806
580 ksteube 1312 try:
581     includes = env['ufc_path']
582     env.Append(CPPPATH = [includes,])
583     except KeyError:
584     pass
585 gross 805
586 ksteube 1312 try:
587     includes = env['amd_path']
588     env.Append(CPPPATH = [includes,])
589     except KeyError:
590     pass
591 gross 805
592 ksteube 1312 try:
593     lib_path = env['amd_lib_path']
594     env.Append(LIBPATH = [lib_path,])
595     except KeyError:
596     pass
597 gross 806
598     try:
599     amd_libs = env['amd_libs']
600 ksteube 1312 umf_libs+=amd_libs
601 gross 806 except KeyError:
602 ksteube 1312 pass
603 gross 806
604 ksteube 1312 # ============= 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:
616     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 gross 806 try:
627 gross 805 includes = env['blas_path']
628     env.Append(CPPPATH = [includes,])
629     except KeyError:
630     pass
631 gross 806
632 gross 805 try:
633     lib_path = env['blas_lib_path']
634     env.Append(LIBPATH = [lib_path,])
635     except KeyError:
636     pass
637 gross 806
638 gross 805 try:
639     blas_libs = env['blas_libs']
640     except KeyError:
641 ksteube 1312 blas_libs = [ ]
642 gross 805
643 ksteube 1343 # ========== netcdf ====================================
644     try:
645     useNetCDF = env['useNetCDF']
646     except KeyError:
647     useNetCDF = 'yes'
648     pass
649 ksteube 1312
650 gross 1023 if useNetCDF == 'yes':
651     try:
652 phornby 1246 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 gross 1023 includes = env['netCDF_path']
660     env.Append(CPPPATH = [includes,])
661     except KeyError:
662     pass
663 gross 950
664 gross 1023 try:
665     lib_path = env['netCDF_lib_path']
666 gross 1133 env.Append(LIBPATH = [ lib_path, ])
667 phornby 1248 if IS_WINDOWS_PLATFORM :
668     env.PrependENVPath('PATH', lib_path)
669 gross 1023 except KeyError:
670     pass
671     else:
672 phornby 1246 print "Warning: Installation is not configured with netCDF. Some I/O function may not be available."
673 gross 1133 netCDF_libs=[ ]
674 gross 1023
675 ksteube 1312 # ====================== boost ======================================
676 gross 950 try:
677 robwdcock 682 includes = env['boost_path']
678     env.Append(CPPPATH = [includes,])
679     except KeyError:
680     pass
681     try:
682 phornby 1235 lib_path = env['boost_lib_path']
683 robwdcock 682 env.Append(LIBPATH = [lib_path,])
684 phornby 1248 if IS_WINDOWS_PLATFORM :
685     env.PrependENVPath('PATH', lib_path)
686 robwdcock 682 except KeyError:
687     pass
688     try:
689 phornby 1235 boost_lib = env['boost_lib']
690 robwdcock 682 except KeyError:
691 phornby 1235 boost_lib = None
692 ksteube 1312 # ====================== python ======================================
693 robwdcock 682 try:
694     includes = env['python_path']
695     env.Append(CPPPATH = [includes,])
696     except KeyError:
697     pass
698     try:
699     lib_path = env['python_lib_path']
700     env.Append(LIBPATH = [lib_path,])
701     except KeyError:
702     pass
703     try:
704 phornby 1235 python_lib = env['python_lib']
705 robwdcock 682 except KeyError:
706 phornby 1235 python_lib = None
707 ksteube 1312 # =============== documentation =======================================
708 robwdcock 682 try:
709     doxygen_path = env['doxygen_path']
710     except KeyError:
711 matt 863 doxygen_path = None
712 robwdcock 682 try:
713     epydoc_path = env['epydoc_path']
714     except KeyError:
715 matt 863 epydoc_path = None
716 ksteube 1312 # =============== PAPI =======================================
717 robwdcock 682 try:
718     includes = env['papi_path']
719     env.Append(CPPPATH = [includes,])
720     except KeyError:
721     pass
722     try:
723     lib_path = env['papi_lib_path']
724     env.Append(LIBPATH = [lib_path,])
725     except KeyError:
726     pass
727     try:
728     papi_libs = env['papi_libs']
729     except KeyError:
730 matt 863 papi_libs = None
731 ksteube 1312 # ============= 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 robwdcock 682
750 ksteube 1312 try:
751     mpi_run = env['mpi_run']
752     except KeyError:
753     mpi_run = ''
754 gross 707
755 ksteube 1312 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 gross 700 try:
765 ksteube 1312 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:
794 gross 707 src_zipfile = env.File(env['src_zipfile'])
795 gross 700 except KeyError:
796 matt 863 src_zipfile = None
797 gross 700 try:
798 gross 707 test_zipfile = env.File(env['test_zipfile'])
799 gross 700 except KeyError:
800 matt 863 test_zipfile = None
801 gross 707 try:
802     examples_zipfile = env.File(env['examples_zipfile'])
803     except KeyError:
804 matt 863 examples_zipfile = None
805 gross 700
806     try:
807 gross 707 src_tarfile = env.File(env['src_tarfile'])
808 gross 700 except KeyError:
809 matt 863 src_tarfile = None
810 gross 700 try:
811 gross 707 test_tarfile = env.File(env['test_tarfile'])
812 gross 700 except KeyError:
813 matt 863 test_tarfile = None
814 gross 707 try:
815     examples_tarfile = env.File(env['examples_tarfile'])
816     except KeyError:
817 matt 863 examples_tarfile = None
818 gross 700
819     try:
820 gross 707 guide_pdf = env.File(env['guide_pdf'])
821 gross 700 except KeyError:
822 matt 863 guide_pdf = None
823 gross 700
824 gross 707 try:
825     guide_html_index = env.File('index.htm',env['guide_html'])
826     except KeyError:
827 matt 863 guide_html_index = None
828 gross 707
829 elspeth 712 try:
830     api_epydoc = env.Dir(env['api_epydoc'])
831     except KeyError:
832 matt 863 api_epydoc = None
833 elspeth 712
834 ksteube 1215 try:
835     api_doxygen = env.Dir(env['api_doxygen'])
836     except KeyError:
837     api_doxygen = None
838    
839 ksteube 1247 try:
840 ksteube 1312 svn_pipe = os.popen("svnversion -n .")
841 ksteube 1250 global_revision = svn_pipe.readlines()
842 ksteube 1247 svn_pipe.close()
843 ksteube 1324 global_revision = re.sub(":.*", "", global_revision[0])
844     global_revision = re.sub("[^0-9]", "", global_revision)
845 ksteube 1247 except:
846 ksteube 1250 global_revision = "0"
847 ksteube 1312 env.Append(CPPDEFINES = "SVN_VERSION="+global_revision)
848 ksteube 1247
849 phornby 1246 # Python install - esys __init__.py
850     init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET'))
851 phornby 1243
852     # FIXME: exinstall and friends related to examples are not working.
853 phornby 1246 build_target = env.Alias('build',[libinstall,incinstall,pyinstall,init_target])
854 phornby 1243
855     env.Default(build_target)
856    
857 gross 700 # Zipgets
858 matt 863 env.Alias('release_src',[ src_zipfile, src_tarfile ])
859 gross 700 env.Alias('release_tests',[ test_zipfile, test_tarfile])
860 gross 707 env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
861 ksteube 1215 env.Alias('examples_zipfile',examples_zipfile)
862     env.Alias('examples_tarfile',examples_tarfile)
863 gross 720 env.Alias('api_epydoc',api_epydoc)
864 ksteube 1215 env.Alias('api_doxygen',api_doxygen)
865     env.Alias('guide_html_index',guide_html_index)
866 gross 807 env.Alias('guide_pdf', guide_pdf)
867 ksteube 1216 env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index])
868 gross 707 env.Alias('release', ['release_src', 'release_tests', 'docs'])
869 phornby 1243
870 phornby 1246 env.Alias('build_tests',build_target) # target to build all C++ tests
871     env.Alias('build_py_tests',build_target) # target to build all python tests
872 gross 706 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
874     env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests
875 gross 705 env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests
876 robwdcock 682
877    
878     # Allow sconscripts to see the env
879 ksteube 1312 Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "blas_libs", "netCDF_libs", "useNetCDF", "mpi_run",
880 phornby 1235 "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs",
881 ksteube 1312 "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" ])
883 robwdcock 682
884     # End initialisation section
885     # Begin configuration section
886 gross 700 # adds this file and the scons option directore to the source tar
887 ksteube 1339 release_srcfiles=[env.File('SConstruct'),env.Dir('lib'),env.Dir('include'),]+[ env.File(x) for x in glob.glob('scons/*.py') ]
888 gross 700 release_testfiles=[env.File('README_TESTS'),]
889 gross 706 env.Zip(src_zipfile, release_srcfiles)
890 gross 700 env.Zip(test_zipfile, release_testfiles)
891 gross 1133 try:
892     env.Tar(src_tarfile, release_srcfiles)
893     env.Tar(test_tarfile, release_testfiles)
894     except AttributeError:
895     pass
896 robwdcock 682 # Insert new components to be build here
897     # FIXME: might be nice to replace this verbosity with a list of targets and some
898     # FIXME: nifty python to create the lengthy but very similar env.Sconscript lines
899     # Third Party libraries
900     env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
901     # C/C++ Libraries
902     env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
903 gross 958 # bruce is removed for now as it doesn't really do anything
904     # env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
905 robwdcock 682 env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
906     env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
907     env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
908     env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)
909 gross 707 env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
910 matt 863 env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)
911 gross 898 env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0)
912 matt 863 env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
913 bcumming 784 #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)
914 phornby 1243
915    
916     syslib_install_target = env.installDirectory(sys_libinstall,libinstall)
917     syspy_install_target = env.installDirectory(sys_pyinstall,pyinstall,recursive=True)
918    
919     install_target = env.Alias("install", env.Flatten([syslib_install_target, syspy_install_target]) )

  ViewVC Help
Powered by ViewVC 1.1.26