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

Annotation of /branches/schroedinger_upto1946/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 762 - (hide annotations)
Fri Jun 30 00:09:19 2006 UTC (12 years ago) by bcumming
Original Path: trunk/SConstruct
File size: 16547 byte(s)
- small change to SConstruct to remove my testing code

1 elspeth 643 # 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 jgs 214 #
9 elspeth 643 #
10 jgs 455
11 robwdcock 682 # top-level Scons configuration file for all esys13 modules
12     # Begin initialisation Section
13     # all of this section just intialises default environments and helper
14     # scripts. You shouldn't need to modify this section.
15     EnsureSConsVersion(0,96,91)
16     EnsurePythonVersion(2,3)
17 jgs 214
18 gross 700 # import tools:
19     import glob
20 robwdcock 682 import sys, os
21     # Add our extensions
22     if sys.path.count('scons')==0: sys.path.append('scons')
23     import scons_extensions
24 jgs 192
25 robwdcock 682 # Default options and options help text
26     # These are defaults and can be overridden using command line arguments or an options file.
27     # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
28     # DO NOT CHANGE THEM HERE
29     if ARGUMENTS.get('options_file',0):
30     options_file = ARGUMENTS.get('options_file',0)
31     else:
32     import socket
33     from string import ascii_letters,digits
34     hostname=""
35     for s in socket.gethostname().split('.')[0]:
36     if s in ascii_letters+digits:
37     hostname+=s
38     else:
39     hostname+="_"
40     options_file = "scons/"+hostname+"_options.py"
41 jgs 214
42 robwdcock 682 opts = Options(options_file, ARGUMENTS)
43     opts.AddOptions(
44     # Where to install esys stuff
45     ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),
46     ('libinstall', 'where the esys libraries will be installed', Dir('#.').abspath+'/lib'),
47     ('pyinstall', 'where the esys python modules will be installed', Dir('#.').abspath),
48 gross 700 ('src_zipfile', 'the source zip file will be installed.', Dir('#.').abspath+"/release/escript_src.zip"),
49 gross 707 ('test_zipfile', 'the test zip file will be installed.', Dir('#.').abspath+"/release/escript_tests.zip"),
50 gross 700 ('src_tarfile', 'the source tar file will be installed.', Dir('#.').abspath+"/release/escript_src.tar.gz"),
51 gross 707 ('test_tarfile', 'the test tar file will be installed.', Dir('#.').abspath+"/release/escript_tests.tar.gz"),
52     ('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"),
53     ('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"),
54     ('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"),
55 elspeth 712 ('api_epydoc', 'name of the epydoc api docs directory',Dir('#.').abspath+"/release/doc/epydoc"),
56 gross 707 ('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"),
57 robwdcock 682 # Compilation options
58 gross 700 BoolOption('dodebug', 'Do you want a debug build?', 'no'),
59 robwdcock 682 ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/hostname_options.py)", options_file),
60     ('cc_defines','C/C++ defines to use', None),
61 gross 700 ('cc_flags','C compiler flags to use (Release build)', '-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas'),
62     ('cc_flags_debug', 'C compiler flags to use (Debug build)', '-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas'),
63     ('cxx_flags', 'C++ compiler flags to use (Release build)', '--no-warn -ansi'),
64     ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', '--no-warn -ansi -DDOASSERT -DDOPROF'),
65 bcumming 759 ('cc_flags_MPI','C compiler flags to use (Release MPI build)', '-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias -fno-alias -c99 -w1 -fpic -wd161'),
66     ('cc_flags_debug_MPI', 'C compiler flags to use (Debug MPI build)', '-g -O0 -c99 -w1 -fpic -wd161'),
67     ('cxx_flags_MPI', 'C++ compiler flags to use (Release MPI build)', '-ansi -wd1563 -wd161'),
68     ('cxx_flags_debug_MPI', 'C++ compiler flags to use (Debug MPI build)', '-ansi -DDOASSERT -DDOPROF -wd1563 -wd161'),
69 robwdcock 682 ('ar_flags', 'Static library archiver flags to use', None),
70     ('sys_libs', 'System libraries to link with', None),
71 gross 700 ('tar_flags','flags for zip files','-c -z'),
72 robwdcock 682 # MKL
73     PathOption('mkl_path', 'Path to MKL includes', None),
74     PathOption('mkl_lib_path', 'Path to MKL libs', None),
75     ('mkl_libs', 'MKL libraries to link with', None),
76     # SCSL
77     PathOption('scsl_path', 'Path to SCSL includes', None),
78     PathOption('scsl_lib_path', 'Path to SCSL libs', None),
79     ('scsl_libs', 'SCSL libraries to link with', None),
80 bcumming 759 ('scsl_libs_MPI', 'SCSL libraries to link with for MPI build', None),
81 robwdcock 682 # UMFPACK
82     PathOption('umf_path', 'Path to UMF includes', None),
83     PathOption('umf_lib_path', 'Path to UMF libs', None),
84     ('umf_libs', 'UMF libraries to link with', None),
85     # Python
86 gross 685 # locations of include files for python
87     PathOption('python_path', 'Path to Python includes', '/usr/include/python%s.%s'%(sys.version_info[0],sys.version_info[1])),
88 robwdcock 682 PathOption('python_lib_path', 'Path to Python libs', '/usr/lib'),
89 gross 685 ('python_lib', 'Python libraries to link with', ["python%s.%s"%(sys.version_info[0],sys.version_info[1]),]),
90 robwdcock 682 # Boost
91     PathOption('boost_path', 'Path to Boost includes', '/usr/include'),
92     PathOption('boost_lib_path', 'Path to Boost libs', '/usr/lib'),
93     ('boost_lib', 'Boost libraries to link with', ['boost_python',]),
94     # Doc building
95 gross 722 # PathOption('doxygen_path', 'Path to Doxygen executable', None),
96     # PathOption('epydoc_path', 'Path to Epydoc executable', None),
97 robwdcock 682 # PAPI
98     PathOption('papi_path', 'Path to PAPI includes', None),
99     PathOption('papi_lib_path', 'Path to PAPI libs', None),
100     ('papi_libs', 'PAPI libraries to link with', None),
101 bcumming 759 # MPI
102     BoolOption('useMPI', 'Compile parallel version using MPI', 'no'),
103 robwdcock 682 )
104    
105     # Initialise Scons Build Environment
106     # check for user environment variables we are interested in
107     try:
108     python_path = os.environ['PYTHONPATH']
109     except KeyError:
110     python_path = ''
111     try:
112     path = os.environ['PATH']
113     except KeyError:
114     path = ''
115     try:
116     ld_library_path = os.environ['LD_LIBRARY_PATH']
117     except KeyError:
118     ld_library_path = ''
119    
120     # Note: On the Altix the intel compilers are not automatically
121     # detected by scons intelc.py script. The Altix has a different directory
122     # path and in some locations the "modules" facility is used to support
123     # multiple compiler versions. This forces the need to import the users PATH
124     # environment which isn't the "scons way"
125     # 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)
126     # FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix
127    
128     if os.name != "nt" and os.uname()[4]=='ia64':
129 robwdcock 688 env = Environment(ENV = {'PATH':path}, tools = ['default', 'intelc'], options = opts)
130 robwdcock 684 env['ENV']['PATH'] = path
131     env['ENV']['LD_LIBRARY_PATH'] = ld_library_path
132     env['ENV']['PYTHONPATH'] = python_path
133 robwdcock 682 if env['CXX'] == 'icpc':
134     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
135     elif os.name == "nt":
136 robwdcock 684 env = Environment(tools = ['default', 'intelc'], options = opts)
137     env['ENV']['PYTHONPATH'] = python_path
138 robwdcock 682 else:
139 robwdcock 684 env = Environment(tools = ['default'], options = opts)
140     env['ENV']['PATH'] = path
141     env['ENV']['LD_LIBRARY_PATH'] = ld_library_path
142     env['ENV']['PYTHONPATH'] = python_path
143 robwdcock 682
144     # Setup help for options
145     Help(opts.GenerateHelpText(env))
146    
147     # Add some customer builders
148     py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
149     env.Append(BUILDERS = {'PyCompile' : py_builder});
150    
151     if env['PLATFORM'] == "win32":
152     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
153     else:
154     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)
155     env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
156    
157     runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
158     env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
159    
160     # Convert the options which are held in environment variable into python variables for ease of handling and configure compilation options
161     try:
162     incinstall = env['incinstall']
163     env.Append(CPPPATH = [incinstall,])
164     except KeyError:
165     incinstall = None
166     try:
167     libinstall = env['libinstall']
168     env.Append(LIBPATH = [libinstall,])
169     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
170 woo409 757 if env['PLATFORM'] == "win32":
171     env.PrependENVPath('PATH', libinstall)
172     env.PrependENVPath('PATH', env['boost_lib_path'])
173 robwdcock 682 except KeyError:
174     libinstall = None
175     try:
176     pyinstall = env['pyinstall']+'/esys' # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
177     env.PrependENVPath('PYTHONPATH', env['pyinstall'])
178     except KeyError:
179     pyinstall = None
180     try:
181     dodebug = env['dodebug']
182     except KeyError:
183     dodebug = None
184     try:
185 bcumming 759 useMPI = env['useMPI']
186     except KeyError:
187     useMPI = None
188     try:
189 robwdcock 682 cc_defines = env['cc_defines']
190 woo409 757 env.Append(CPPDEFINES = cc_defines)
191 robwdcock 682 except KeyError:
192     pass
193     if dodebug:
194 bcumming 759 if useMPI:
195     try:
196     flags = env['cc_flags_debug_MPI']
197     env.Append(CCFLAGS = flags)
198     except KeyError:
199     pass
200     else:
201     try:
202 robwdcock 682 flags = env['cc_flags_debug']
203     env.Append(CCFLAGS = flags)
204 bcumming 759 except KeyError:
205 robwdcock 682 pass
206     else:
207 bcumming 759 if useMPI:
208 robwdcock 682 try:
209 bcumming 759 flags = env['cc_flags_MPI']
210     env.Append(CCFLAGS = flags)
211     except KeyError:
212     pass
213     else:
214     try:
215 robwdcock 682 flags = env['cc_flags']
216     env.Append(CCFLAGS = flags)
217     except KeyError:
218     pass
219     if dodebug:
220 bcumming 759 if useMPI:
221     try:
222     flags = env['cxx_flags_debug_MPI']
223     env.Append(CXXFLAGS = flags)
224     except KeyError:
225     pass
226     else:
227     try:
228     flags = env['cxx_flags_debug']
229     env.Append(CXXFLAGS = flags)
230     except KeyError:
231     pass
232 robwdcock 682 else:
233 bcumming 759 if useMPI:
234     try:
235     flags = env['cxx_flags_MPI']
236     env.Append(CXXFLAGS = flags)
237     except KeyError:
238     pass
239     else:
240     try:
241     flags = env['cxx_flags']
242     env.Append(CXXFLAGS = flags)
243     except KeyError:
244     pass
245 robwdcock 682 try:
246     flags = env['ar_flags']
247     env.Append(ARFLAGS = flags)
248     except KeyError:
249     ar_flags = None
250     try:
251     sys_libs = env['sys_libs']
252     except KeyError:
253     sys_libs = ''
254    
255     try:
256 gross 700 tar_flags = env['tar_flags']
257     env.Replace(TARFLAGS = tar_flags)
258     except KeyError:
259     pass
260    
261     try:
262 robwdcock 682 includes = env['mkl_path']
263     env.Append(CPPPATH = [includes,])
264     except KeyError:
265     pass
266 gross 700
267 robwdcock 682 try:
268     lib_path = env['mkl_lib_path']
269     env.Append(LIBPATH = [lib_path,])
270     except KeyError:
271     pass
272 gross 700
273 robwdcock 682 try:
274     mkl_libs = env['mkl_libs']
275     except KeyError:
276     mkl_libs = ''
277     try:
278     includes = env['scsl_path']
279     env.Append(CPPPATH = [includes,])
280     except KeyError:
281     pass
282     try:
283     lib_path = env['scsl_lib_path']
284     env.Append(LIBPATH = [lib_path,])
285     except KeyError:
286     pass
287 bcumming 759 if useMPI:
288     try:
289     scsl_libs = env['scsl_libs_MPI']
290     except KeyError:
291     scsl_libs = ''
292     else:
293     try:
294     scsl_libs = env['scsl_libs']
295     except KeyError:
296     scsl_libs = ''
297 robwdcock 682 try:
298     includes = env['umf_path']
299     env.Append(CPPPATH = [includes,])
300     except KeyError:
301     pass
302     try:
303     lib_path = env['umf_lib_path']
304     env.Append(LIBPATH = [lib_path,])
305     except KeyError:
306     pass
307     try:
308     umf_libs = env['umf_libs']
309     except KeyError:
310     umf_libs = ''
311     try:
312     includes = env['boost_path']
313     env.Append(CPPPATH = [includes,])
314     except KeyError:
315     pass
316     try:
317     lib_path = env['boost_lib_path']
318     env.Append(LIBPATH = [lib_path,])
319     except KeyError:
320     pass
321     try:
322     boost_lib = env['boost_lib']
323     except KeyError:
324     boost_lib = None
325     try:
326     includes = env['python_path']
327     env.Append(CPPPATH = [includes,])
328     except KeyError:
329     pass
330     try:
331     lib_path = env['python_lib_path']
332     env.Append(LIBPATH = [lib_path,])
333     except KeyError:
334     pass
335     try:
336     python_lib = env['python_lib']
337     except KeyError:
338     python_lib = None
339     try:
340     doxygen_path = env['doxygen_path']
341     except KeyError:
342     doxygen_path = None
343     try:
344     epydoc_path = env['epydoc_path']
345     except KeyError:
346     epydoc_path = None
347     try:
348     includes = env['papi_path']
349     env.Append(CPPPATH = [includes,])
350     except KeyError:
351     pass
352     try:
353     lib_path = env['papi_lib_path']
354     env.Append(LIBPATH = [lib_path,])
355     except KeyError:
356     pass
357     try:
358     papi_libs = env['papi_libs']
359     except KeyError:
360     papi_libs = None
361    
362 gross 707
363 gross 700 try:
364 gross 707 src_zipfile = env.File(env['src_zipfile'])
365 gross 700 except KeyError:
366     src_zipfile = None
367     try:
368 gross 707 test_zipfile = env.File(env['test_zipfile'])
369 gross 700 except KeyError:
370     test_zipfile = None
371 gross 707 try:
372     examples_zipfile = env.File(env['examples_zipfile'])
373     except KeyError:
374     examples_zipfile = None
375 gross 700
376     try:
377 gross 707 src_tarfile = env.File(env['src_tarfile'])
378 gross 700 except KeyError:
379     src_tarfile = None
380     try:
381 gross 707 test_tarfile = env.File(env['test_tarfile'])
382 gross 700 except KeyError:
383     test_tarfile = None
384 gross 707 try:
385     examples_tarfile = env.File(env['examples_tarfile'])
386     except KeyError:
387     examples_tarfile = None
388 gross 700
389     try:
390 gross 707 guide_pdf = env.File(env['guide_pdf'])
391 gross 700 except KeyError:
392 gross 707 guide_pdf = None
393 gross 700
394 gross 707 try:
395     guide_html_index = env.File('index.htm',env['guide_html'])
396     except KeyError:
397     guide_html_index = None
398    
399 elspeth 712 try:
400     api_epydoc = env.Dir(env['api_epydoc'])
401     except KeyError:
402     api_epydoc = None
403    
404 gross 700 # Zipgets
405 elspeth 712
406 robwdcock 682 env.Default(libinstall)
407     env.Default(incinstall)
408     env.Default(pyinstall)
409 gross 705 env.Alias('release_src',[ src_zipfile, src_tarfile ])
410 gross 700 env.Alias('release_tests',[ test_zipfile, test_tarfile])
411 gross 707 env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
412 gross 720 env.Alias('api_epydoc',api_epydoc)
413 elspeth 712 env.Alias('docs',[ 'release_examples', guide_pdf, guide_html_index, api_epydoc])
414 gross 707 env.Alias('release', ['release_src', 'release_tests', 'docs'])
415 gross 705 env.Alias('build_tests') # target to build all C++ tests
416     env.Alias('build_py_tests') # target to build all python tests
417 gross 706 env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests
418     env.Alias('run_tests', 'build_tests') # target to run all C++ test
419     env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests
420 gross 705 env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests
421 robwdcock 682
422     # Python install - esys __init__.py
423 woo409 757 init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET'))
424     env.Alias(init_target)
425 robwdcock 682
426     # Allow sconscripts to see the env
427     Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs",
428 gross 722 "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs",
429 gross 707 "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile",
430 bcumming 759 "guide_pdf", "guide_html_index", "api_epydoc", "useMPI"])
431 robwdcock 682
432     # End initialisation section
433     # Begin configuration section
434 gross 700 # adds this file and the scons option directore to the source tar
435     release_srcfiles=[env.File('SConstruct'),]+[ env.File(x) for x in glob.glob('scons/*.py') ]
436     release_testfiles=[env.File('README_TESTS'),]
437 gross 706 env.Zip(src_zipfile, release_srcfiles)
438 gross 700 env.Zip(test_zipfile, release_testfiles)
439     env.Tar(src_tarfile, release_srcfiles)
440     env.Tar(test_tarfile, release_testfiles)
441    
442 robwdcock 682 # Insert new components to be build here
443     # FIXME: might be nice to replace this verbosity with a list of targets and some
444     # FIXME: nifty python to create the lengthy but very similar env.Sconscript lines
445     # Third Party libraries
446     env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
447     # C/C++ Libraries
448     env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
449     env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
450     env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
451     env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
452     env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
453     env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)
454 gross 707 env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
455 gross 720 env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0)
456 bcumming 751
457     # added by Ben Cumming
458     env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0)
459 bcumming 762 #env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0)

  ViewVC Help
Powered by ViewVC 1.1.26