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

Annotation of /branches/ROBW_XPLATFORM/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 652 - (hide annotations)
Fri Mar 24 07:34:18 2006 UTC (16 years, 8 months ago) by robwdcock
File size: 10506 byte(s)
+Add py_tests targets and get script ones running

1 jgs 214 # top-level Scons configuration file for all esys13 modules
2 robwdcock 623 # 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 jgs 455
8 robwdcock 623 import sys, os
9     # Add our extensions
10     if sys.path.count('scons')==0: sys.path.append('scons')
11     import scons_extensions
12 jgs 455
13 robwdcock 623 # 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 jgs 214
30 robwdcock 623 opts = Options(options_file, ARGUMENTS)
31     opts.AddOptions(
32     # Where to install esys stuff
33 robwdcock 635 ('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+'/esys'),
36 robwdcock 623 # Compilation options
37 robwdcock 639 BoolOption('dodebug', 'Do you want a debug build?', 'yes'),
38 robwdcock 623 ('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 robwdcock 635 # 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 robwdcock 623 # 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 jgs 192
80 robwdcock 623 # 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 robwdcock 632 if os.name != "nt" and os.uname()[4]=='ia64':
89 robwdcock 623 env = Environment(ENV = {'PATH' : os.environ['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 robwdcock 641 elif os.name == "nt":
93     env = Environment(tools = ['default', 'intelc'], options = opts)
94 robwdcock 623 else:
95 robwdcock 641 env = Environment(tools = ['default'], options = opts)
96 robwdcock 623
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 robwdcock 652 runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True)
111     env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder});
112 robwdcock 623
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     except KeyError:
123     libinstall = None
124     try:
125     pyinstall = env['pyinstall']
126     except KeyError:
127     pyinstall = None
128     try:
129     dodebug = env['dodebug']
130     except KeyError:
131     dodebug = None
132     try:
133     cc_defines = env['cc_defines']
134     env.Append(CPPDEFINES = [cc_defines,])
135     except KeyError:
136     pass
137     if dodebug:
138     try:
139     flags = env['cc_flags_debug']
140 robwdcock 632 env.Append(CCFLAGS = flags)
141 robwdcock 623 except KeyError:
142     pass
143     else:
144     try:
145     flags = env['cc_flags']
146 robwdcock 632 env.Append(CCFLAGS = flags)
147 robwdcock 623 except KeyError:
148     pass
149    
150     if dodebug:
151     try:
152     flags = env['cxx_flags_debug']
153 robwdcock 632 env.Append(CXXFLAGS = flags)
154 robwdcock 623 except KeyError:
155     pass
156     else:
157     try:
158     flags = env['cxx_flags']
159 robwdcock 632 env.Append(CXXFLAGS = flags)
160 robwdcock 623 except KeyError:
161     pass
162    
163     try:
164     flags = env['ar_flags']
165     env.Append(ARFLAGS = flags)
166     except KeyError:
167     ar_flags = None
168     try:
169     sys_libs = env['sys_libs']
170     except KeyError:
171 robwdcock 641 sys_libs = ''
172 robwdcock 623
173     try:
174     includes = env['mkl_path']
175     env.Append(CPPPATH = [includes,])
176     except KeyError:
177     pass
178     try:
179     lib_path = env['mkl_lib_path']
180     env.Append(LIBPATH = [lib_path,])
181     except KeyError:
182     pass
183     try:
184     mkl_libs = env['mkl_libs']
185     except KeyError:
186 robwdcock 641 mkl_libs = ''
187 robwdcock 623 try:
188     includes = env['scsl_path']
189     env.Append(CPPPATH = [includes,])
190     except KeyError:
191     pass
192     try:
193     lib_path = env['scsl_lib_path']
194     env.Append(LIBPATH = [lib_path,])
195     except KeyError:
196     pass
197     try:
198     scsl_libs = env['scsl_libs']
199     except KeyError:
200 robwdcock 641 scsl_libs = ''
201 robwdcock 623 try:
202     includes = env['umf_path']
203     env.Append(CPPPATH = [includes,])
204     except KeyError:
205     pass
206     try:
207     lib_path = env['umf_lib_path']
208     env.Append(LIBPATH = [lib_path,])
209     except KeyError:
210     pass
211     try:
212     umf_libs = env['umf_libs']
213     except KeyError:
214 robwdcock 641 umf_libs = ''
215 robwdcock 623 try:
216     includes = env['boost_path']
217     env.Append(CPPPATH = [includes,])
218     except KeyError:
219     pass
220     try:
221     lib_path = env['boost_lib_path']
222     env.Append(LIBPATH = [lib_path,])
223     except KeyError:
224     pass
225     try:
226     boost_lib = env['boost_lib']
227     except KeyError:
228     boost_lib = None
229     try:
230 robwdcock 635 includes = env['cppunit_path']
231     env.Append(CPPPATH = [includes,])
232     except KeyError:
233     pass
234     try:
235     lib_path = env['cppunit_lib_path']
236     env.Append(LIBPATH = [lib_path,])
237     except KeyError:
238     pass
239     try:
240     cppunit_lib = env['cppunit_lib']
241     except KeyError:
242     boost_lib = None
243     try:
244 robwdcock 623 includes = env['python_path']
245     env.Append(CPPPATH = [includes,])
246     except KeyError:
247     pass
248     try:
249     lib_path = env['python_lib_path']
250     env.Append(LIBPATH = [lib_path,])
251     except KeyError:
252     pass
253     try:
254     python_lib = env['python_lib']
255     except KeyError:
256     python_lib = None
257     try:
258     doxygen_path = env['doxygen_path']
259     except KeyError:
260     doxygen_path = None
261     try:
262     epydoc_path = env['epydoc_path']
263     except KeyError:
264     epydoc_path = None
265     try:
266     epydoc_pythonpath = env['epydoc_pythonpath']
267     except KeyError:
268     epydoc_pythonpath = None
269     try:
270     includes = env['papi_path']
271     env.Append(CPPPATH = [includes,])
272     except KeyError:
273     pass
274     try:
275     lib_path = env['papi_lib_path']
276     env.Append(LIBPATH = [lib_path,])
277     except KeyError:
278     pass
279     try:
280     papi_libs = env['papi_libs']
281     except KeyError:
282     papi_libs = None
283    
284     # Targets
285     env.Default(libinstall)
286     env.Default(incinstall)
287 robwdcock 651 env.Default(pyinstall)
288 robwdcock 652 env.Alias('build_tests')
289     env.Alias('run_tests')
290     env.Alias('py_tests')
291 robwdcock 623
292     # Allow sconscripts to see the env
293     Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs",
294 robwdcock 635 "boost_lib", "python_lib", "doxygen_path", "epydoc_path", "epydoc_pythonpath", "papi_libs", "cppunit_lib", "sys_libs" ])
295 robwdcock 623
296     # End initialisation section
297     # Begin configuration section
298     # Insert new components to be build here
299     # FIXME: might be nice to replace this verbosity with a list of targets and some
300     # FIXME: nifty python to create the lengthy but very similar env.Sconscript lines
301     # Third Party libraries
302     env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0)
303     # C/C++ Libraries
304     env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0)
305     env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0)
306     env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0)
307     env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0)
308     env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0)
309    
310     # FIXME:modelib and pyvisi need to be incorporated into build system for it to match original one
311     #'modellib/SConstruct',
312     #'pyvisi/SConstruct']
313     # 'doc/SConstruct']
314     # 'doc/SConstruct']

  ViewVC Help
Powered by ViewVC 1.1.26