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

Contents of /branches/inv2jf/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1248 - (show annotations)
Tue Aug 14 05:20:39 2007 UTC (11 years, 8 months ago) by phornby
Original Path: trunk/SConstruct
File size: 25552 byte(s)
Prepend various shareable library locations to PATH rather than appending.

Add (empty) include directory to the repository.

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

  ViewVC Help
Powered by ViewVC 1.1.26