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

Annotation of /branches/dirac/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 712 - (hide annotations)
Thu Apr 27 02:08:50 2006 UTC (13 years ago) by elspeth
Original Path: trunk/SConstruct
File size: 15254 byte(s)
Fixed build of epydoc documentation. Now builds html in relase/doc/epydoc .

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 robwdcock 682 ('ar_flags', 'Static library archiver flags to use', None),
66     ('sys_libs', 'System libraries to link with', None),
67 gross 700 ('tar_flags','flags for zip files','-c -z'),
68 robwdcock 682 # MKL
69     PathOption('mkl_path', 'Path to MKL includes', None),
70     PathOption('mkl_lib_path', 'Path to MKL libs', None),
71     ('mkl_libs', 'MKL libraries to link with', None),
72     # SCSL
73     PathOption('scsl_path', 'Path to SCSL includes', None),
74     PathOption('scsl_lib_path', 'Path to SCSL libs', None),
75     ('scsl_libs', 'SCSL libraries to link with', None),
76     # UMFPACK
77     PathOption('umf_path', 'Path to UMF includes', None),
78     PathOption('umf_lib_path', 'Path to UMF libs', None),
79     ('umf_libs', 'UMF libraries to link with', None),
80     # Python
81 gross 685 # locations of include files for python
82     PathOption('python_path', 'Path to Python includes', '/usr/include/python%s.%s'%(sys.version_info[0],sys.version_info[1])),
83 robwdcock 682 PathOption('python_lib_path', 'Path to Python libs', '/usr/lib'),
84 gross 685 ('python_lib', 'Python libraries to link with', ["python%s.%s"%(sys.version_info[0],sys.version_info[1]),]),
85 robwdcock 682 # Boost
86     PathOption('boost_path', 'Path to Boost includes', '/usr/include'),
87     PathOption('boost_lib_path', 'Path to Boost libs', '/usr/lib'),
88     ('boost_lib', 'Boost libraries to link with', ['boost_python',]),
89     # Doc building
90     PathOption('doxygen_path', 'Path to Doxygen executable', None),
91     PathOption('epydoc_path', 'Path to Epydoc executable', None),
92     PathOption('epydoc_pythonpath', 'Path to Epydoc python files', None),
93     # PAPI
94     PathOption('papi_path', 'Path to PAPI includes', None),
95     PathOption('papi_lib_path', 'Path to PAPI libs', None),
96     ('papi_libs', 'PAPI libraries to link with', None),
97     )
98    
99     # Initialise Scons Build Environment
100     # check for user environment variables we are interested in
101     try:
102     python_path = os.environ['PYTHONPATH']
103     except KeyError:
104     python_path = ''
105     try:
106     path = os.environ['PATH']
107     except KeyError:
108     path = ''
109     try:
110     ld_library_path = os.environ['LD_LIBRARY_PATH']
111     except KeyError:
112     ld_library_path = ''
113    
114     # Note: On the Altix the intel compilers are not automatically
115     # detected by scons intelc.py script. The Altix has a different directory
116     # path and in some locations the "modules" facility is used to support
117     # multiple compiler versions. This forces the need to import the users PATH
118     # environment which isn't the "scons way"
119     # 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)
120     # FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix
121    
122     if os.name != "nt" and os.uname()[4]=='ia64':
123 robwdcock 688 env = Environment(ENV = {'PATH':path}, tools = ['default', 'intelc'], options = opts)
124 robwdcock 684 env['ENV']['PATH'] = path
125     env['ENV']['LD_LIBRARY_PATH'] = ld_library_path
126     env['ENV']['PYTHONPATH'] = python_path
127 robwdcock 682 if env['CXX'] == 'icpc':
128     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
129     elif os.name == "nt":
130     # FIXME: Need to implement equivalent of ld library path for windoze
131 robwdcock 684 env = Environment(tools = ['default', 'intelc'], options = opts)
132     env['ENV']['PYTHONPATH'] = python_path
133 robwdcock 682 else:
134 robwdcock 684 env = Environment(tools = ['default'], options = opts)
135     env['ENV']['PATH'] = path
136     env['ENV']['LD_LIBRARY_PATH'] = ld_library_path
137     env['ENV']['PYTHONPATH'] = python_path
138 robwdcock 682
139     # Setup help for options
140     Help(opts.GenerateHelpText(env))
141    
142     # Add some customer builders
143     py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
144     env.Append(BUILDERS = {'PyCompile' : py_builder});
145    
146     if env['PLATFORM'] == "win32":
147     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
148     else:
149     runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)
150     env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
151    
152     runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
153     env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
154    
155     # Convert the options which are held in environment variable into python variables for ease of handling and configure compilation options
156     try:
157     incinstall = env['incinstall']
158     env.Append(CPPPATH = [incinstall,])
159     except KeyError:
160     incinstall = None
161     try:
162     libinstall = env['libinstall']
163     env.Append(LIBPATH = [libinstall,])
164     env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
165     except KeyError:
166     libinstall = None
167     try:
168     pyinstall = env['pyinstall']+'/esys' # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
169     env.PrependENVPath('PYTHONPATH', env['pyinstall'])
170     except KeyError:
171     pyinstall = None
172     try:
173     dodebug = env['dodebug']
174     except KeyError:
175     dodebug = None
176     try:
177     cc_defines = env['cc_defines']
178     env.Append(CPPDEFINES = [cc_defines,])
179     except KeyError:
180     pass
181     if dodebug:
182     try:
183     flags = env['cc_flags_debug']
184     env.Append(CCFLAGS = flags)
185     except KeyError:
186     pass
187     else:
188     try:
189     flags = env['cc_flags']
190     env.Append(CCFLAGS = flags)
191     except KeyError:
192     pass
193    
194     if dodebug:
195     try:
196     flags = env['cxx_flags_debug']
197     env.Append(CXXFLAGS = flags)
198     except KeyError:
199     pass
200     else:
201     try:
202     flags = env['cxx_flags']
203     env.Append(CXXFLAGS = flags)
204     except KeyError:
205     pass
206    
207     try:
208     flags = env['ar_flags']
209     env.Append(ARFLAGS = flags)
210     except KeyError:
211     ar_flags = None
212     try:
213     sys_libs = env['sys_libs']
214     except KeyError:
215     sys_libs = ''
216    
217     try:
218 gross 700 tar_flags = env['tar_flags']
219     env.Replace(TARFLAGS = tar_flags)
220     except KeyError:
221     pass
222    
223     try:
224 robwdcock 682 includes = env['mkl_path']
225     env.Append(CPPPATH = [includes,])
226     except KeyError:
227     pass
228 gross 700
229 robwdcock 682 try:
230     lib_path = env['mkl_lib_path']
231     env.Append(LIBPATH = [lib_path,])
232     except KeyError:
233     pass
234 gross 700
235 robwdcock 682 try:
236     mkl_libs = env['mkl_libs']
237     except KeyError:
238     mkl_libs = ''
239     try:
240     includes = env['scsl_path']
241     env.Append(CPPPATH = [includes,])
242     except KeyError:
243     pass
244     try:
245     lib_path = env['scsl_lib_path']
246     env.Append(LIBPATH = [lib_path,])
247     except KeyError:
248     pass
249     try:
250     scsl_libs = env['scsl_libs']
251     except KeyError:
252     scsl_libs = ''
253     try:
254     includes = env['umf_path']
255     env.Append(CPPPATH = [includes,])
256     except KeyError:
257     pass
258     try:
259     lib_path = env['umf_lib_path']
260     env.Append(LIBPATH = [lib_path,])
261     except KeyError:
262     pass
263     try:
264     umf_libs = env['umf_libs']
265     except KeyError:
266     umf_libs = ''
267     try:
268     includes = env['boost_path']
269     env.Append(CPPPATH = [includes,])
270     except KeyError:
271     pass
272     try:
273     lib_path = env['boost_lib_path']
274     env.Append(LIBPATH = [lib_path,])
275     except KeyError:
276     pass
277     try:
278     boost_lib = env['boost_lib']
279     except KeyError:
280     boost_lib = None
281     try:
282     includes = env['python_path']
283     env.Append(CPPPATH = [includes,])
284     except KeyError:
285     pass
286     try:
287     lib_path = env['python_lib_path']
288     env.Append(LIBPATH = [lib_path,])
289     except KeyError:
290     pass
291     try:
292     python_lib = env['python_lib']
293     except KeyError:
294     python_lib = None
295     try:
296     doxygen_path = env['doxygen_path']
297     except KeyError:
298     doxygen_path = None
299     try:
300     epydoc_path = env['epydoc_path']
301     except KeyError:
302     epydoc_path = None
303     try:
304     epydoc_pythonpath = env['epydoc_pythonpath']
305     except KeyError:
306     epydoc_pythonpath = None
307     try:
308     includes = env['papi_path']
309     env.Append(CPPPATH = [includes,])
310     except KeyError:
311     pass
312     try:
313     lib_path = env['papi_lib_path']
314     env.Append(LIBPATH = [lib_path,])
315     except KeyError:
316     pass
317     try:
318     papi_libs = env['papi_libs']
319     except KeyError:
320     papi_libs = None
321    
322 gross 707
323 gross 700 try:
324 gross 707 src_zipfile = env.File(env['src_zipfile'])
325 gross 700 except KeyError:
326     src_zipfile = None
327     try:
328 gross 707 test_zipfile = env.File(env['test_zipfile'])
329 gross 700 except KeyError:
330     test_zipfile = None
331 gross 707 try:
332     examples_zipfile = env.File(env['examples_zipfile'])
333     except KeyError:
334     examples_zipfile = None
335 gross 700
336     try:
337 gross 707 src_tarfile = env.File(env['src_tarfile'])
338 gross 700 except KeyError:
339     src_tarfile = None
340     try:
341 gross 707 test_tarfile = env.File(env['test_tarfile'])
342 gross 700 except KeyError:
343     test_tarfile = None
344 gross 707 try:
345     examples_tarfile = env.File(env['examples_tarfile'])
346     except KeyError:
347     examples_tarfile = None
348 gross 700
349     try:
350 gross 707 guide_pdf = env.File(env['guide_pdf'])
351 gross 700 except KeyError:
352 gross 707 guide_pdf = None
353 gross 700
354 gross 707 try:
355     guide_html_index = env.File('index.htm',env['guide_html'])
356     except KeyError:
357     guide_html_index = None
358    
359 elspeth 712 try:
360     api_epydoc = env.Dir(env['api_epydoc'])
361     except KeyError:
362     api_epydoc = None
363    
364 gross 700 # Zipgets
365 elspeth 712
366 robwdcock 682 env.Default(libinstall)
367     env.Default(incinstall)
368     env.Default(pyinstall)
369 gross 705 env.Alias('release_src',[ src_zipfile, src_tarfile ])
370 gross 700 env.Alias('release_tests',[ test_zipfile, test_tarfile])
371 gross 707 env.Alias('release_examples',[ examples_zipfile, examples_tarfile])
372 elspeth 712 env.Alias('docs',[ 'release_examples', guide_pdf, guide_html_index, api_epydoc])
373 gross 707 env.Alias('release', ['release_src', 'release_tests', 'docs'])
374 gross 705 env.Alias('build_tests') # target to build all C++ tests
375     env.Alias('build_py_tests') # target to build all python tests
376 gross 706 env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests
377     env.Alias('run_tests', 'build_tests') # target to run all C++ test
378     env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests
379 gross 705 env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests
380 robwdcock 682
381     # Python install - esys __init__.py
382     # This is just an empty file but stills need to be touched so add a special target and Command. Note you can't use the scons Touch() function as it will not
383     # create the file if it doesn't exist
384 robwdcock 691 env.Command(pyinstall+'/__init__.py', None, 'touch $TARGET')
385 robwdcock 682
386     # Allow sconscripts to see the env
387     Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs",
388 gross 700 "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "epydoc_pythonpath", "papi_libs",
389 gross 707 "sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile",
390 elspeth 712 "guide_pdf", "guide_html_index", "api_epydoc"])
391 robwdcock 682
392     # End initialisation section
393     # Begin configuration section
394 gross 700 # adds this file and the scons option directore to the source tar
395     release_srcfiles=[env.File('SConstruct'),]+[ env.File(x) for x in glob.glob('scons/*.py') ]
396     release_testfiles=[env.File('README_TESTS'),]
397 gross 706 env.Zip(src_zipfile, release_srcfiles)
398 gross 700 env.Zip(test_zipfile, release_testfiles)
399     env.Tar(src_tarfile, release_srcfiles)
400     env.Tar(test_tarfile, release_testfiles)
401    
402 robwdcock 682 # Insert new components to be build here
403     # FIXME: might be nice to replace this verbosity with a list of targets and some
404     # FIXME: nifty python to create the lengthy but very similar env.Sconscript lines
405     # Third Party libraries
406     env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
407     # C/C++ Libraries
408     env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
409     env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
410     env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
411     env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
412     env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
413     env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)
414 gross 707 env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0)
415     #env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0) not part of beta.0

  ViewVC Help
Powered by ViewVC 1.1.26