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

Annotation of /branches/ROBW_XPLATFORM/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.26