/[escript]/trunk/SConstruct
ViewVC logotype

Annotation of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


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