/[escript]/trunk/SConstruct
ViewVC logotype

Contents of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 688 - (show annotations)
Tue Mar 28 01:56:24 2006 UTC (13 years, 7 months ago) by robwdcock
File size: 12332 byte(s)
+ Modified the env (environment) creation for the ia64 platform to include PATH so it no longer complains about not being able to locate the intel compiler. This is related to the previous fix for windows. Seems it is a scons intelc.py bug.

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 #
9 #
10
11 # 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
18 import sys, os
19 # Add our extensions
20 if sys.path.count('scons')==0: sys.path.append('scons')
21 import scons_extensions
22
23 # Default options and options help text
24 # These are defaults and can be overridden using command line arguments or an options file.
25 # if the options_file or ARGUMENTS do not exist then the ones listed as default here are used
26 # DO NOT CHANGE THEM HERE
27 if ARGUMENTS.get('options_file',0):
28 options_file = ARGUMENTS.get('options_file',0)
29 else:
30 import socket
31 from string import ascii_letters,digits
32 hostname=""
33 for s in socket.gethostname().split('.')[0]:
34 if s in ascii_letters+digits:
35 hostname+=s
36 else:
37 hostname+="_"
38 options_file = "scons/"+hostname+"_options.py"
39
40 opts = Options(options_file, ARGUMENTS)
41 opts.AddOptions(
42 # Where to install esys stuff
43 ('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'),
44 ('libinstall', 'where the esys libraries will be installed', Dir('#.').abspath+'/lib'),
45 ('pyinstall', 'where the esys python modules will be installed', Dir('#.').abspath),
46 # Compilation options
47 BoolOption('dodebug', 'Do you want a debug build?', 'yes'),
48 ('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/hostname_options.py)", options_file),
49 ('cc_defines','C/C++ defines to use', None),
50 ('cc_flags','C compiler flags to use (Release build)', None),
51 ('cc_flags_debug', 'C compiler flags to use (Debug build)', None),
52 ('cxx_flags', 'C++ compiler flags to use (Release build)', None),
53 ('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', None),
54 ('ar_flags', 'Static library archiver flags to use', None),
55 ('sys_libs', 'System libraries to link with', None),
56 # MKL
57 PathOption('mkl_path', 'Path to MKL includes', None),
58 PathOption('mkl_lib_path', 'Path to MKL libs', None),
59 ('mkl_libs', 'MKL libraries to link with', None),
60 # SCSL
61 PathOption('scsl_path', 'Path to SCSL includes', None),
62 PathOption('scsl_lib_path', 'Path to SCSL libs', None),
63 ('scsl_libs', 'SCSL libraries to link with', None),
64 # UMFPACK
65 PathOption('umf_path', 'Path to UMF includes', None),
66 PathOption('umf_lib_path', 'Path to UMF libs', None),
67 ('umf_libs', 'UMF libraries to link with', None),
68 # Python
69 # locations of include files for python
70 PathOption('python_path', 'Path to Python includes', '/usr/include/python%s.%s'%(sys.version_info[0],sys.version_info[1])),
71 PathOption('python_lib_path', 'Path to Python libs', '/usr/lib'),
72 ('python_lib', 'Python libraries to link with', ["python%s.%s"%(sys.version_info[0],sys.version_info[1]),]),
73 # Boost
74 PathOption('boost_path', 'Path to Boost includes', '/usr/include'),
75 PathOption('boost_lib_path', 'Path to Boost libs', '/usr/lib'),
76 ('boost_lib', 'Boost libraries to link with', ['boost_python',]),
77 # CppUnit
78 PathOption('cppunit_path', 'Path to CppUnit includes', Dir('#.').abspath+'/tools/CppUnitTest/inc'),
79 PathOption('cppunit_lib_path', 'Path to CppUnit libs', Dir('#.').abspath+'/lib'),
80 ('cppunit_lib', 'CppUnit libraries to link with', ['CppUnitTest',]),
81 # Doc building
82 PathOption('doxygen_path', 'Path to Doxygen executable', None),
83 PathOption('epydoc_path', 'Path to Epydoc executable', None),
84 PathOption('epydoc_pythonpath', 'Path to Epydoc python files', None),
85 # PAPI
86 PathOption('papi_path', 'Path to PAPI includes', None),
87 PathOption('papi_lib_path', 'Path to PAPI libs', None),
88 ('papi_libs', 'PAPI libraries to link with', None),
89 )
90
91 # Initialise Scons Build Environment
92 # check for user environment variables we are interested in
93 try:
94 python_path = os.environ['PYTHONPATH']
95 except KeyError:
96 python_path = ''
97 try:
98 path = os.environ['PATH']
99 except KeyError:
100 path = ''
101 try:
102 ld_library_path = os.environ['LD_LIBRARY_PATH']
103 except KeyError:
104 ld_library_path = ''
105
106 # Note: On the Altix the intel compilers are not automatically
107 # detected by scons intelc.py script. The Altix has a different directory
108 # path and in some locations the "modules" facility is used to support
109 # multiple compiler versions. This forces the need to import the users PATH
110 # environment which isn't the "scons way"
111 # 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)
112 # FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix
113
114 if os.name != "nt" and os.uname()[4]=='ia64':
115 env = Environment(ENV = {'PATH':path}, tools = ['default', 'intelc'], options = opts)
116 env['ENV']['PATH'] = path
117 env['ENV']['LD_LIBRARY_PATH'] = ld_library_path
118 env['ENV']['PYTHONPATH'] = python_path
119 if env['CXX'] == 'icpc':
120 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
121 elif os.name == "nt":
122 # FIXME: Need to implement equivalent of ld library path for windoze
123 env = Environment(tools = ['default', 'intelc'], options = opts)
124 env['ENV']['PYTHONPATH'] = python_path
125 else:
126 env = Environment(tools = ['default'], options = opts)
127 env['ENV']['PATH'] = path
128 env['ENV']['LD_LIBRARY_PATH'] = ld_library_path
129 env['ENV']['PYTHONPATH'] = python_path
130
131 # Setup help for options
132 Help(opts.GenerateHelpText(env))
133
134 # Add some customer builders
135 py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
136 env.Append(BUILDERS = {'PyCompile' : py_builder});
137
138 if env['PLATFORM'] == "win32":
139 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
140 else:
141 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)
142 env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
143
144 runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
145 env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
146
147 # Convert the options which are held in environment variable into python variables for ease of handling and configure compilation options
148 try:
149 incinstall = env['incinstall']
150 env.Append(CPPPATH = [incinstall,])
151 except KeyError:
152 incinstall = None
153 try:
154 libinstall = env['libinstall']
155 env.Append(LIBPATH = [libinstall,])
156 env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
157 except KeyError:
158 libinstall = None
159 try:
160 pyinstall = env['pyinstall']+'/esys' # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
161 env.PrependENVPath('PYTHONPATH', env['pyinstall'])
162 except KeyError:
163 pyinstall = None
164 try:
165 dodebug = env['dodebug']
166 except KeyError:
167 dodebug = None
168 try:
169 cc_defines = env['cc_defines']
170 env.Append(CPPDEFINES = [cc_defines,])
171 except KeyError:
172 pass
173 if dodebug:
174 try:
175 flags = env['cc_flags_debug']
176 env.Append(CCFLAGS = flags)
177 except KeyError:
178 pass
179 else:
180 try:
181 flags = env['cc_flags']
182 env.Append(CCFLAGS = flags)
183 except KeyError:
184 pass
185
186 if dodebug:
187 try:
188 flags = env['cxx_flags_debug']
189 env.Append(CXXFLAGS = flags)
190 except KeyError:
191 pass
192 else:
193 try:
194 flags = env['cxx_flags']
195 env.Append(CXXFLAGS = flags)
196 except KeyError:
197 pass
198
199 try:
200 flags = env['ar_flags']
201 env.Append(ARFLAGS = flags)
202 except KeyError:
203 ar_flags = None
204 try:
205 sys_libs = env['sys_libs']
206 except KeyError:
207 sys_libs = ''
208
209 try:
210 includes = env['mkl_path']
211 env.Append(CPPPATH = [includes,])
212 except KeyError:
213 pass
214 try:
215 lib_path = env['mkl_lib_path']
216 env.Append(LIBPATH = [lib_path,])
217 except KeyError:
218 pass
219 try:
220 mkl_libs = env['mkl_libs']
221 except KeyError:
222 mkl_libs = ''
223 try:
224 includes = env['scsl_path']
225 env.Append(CPPPATH = [includes,])
226 except KeyError:
227 pass
228 try:
229 lib_path = env['scsl_lib_path']
230 env.Append(LIBPATH = [lib_path,])
231 except KeyError:
232 pass
233 try:
234 scsl_libs = env['scsl_libs']
235 except KeyError:
236 scsl_libs = ''
237 try:
238 includes = env['umf_path']
239 env.Append(CPPPATH = [includes,])
240 except KeyError:
241 pass
242 try:
243 lib_path = env['umf_lib_path']
244 env.Append(LIBPATH = [lib_path,])
245 except KeyError:
246 pass
247 try:
248 umf_libs = env['umf_libs']
249 except KeyError:
250 umf_libs = ''
251 try:
252 includes = env['boost_path']
253 env.Append(CPPPATH = [includes,])
254 except KeyError:
255 pass
256 try:
257 lib_path = env['boost_lib_path']
258 env.Append(LIBPATH = [lib_path,])
259 except KeyError:
260 pass
261 try:
262 boost_lib = env['boost_lib']
263 except KeyError:
264 boost_lib = None
265 try:
266 includes = env['cppunit_path']
267 env.Append(CPPPATH = [includes,])
268 except KeyError:
269 pass
270 try:
271 lib_path = env['cppunit_lib_path']
272 env.Append(LIBPATH = [lib_path,])
273 except KeyError:
274 pass
275 try:
276 cppunit_lib = env['cppunit_lib']
277 except KeyError:
278 boost_lib = None
279 try:
280 includes = env['python_path']
281 env.Append(CPPPATH = [includes,])
282 except KeyError:
283 pass
284 try:
285 lib_path = env['python_lib_path']
286 env.Append(LIBPATH = [lib_path,])
287 except KeyError:
288 pass
289 try:
290 python_lib = env['python_lib']
291 except KeyError:
292 python_lib = None
293 try:
294 doxygen_path = env['doxygen_path']
295 except KeyError:
296 doxygen_path = None
297 try:
298 epydoc_path = env['epydoc_path']
299 except KeyError:
300 epydoc_path = None
301 try:
302 epydoc_pythonpath = env['epydoc_pythonpath']
303 except KeyError:
304 epydoc_pythonpath = None
305 try:
306 includes = env['papi_path']
307 env.Append(CPPPATH = [includes,])
308 except KeyError:
309 pass
310 try:
311 lib_path = env['papi_lib_path']
312 env.Append(LIBPATH = [lib_path,])
313 except KeyError:
314 pass
315 try:
316 papi_libs = env['papi_libs']
317 except KeyError:
318 papi_libs = None
319
320 # Targets
321 env.Default(libinstall)
322 env.Default(incinstall)
323 env.Default(pyinstall)
324 env.Alias('build_tests')
325 env.Alias('run_tests')
326 env.Alias('py_tests')
327 env.Alias('all_tests', ['run_tests', 'py_tests'])
328
329 # Python install - esys __init__.py
330 # 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
331 # create the file if it doesn't exist
332 env.Command('esys/__init__.py', None, 'touch $TARGET')
333
334 # Allow sconscripts to see the env
335 Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs",
336 "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "epydoc_pythonpath", "papi_libs", "cppunit_lib", "sys_libs" ])
337
338 # End initialisation section
339 # Begin configuration section
340 # Insert new components to be build here
341 # FIXME: might be nice to replace this verbosity with a list of targets and some
342 # FIXME: nifty python to create the lengthy but very similar env.Sconscript lines
343 # Third Party libraries
344 env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
345 # C/C++ Libraries
346 env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
347 env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
348 env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
349 env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
350 env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
351 env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)
352
353 # FIXME:need to be incorporated into build system
354 # FIXME: 'pyvisi/SConstruct']
355 # FIXME: 'doc/SConstruct']
356 # FIXME: 'doc/SConstruct']

  ViewVC Help
Powered by ViewVC 1.1.26