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

Contents of /branches/ROBW_XPLATFORM/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 677 - (show annotations)
Sun Mar 26 11:25:19 2006 UTC (15 years, 6 months ago) by robwdcock
File size: 11467 byte(s)
+ Opps forgot to commit the lines that add the PYTHONPATH to the scons ENV used for calling external programs

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 try:
89 python_path = os.environ['PYTHONPATH']
90 except KeyError:
91 python_path = ''
92
93 if os.name != "nt" and os.uname()[4]=='ia64':
94 env = Environment(ENV = {'PATH':os.environ['PATH'], 'LD_LIBRARY_PATH':os.environ['LD_LIBRARY_PATH'], 'PYTHONPATH':python_path}, tools = ['default', 'intelc'], options = opts)
95 if env['CXX'] == 'icpc':
96 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
97 elif os.name == "nt":
98 # FIXME: Need to implement equivalent of ld library path for windoze
99 env = Environment(ENV = {'PYTHONPATH':python_path}, tools = ['default', 'intelc'], options = opts)
100 else:
101 env = Environment(ENV = {'LD_LIBRARY_PATH':os.environ['LD_LIBRARY_PATH'], 'PYTHONPATH':python_path}, tools = ['default'], options = opts)
102
103 # Setup help for options
104 Help(opts.GenerateHelpText(env))
105
106 # Add some customer builders
107 py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
108 env.Append(BUILDERS = {'PyCompile' : py_builder});
109
110 if env['PLATFORM'] == "win32":
111 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
112 else:
113 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)
114 env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
115
116 runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
117 env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
118
119 # Convert the options which are held in environment variable into python variables for ease of handling and configure compilation options
120 try:
121 incinstall = env['incinstall']
122 env.Append(CPPPATH = [incinstall,])
123 except KeyError:
124 incinstall = None
125 try:
126 libinstall = env['libinstall']
127 env.Append(LIBPATH = [libinstall,])
128 env.PrependENVPath('LD_LIBRARY_PATH', libinstall)
129 except KeyError:
130 libinstall = None
131 try:
132 pyinstall = env['pyinstall']+'/esys' # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc
133 env.PrependENVPath('PYTHONPATH', env['pyinstall'])
134 except KeyError:
135 pyinstall = None
136 try:
137 dodebug = env['dodebug']
138 except KeyError:
139 dodebug = None
140 try:
141 cc_defines = env['cc_defines']
142 env.Append(CPPDEFINES = [cc_defines,])
143 except KeyError:
144 pass
145 if dodebug:
146 try:
147 flags = env['cc_flags_debug']
148 env.Append(CCFLAGS = flags)
149 except KeyError:
150 pass
151 else:
152 try:
153 flags = env['cc_flags']
154 env.Append(CCFLAGS = flags)
155 except KeyError:
156 pass
157
158 if dodebug:
159 try:
160 flags = env['cxx_flags_debug']
161 env.Append(CXXFLAGS = flags)
162 except KeyError:
163 pass
164 else:
165 try:
166 flags = env['cxx_flags']
167 env.Append(CXXFLAGS = flags)
168 except KeyError:
169 pass
170
171 try:
172 flags = env['ar_flags']
173 env.Append(ARFLAGS = flags)
174 except KeyError:
175 ar_flags = None
176 try:
177 sys_libs = env['sys_libs']
178 except KeyError:
179 sys_libs = ''
180
181 try:
182 includes = env['mkl_path']
183 env.Append(CPPPATH = [includes,])
184 except KeyError:
185 pass
186 try:
187 lib_path = env['mkl_lib_path']
188 env.Append(LIBPATH = [lib_path,])
189 except KeyError:
190 pass
191 try:
192 mkl_libs = env['mkl_libs']
193 except KeyError:
194 mkl_libs = ''
195 try:
196 includes = env['scsl_path']
197 env.Append(CPPPATH = [includes,])
198 except KeyError:
199 pass
200 try:
201 lib_path = env['scsl_lib_path']
202 env.Append(LIBPATH = [lib_path,])
203 except KeyError:
204 pass
205 try:
206 scsl_libs = env['scsl_libs']
207 except KeyError:
208 scsl_libs = ''
209 try:
210 includes = env['umf_path']
211 env.Append(CPPPATH = [includes,])
212 except KeyError:
213 pass
214 try:
215 lib_path = env['umf_lib_path']
216 env.Append(LIBPATH = [lib_path,])
217 except KeyError:
218 pass
219 try:
220 umf_libs = env['umf_libs']
221 except KeyError:
222 umf_libs = ''
223 try:
224 includes = env['boost_path']
225 env.Append(CPPPATH = [includes,])
226 except KeyError:
227 pass
228 try:
229 lib_path = env['boost_lib_path']
230 env.Append(LIBPATH = [lib_path,])
231 except KeyError:
232 pass
233 try:
234 boost_lib = env['boost_lib']
235 except KeyError:
236 boost_lib = None
237 try:
238 includes = env['cppunit_path']
239 env.Append(CPPPATH = [includes,])
240 except KeyError:
241 pass
242 try:
243 lib_path = env['cppunit_lib_path']
244 env.Append(LIBPATH = [lib_path,])
245 except KeyError:
246 pass
247 try:
248 cppunit_lib = env['cppunit_lib']
249 except KeyError:
250 boost_lib = None
251 try:
252 includes = env['python_path']
253 env.Append(CPPPATH = [includes,])
254 except KeyError:
255 pass
256 try:
257 lib_path = env['python_lib_path']
258 env.Append(LIBPATH = [lib_path,])
259 except KeyError:
260 pass
261 try:
262 python_lib = env['python_lib']
263 except KeyError:
264 python_lib = None
265 try:
266 doxygen_path = env['doxygen_path']
267 except KeyError:
268 doxygen_path = None
269 try:
270 epydoc_path = env['epydoc_path']
271 except KeyError:
272 epydoc_path = None
273 try:
274 epydoc_pythonpath = env['epydoc_pythonpath']
275 except KeyError:
276 epydoc_pythonpath = None
277 try:
278 includes = env['papi_path']
279 env.Append(CPPPATH = [includes,])
280 except KeyError:
281 pass
282 try:
283 lib_path = env['papi_lib_path']
284 env.Append(LIBPATH = [lib_path,])
285 except KeyError:
286 pass
287 try:
288 papi_libs = env['papi_libs']
289 except KeyError:
290 papi_libs = None
291
292 # Targets
293 env.Default(libinstall)
294 env.Default(incinstall)
295 env.Default(pyinstall)
296 env.Alias('build_tests')
297 env.Alias('run_tests')
298 env.Alias('py_tests')
299 env.Alias('all_tests', ['run_tests', 'py_tests'])
300
301 # Python install - esys __init__.py
302 # 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
303 # create the file if it doesn't exist
304 env.Command('esys/__init__.py', None, 'touch $TARGET')
305
306 # Allow sconscripts to see the env
307 Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs",
308 "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "epydoc_pythonpath", "papi_libs", "cppunit_lib", "sys_libs" ])
309
310 # End initialisation section
311 # Begin configuration section
312 # Insert new components to be build here
313 # FIXME: might be nice to replace this verbosity with a list of targets and some
314 # FIXME: nifty python to create the lengthy but very similar env.Sconscript lines
315 # Third Party libraries
316 env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
317 # C/C++ Libraries
318 env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
319 env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
320 env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
321 env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
322 env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
323 env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0)
324
325 # FIXME:need to be incorporated into build system
326 # FIXME: 'pyvisi/SConstruct']
327 # FIXME: 'doc/SConstruct']
328 # FIXME: 'doc/SConstruct']

  ViewVC Help
Powered by ViewVC 1.1.26