/[escript]/trunk-mpi-branch/SConstruct
ViewVC logotype

Contents of /trunk-mpi-branch/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1295 - (show annotations)
Mon Sep 10 06:07:09 2007 UTC (11 years, 7 months ago) by ksteube
File size: 30547 byte(s)
Have now merged latest trunk features into MPI branch in preparation for
ending the MPI branch.
Compiles but has run time problems in bandwith reduction.

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

  ViewVC Help
Powered by ViewVC 1.1.26