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

Contents of /trunk-mpi-branch/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1236 - (show annotations)
Mon Aug 13 00:50:29 2007 UTC (11 years, 11 months ago) by ksteube
File size: 28596 byte(s)
Changes to be consistent with some naming conventions used in the main branch.

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

  ViewVC Help
Powered by ViewVC 1.1.26