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

Contents of /branches/intelc_win32/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.26