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

Contents of /branches/ROBW_XPLATFORM/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 676 - (show annotations)
Sun Mar 26 10:13:34 2006 UTC (15 years, 8 months ago) by robwdcock
File size: 11280 byte(s)
+ Modified test SConscript dependencies to remove redundant call to explicit dependency
+ Modified scon_extensions.py - run unit tests (py and C++) now use scons::Execute rather than python os.system. This ensures the development environment
is used rather than the users environment to run the tests
+ SConstruct file now sets up LD_LIBRARY_PATH and PYTHONPATH to point to the current builds pyinstall and libinstall paths as required.
IT IS NO LONGER NECESSARY TO SET LD_LIBRARY_PATH and PYTHONPATH to point at your build outputs. Much safer in the presence of multiple checked out builds.
Under these circumstances you are better of using scons to run the tests rather than doing so directly. Easiest way to do this is to build the test output target for the test you want:
e.g. scons build/posix/bruce/test/python/ImportTest.passed
or if you prefer
cd build/posix/bruce/test/python
scons -u ImportTest.passed


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

  ViewVC Help
Powered by ViewVC 1.1.26