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

Contents of /branches/ROBW_XPLATFORM/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 634 - (show annotations)
Thu Mar 23 06:03:46 2006 UTC (14 years, 3 months ago) by robwdcock
File size: 11035 byte(s)
+ Opps windows build wasn't getting options passed into environment!
Note: Windows build environment for intel_c compiler is only partially building. Looks like there will be a few source code adjustments necessary to tweak things. Still, much better than the msvc compiler. It also has openmp support - now I just need a dual core cpu notebook upgrade.
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 (# - relative to root of source tree)', '#/include'),
34 ('libinstall', 'where the esys libraries will be installed (# - relative to root of source tree)', '#/lib'),
35 ('pyinstall', 'where the esys python modules will be installed (# - relative to root of source tree)', '#/esys'),
36 # Compilation options
37 BoolOption('dodebug', 'Do you want a debug build?', 'no'),
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 # Doc building
67 PathOption('doxygen_path', 'Path to Doxygen executable', None),
68 PathOption('epydoc_path', 'Path to Epydoc executable', None),
69 PathOption('epydoc_pythonpath', 'Path to Epydoc python files', None),
70 # PAPI
71 PathOption('papi_path', 'Path to PAPI includes', None),
72 PathOption('papi_lib_path', 'Path to PAPI libs', None),
73 ('papi_libs', 'PAPI libraries to link with', None),
74 )
75
76 # Initialise Scons Build Environment
77 # Note: On the Altix the intel compilers are not automatically
78 # detected by scons intelc.py script. The Altix has a different directory
79 # path and in some locations the "modules" facility is used to support
80 # multiple compiler versions. This forces the need to import the users PATH
81 # environment which isn't the "scons way"
82 # 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)
83 # FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix
84 if os.name != "nt" and os.uname()[4]=='ia64':
85 env = Environment(ENV = {'PATH' : os.environ['PATH']}, tools = ['default', 'intelc'], options = opts)
86 if env['CXX'] == 'icpc':
87 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
88 else:
89 env = Environment(tools = ['default', 'intelc'], options = opts)
90
91 # Setup help for options
92 Help(opts.GenerateHelpText(env))
93
94 # Add some customer builders
95 py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True)
96 env.Append(BUILDERS = {'PyCompile' : py_builder});
97
98 if env['PLATFORM'] == "win32":
99 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True)
100 else:
101 runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True)
102 env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder});
103
104 # FIXME: Copy this builder from the win32 branch
105 #runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
106 #env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
107
108 # Convert the options which are held in environment variable into python variables for ease of handling and configure compilation options
109 try:
110 incinstall = env['incinstall']
111 env.Append(CPPPATH = [incinstall,])
112 except KeyError:
113 incinstall = None
114 try:
115 libinstall = env['libinstall']
116 env.Append(LIBPATH = [libinstall,])
117 except KeyError:
118 libinstall = None
119 try:
120 pyinstall = env['pyinstall']
121 except KeyError:
122 pyinstall = None
123 try:
124 dodebug = env['dodebug']
125 except KeyError:
126 dodebug = None
127 try:
128 cc_defines = env['cc_defines']
129 env.Append(CPPDEFINES = [cc_defines,])
130 except KeyError:
131 pass
132 if dodebug:
133 try:
134 flags = env['cc_flags_debug']
135 env.Append(CCFLAGS = flags)
136 except KeyError:
137 pass
138 else:
139 try:
140 flags = env['cc_flags']
141 env.Append(CCFLAGS = flags)
142 except KeyError:
143 pass
144
145 if dodebug:
146 try:
147 flags = env['cxx_flags_debug']
148 env.Append(CXXFLAGS = flags)
149 except KeyError:
150 pass
151 else:
152 try:
153 flags = env['cxx_flags']
154 env.Append(CXXFLAGS = flags)
155 except KeyError:
156 pass
157
158 try:
159 flags = env['ar_flags']
160 env.Append(ARFLAGS = flags)
161 except KeyError:
162 ar_flags = None
163 try:
164 sys_libs = env['sys_libs']
165 except KeyError:
166 sys_libs = None
167
168 try:
169 includes = env['mkl_path']
170 env.Append(CPPPATH = [includes,])
171 except KeyError:
172 pass
173 try:
174 lib_path = env['mkl_lib_path']
175 env.Append(LIBPATH = [lib_path,])
176 except KeyError:
177 pass
178 try:
179 mkl_libs = env['mkl_libs']
180 except KeyError:
181 mkl_libs = None
182 try:
183 includes = env['scsl_path']
184 env.Append(CPPPATH = [includes,])
185 except KeyError:
186 pass
187 try:
188 lib_path = env['scsl_lib_path']
189 env.Append(LIBPATH = [lib_path,])
190 except KeyError:
191 pass
192 try:
193 scsl_libs = env['scsl_libs']
194 except KeyError:
195 scsl_libs = None
196 try:
197 includes = env['umf_path']
198 env.Append(CPPPATH = [includes,])
199 except KeyError:
200 pass
201 try:
202 lib_path = env['umf_lib_path']
203 env.Append(LIBPATH = [lib_path,])
204 except KeyError:
205 pass
206 try:
207 umf_libs = env['umf_libs']
208 except KeyError:
209 umf_libs = None
210 try:
211 includes = env['boost_path']
212 env.Append(CPPPATH = [includes,])
213 except KeyError:
214 pass
215 try:
216 lib_path = env['boost_lib_path']
217 env.Append(LIBPATH = [lib_path,])
218 except KeyError:
219 pass
220 try:
221 boost_lib = env['boost_lib']
222 except KeyError:
223 boost_lib = None
224 try:
225 includes = env['python_path']
226 env.Append(CPPPATH = [includes,])
227 except KeyError:
228 pass
229 try:
230 lib_path = env['python_lib_path']
231 env.Append(LIBPATH = [lib_path,])
232 except KeyError:
233 pass
234 try:
235 python_lib = env['python_lib']
236 except KeyError:
237 python_lib = None
238 try:
239 doxygen_path = env['doxygen_path']
240 except KeyError:
241 doxygen_path = None
242 try:
243 epydoc_path = env['epydoc_path']
244 except KeyError:
245 epydoc_path = None
246 try:
247 epydoc_pythonpath = env['epydoc_pythonpath']
248 except KeyError:
249 epydoc_pythonpath = None
250 try:
251 includes = env['papi_path']
252 env.Append(CPPPATH = [includes,])
253 except KeyError:
254 pass
255 try:
256 lib_path = env['papi_lib_path']
257 env.Append(LIBPATH = [lib_path,])
258 except KeyError:
259 pass
260 try:
261 papi_libs = env['papi_libs']
262 except KeyError:
263 papi_libs = None
264
265 # Targets
266 env.Default(libinstall)
267 env.Default(incinstall)
268 env.Alias('py_test')
269
270 # Allow sconscripts to see the env
271 Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs",
272 "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "epydoc_pythonpath", "papi_libs" ])
273
274 # End initialisation section
275 # Begin configuration section
276 # Insert new components to be build here
277 # FIXME: might be nice to replace this verbosity with a list of targets and some
278 # FIXME: nifty python to create the lengthy but very similar env.Sconscript lines
279 # Third Party libraries
280 env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
281 # C/C++ Libraries
282 env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
283 env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
284 env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
285 env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
286 env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
287
288 # Unit Tests
289 #env.SConscript(dirs = ['esysUtils/test/EsysException'], build_dir='build/$PLATFORM/esysUtils/test/EsysException', duplicate=0)
290 #env.SConscript(dirs = ['escript/test'], build_dir='build/$PLATFORM/escript/test', duplicate=0)
291 #env.SConscript(dirs = ['bruce/test'], build_dir='build/$PLATFORM/bruce/test', duplicate=0)
292 #env.SConscript(dirs = ['finley/test'], build_dir='build/$PLATFORM/finley/test', duplicate=0)
293
294 # Python
295 #env.SConscript(dirs = ['esys/py_src'], build_dir='build/$PLATFORM/esys/py', duplicate=0)# call appropriate SConscripts
296 # FIXME:modelib and pyvisi need to be incorporated into build system for it to match original one
297 #'modellib/SConstruct',
298 #'pyvisi/SConstruct']
299 # 'doc/SConstruct']
300 # 'doc/SConstruct']
301
302 # FIXME: REMOVE THIS OLD STUFF
303 # Original SConstruct file contents (minus the bits that have been replaced)
304 #target_scripts = [
305 # 'tools/CppUnitTest/SConstruct',
306 # 'esysUtils/SConstruct',
307 # 'escript/SConstruct',
308 # 'bruce/SConstruct',
309 # 'paso/SConstruct',
310 # 'finley/SConstruct',
311 # 'modellib/SConstruct',
312 # 'pyvisi/SConstruct']
313 # 'doc/SConstruct']
314 # 'doc/SConstruct']
315
316 #SConscript(target_scripts, duplicate=0)
317

  ViewVC Help
Powered by ViewVC 1.1.26