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 |
# top-level Scons configuration file for all esys13 modules |
# top-level Scons configuration file for all esys13 modules |
9 |
|
# Begin initialisation Section |
10 |
|
# all of this section just intialises default environments and helper |
11 |
|
# scripts. You shouldn't need to modify this section. |
12 |
|
EnsureSConsVersion(0,96,91) |
13 |
|
EnsurePythonVersion(2,3) |
14 |
|
|
15 |
import os |
#=============================================================== |
16 |
|
# import tools: |
17 |
|
import glob |
18 |
|
import sys, os |
19 |
|
import socket |
20 |
|
# Add our extensions |
21 |
|
if sys.path.count('scons')==0: sys.path.append('scons') |
22 |
|
import scons_extensions |
23 |
|
|
24 |
|
#=============================================================== |
25 |
|
# check on windows or linux platform |
26 |
# |
# |
27 |
# ensure correct versions of python and scons |
IS_WINDOWS_PLATFORM = (os.name== "nt") |
28 |
|
|
29 |
EnsurePythonVersion(2,3) |
if IS_WINDOWS_PLATFORM: |
30 |
EnsureSConsVersion(0,96) |
tools_prefix="C:\\Program Files\\" |
31 |
|
else: |
32 |
|
tools_prefix="/usr" |
33 |
|
|
34 |
|
#============================================================================================== |
35 |
|
# |
36 |
|
# get the installation prefix |
37 |
# |
# |
38 |
# retreive command-line arguments if any |
prefix = ARGUMENTS.get('prefix', Dir('#.').abspath) |
|
# these are passed through to SConscripts |
|
39 |
|
|
40 |
if ARGUMENTS.get('libinstall',0): |
# We may also need to know where python's site-packages subdirectory lives |
41 |
libinstall = ARGUMENTS.get('libinstall',0) |
python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1]) |
42 |
|
|
43 |
|
if prefix == "/usr": |
44 |
|
# Install as a standard python package in /usr/lib64 if available, else in /usr/lib |
45 |
|
if os.path.isdir( prefix+"/lib64/"+python_version+"/site-packages"): |
46 |
|
dir_packages = prefix+"/lib64/"+python_version+"/site-packages" |
47 |
|
dir_libraries = prefix+"/lib64" |
48 |
|
elif os.path.isdir(prefix+"/lib/"+python_version+"/site-packages"): |
49 |
|
dir_packages = prefix+"/lib/"+python_version+"/site-packages" |
50 |
|
dir_libraries = prefix+"/lib" |
51 |
|
else: |
52 |
|
print "Install prefix is /usr but couldn't find python package directory in either" |
53 |
|
print "/usr/lib64/"+python_version+"/site-packages or /usr/lib/"+python_version+"/site-packages" |
54 |
|
sys.exit(1) |
55 |
|
dir_examples = prefix+"/share/doc/esys" |
56 |
|
else: |
57 |
|
# Install using the usual escript directory structure |
58 |
|
dir_packages = prefix |
59 |
|
dir_libraries = prefix+"/lib" |
60 |
|
dir_examples = prefix |
61 |
|
dir_packages += "/esys" |
62 |
|
dir_examples += "/examples" |
63 |
|
|
64 |
|
print "Install prefix is: ", prefix |
65 |
|
print " python packages will be installed in: ", dir_packages |
66 |
|
print " libraries will be installed in: ", dir_libraries |
67 |
|
print " examples will be installed in: ", dir_examples |
68 |
|
|
69 |
|
#============================================================================================== |
70 |
|
|
71 |
|
# Default options and options help text |
72 |
|
# These are defaults and can be overridden using command line arguments or an options file. |
73 |
|
# if the options_file or ARGUMENTS do not exist then the ones listed as default here are used |
74 |
|
# DO NOT CHANGE THEM HERE |
75 |
|
# Where to install? |
76 |
|
#============================================================================================== |
77 |
|
# |
78 |
|
# get the options file if present: |
79 |
|
# |
80 |
|
if ARGUMENTS.get('options_file',0): |
81 |
|
options_file = ARGUMENTS.get('options_file',0) |
82 |
|
else: |
83 |
|
from string import ascii_letters,digits |
84 |
|
hostname="" |
85 |
|
for s in socket.gethostname().split('.')[0]: |
86 |
|
if s in ascii_letters+digits: |
87 |
|
hostname+=s |
88 |
|
else: |
89 |
|
hostname+="_" |
90 |
|
options_file = os.path.join("scons",hostname+"_options.py") |
91 |
|
|
92 |
|
if os.path.isfile(options_file): |
93 |
|
print "option file is ",options_file,"." |
94 |
|
else: |
95 |
|
print "option file is ",options_file, "(not present)." |
96 |
|
# and load it |
97 |
|
opts = Options(options_file, ARGUMENTS) |
98 |
|
#================================================================ |
99 |
|
# |
100 |
|
# check if UMFPACK is installed on the system: |
101 |
|
# |
102 |
|
uf_root=None |
103 |
|
for i in [ 'UMFPACK', 'umfpack', 'ufsparse', 'UFSPARSE']: |
104 |
|
if os.path.isdir(os.path.join(tools_prefix,'include',i)): |
105 |
|
uf_root=i |
106 |
|
print i," is used form ",tools_prefix |
107 |
|
break |
108 |
|
if not uf_root==None: |
109 |
|
umf_path_default=os.path.join(tools_prefix,'include',uf_root) |
110 |
|
umf_lib_path_default=os.path.join(tools_prefix,'lib') |
111 |
|
umf_libs_default=['umfpack'] |
112 |
|
amd_path_default=os.path.join(tools_prefix,'include',uf_root) |
113 |
|
amd_lib_path_default=os.path.join(tools_prefix,'lib') |
114 |
|
amd_libs_default=['amd'] |
115 |
|
ufc_path_default=os.path.join(tools_prefix,'include',uf_root) |
116 |
|
else: |
117 |
|
umf_path_default=None |
118 |
|
umf_lib_path_default=None |
119 |
|
umf_libs_default=None |
120 |
|
amd_path_default=None |
121 |
|
amd_lib_path_default=None |
122 |
|
amd_libs_default=None |
123 |
|
ufc_path_default=None |
124 |
|
# |
125 |
|
#========================================================================== |
126 |
|
# |
127 |
|
# python installation: |
128 |
|
# |
129 |
|
if IS_WINDOWS_PLATFORM: |
130 |
|
python_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"include") |
131 |
|
python_lib_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"libs") |
132 |
|
python_libs_default=["python%s%s"%(sys.version_info[0],sys.version_info[1])] |
133 |
else: |
else: |
134 |
libinstall = Dir('#lib') |
python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1])) |
135 |
Export(["libinstall"]) |
python_lib_path_default=os.path.join(tools_prefix,'lib') |
136 |
|
python_libs_default=["python%s.%s"%(sys.version_info[0],sys.version_info[1])] |
137 |
|
|
138 |
if ARGUMENTS.get('options',0): |
#========================================================================== |
139 |
options = ARGUMENTS.get('options',0) |
# |
140 |
|
# boost installation: |
141 |
|
# |
142 |
|
if IS_WINDOWS_PLATFORM: |
143 |
|
boost_libs_path_default=os.path.join(tools_prefix,'boost','lib') |
144 |
|
boost_libs_default=None |
145 |
|
for i in os.listdir(boost_libs_path_default): |
146 |
|
name=os.path.splitext(i) |
147 |
|
if name[1] == ".dll" and name[0].startswith("boost_python"): |
148 |
|
if boost_libs_default == None: |
149 |
|
boost_libs_default= [ name[0] ] |
150 |
|
else: |
151 |
|
if not name[0].find("-gd-"): boost_libs_default=[ name[0] ] |
152 |
|
boost_path_default=os.path.join(tools_prefix,'boost','include','boost-%s'%(boost_libs_default[0].split("-")[-1],)) |
153 |
|
else: |
154 |
|
boost_path_default=os.path.join(tools_prefix,'include') |
155 |
|
boost_libs_path_default=os.path.join(tools_prefix,'lib') |
156 |
|
boost_libs_default=['boost_python'] |
157 |
|
#========================================================================== |
158 |
|
# |
159 |
|
# check if netCDF is installed on the system: |
160 |
|
# |
161 |
|
if IS_WINDOWS_PLATFORM: |
162 |
|
netcdf_dir=os.path.join(tools_prefix,'netcdf') |
163 |
|
netCDF_path_default=os.path.join(netcdf_dir,'include') |
164 |
|
netCDF_lib_path_default=os.path.join(netcdf_dir,'lib') |
165 |
else: |
else: |
166 |
options = None |
netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3') |
167 |
Export(["options"]) |
netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3') |
168 |
|
|
169 |
if ARGUMENTS.get('debug',0): |
if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default): |
170 |
dodebug = 1 |
useNetCDF_default='yes' |
171 |
|
netCDF_libs_default=[ 'netcdf_c++', 'netcdf' ] |
172 |
|
else: |
173 |
|
useNetCDF_default='no' |
174 |
|
netCDF_path_default=None |
175 |
|
netCDF_lib_path_default=None |
176 |
|
netCDF_libs_default=None |
177 |
|
|
178 |
|
if IS_WINDOWS_PLATFORM: |
179 |
|
useNetCDF_default='no' # be default netcdf is not supported on windows. |
180 |
|
#========================================================================== |
181 |
|
# |
182 |
|
# compile: |
183 |
|
# |
184 |
|
if IS_WINDOWS_PLATFORM: |
185 |
|
# cc_flags_default = '/GR /EHsc /MD /Qc99 /Qopenmp /Qopenmp-report1 /O3 /G7 /Qprec /Qpar-report1 /QxP /QaxP' |
186 |
|
# cc_flags_debug_default = '/Od /MDd /RTC1 /GR /EHsc /Qc99 /Qopenmp /Qopenmp-report1 /Qprec' |
187 |
|
cc_flags_default = '/nologo /EHsc /GR /wd4068 /O2 /Op /MT /W3 /Ob0 /Z7' |
188 |
|
cc_flags_debug_default ='/nologo /EHsc /GR /wd4068 /Od /RTC1 /MTd /ZI /Ob0 /Z7' |
189 |
|
|
190 |
|
cc_flags_default = '/nologo /EHsc /GR /O2 /MT /W3 /Ob0 /Z7 /wd4068' |
191 |
|
cc_flags_debug_default ='/nologo /EHsc /GR /Od /RTC1 /MTd /W3 /Ob0 /Z7/wd4068' |
192 |
|
cxx_flags_default = '' |
193 |
|
cxx_flags_debug_default = '' |
194 |
|
cc_common_flags = '/FD /EHsc /GR /wd4068 ' |
195 |
|
else: |
196 |
|
cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
197 |
|
cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
198 |
|
cxx_flags_default='--no-warn -ansi' |
199 |
|
cxx_flags_debug_default='--no-warn -ansi -DDOASSERT' |
200 |
|
#============================================================================================== |
201 |
|
# Default options and options help text |
202 |
|
# These are defaults and can be overridden using command line arguments or an options file. |
203 |
|
# if the options_file or ARGUMENTS do not exist then the ones listed as default here are used |
204 |
|
# DO NOT CHANGE THEM HERE |
205 |
|
opts.AddOptions( |
206 |
|
# Where to install esys stuff |
207 |
|
('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'), |
208 |
|
('libinstall', 'where the esys libraries will be installed', dir_libraries), |
209 |
|
('pyinstall', 'where the esys python modules will be installed', dir_packages), |
210 |
|
('exinstall', 'where the esys examples will be installed', dir_examples), |
211 |
|
('src_zipfile', 'the source zip file will be installed.', Dir('#.').abspath+"/release/escript_src.zip"), |
212 |
|
('test_zipfile', 'the test zip file will be installed.', Dir('#.').abspath+"/release/escript_tests.zip"), |
213 |
|
('src_tarfile', 'the source tar file will be installed.', Dir('#.').abspath+"/release/escript_src.tar.gz"), |
214 |
|
('test_tarfile', 'the test tar file will be installed.', Dir('#.').abspath+"/release/escript_tests.tar.gz"), |
215 |
|
('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"), |
216 |
|
('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"), |
217 |
|
('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"), |
218 |
|
('api_epydoc', 'name of the epydoc api docs directory', Dir('#.').abspath+"/release/doc/epydoc"), |
219 |
|
('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"), |
220 |
|
('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"), |
221 |
|
# Compilation options |
222 |
|
BoolOption('dodebug', 'Do you want a debug build?', 'no'), |
223 |
|
('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/<hostname>_options.py)", options_file), |
224 |
|
('cc_defines','C/C++ defines to use', None), |
225 |
|
('cc_flags','C compiler flags to use (Release build)', cc_flags_default), |
226 |
|
('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default), |
227 |
|
('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default), |
228 |
|
('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', cxx_flags_debug_default), |
229 |
|
('ar_flags', 'Static library archiver flags to use', None), |
230 |
|
('sys_libs', 'System libraries to link with', None), |
231 |
|
('tar_flags','flags for zip files','-c -z'), |
232 |
|
# MKL |
233 |
|
PathOption('mkl_path', 'Path to MKL includes', None), |
234 |
|
PathOption('mkl_lib_path', 'Path to MKL libs', None), |
235 |
|
('mkl_libs', 'MKL libraries to link with', None), |
236 |
|
# SCSL |
237 |
|
PathOption('scsl_path', 'Path to SCSL includes', None), |
238 |
|
PathOption('scsl_lib_path', 'Path to SCSL libs', None), |
239 |
|
('scsl_libs', 'SCSL libraries to link with', None), |
240 |
|
('scsl_libs_MPI', 'SCSL libraries to link with for MPI build', None), |
241 |
|
# UMFPACK |
242 |
|
PathOption('ufc_path', 'Path to UFconfig includes', ufc_path_default), |
243 |
|
PathOption('umf_path', 'Path to UMFPACK includes', umf_path_default), |
244 |
|
PathOption('umf_lib_path', 'Path to UMFPACK libs', umf_lib_path_default), |
245 |
|
('umf_libs', 'UMFPACK libraries to link with', umf_libs_default), |
246 |
|
# AMD (used by UMFPACK) |
247 |
|
PathOption('amd_path', 'Path to AMD includes', amd_path_default), |
248 |
|
PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default), |
249 |
|
('amd_libs', 'AMD libraries to link with', amd_libs_default), |
250 |
|
# BLAS |
251 |
|
PathOption('blas_path', 'Path to BLAS includes', None), |
252 |
|
PathOption('blas_lib_path', 'Path to BLAS libs', None), |
253 |
|
('blas_libs', 'BLAS libraries to link with', None), |
254 |
|
# netCDF |
255 |
|
('useNetCDF', 'switch on/off the usage of netCDF', useNetCDF_default), |
256 |
|
PathOption('netCDF_path', 'Path to netCDF includes', netCDF_path_default), |
257 |
|
PathOption('netCDF_lib_path', 'Path to netCDF libs', netCDF_lib_path_default), |
258 |
|
('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default), |
259 |
|
# Python |
260 |
|
# locations of include files for python |
261 |
|
PathOption('python_path', 'Path to Python includes', python_path_default), |
262 |
|
PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default), |
263 |
|
('python_libs', 'Python libraries to link with', python_libs_default), |
264 |
|
# Boost |
265 |
|
PathOption('boost_path', 'Path to Boost includes', boost_path_default), |
266 |
|
PathOption('boost_libs_path', 'Path to Boost libs', boost_libs_path_default), |
267 |
|
('boost_libs', 'Boost libraries to link with', boost_libs_default), |
268 |
|
# Doc building |
269 |
|
# PathOption('doxygen_path', 'Path to Doxygen executable', None), |
270 |
|
# PathOption('epydoc_path', 'Path to Epydoc executable', None), |
271 |
|
# PAPI |
272 |
|
PathOption('papi_path', 'Path to PAPI includes', None), |
273 |
|
PathOption('papi_lib_path', 'Path to PAPI libs', None), |
274 |
|
('papi_libs', 'PAPI libraries to link with', None), |
275 |
|
# MPI |
276 |
|
BoolOption('useMPI', 'Compile parallel version using MPI', 'no'), |
277 |
|
) |
278 |
|
#================================================================================================= |
279 |
|
# |
280 |
|
# Note: On the Altix the intel compilers are not automatically |
281 |
|
# detected by scons intelc.py script. The Altix has a different directory |
282 |
|
# path and in some locations the "modules" facility is used to support |
283 |
|
# multiple compiler versions. This forces the need to import the users PATH |
284 |
|
# environment which isn't the "scons way" |
285 |
|
# 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) |
286 |
|
# FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix |
287 |
|
# |
288 |
|
if IS_WINDOWS_PLATFORM: |
289 |
|
env = Environment(tools = ['default', 'msvc'], options = opts) |
290 |
else: |
else: |
291 |
dodebug = 0 |
if os.uname()[4]=='ia64': |
292 |
Export(["dodebug"]) |
env = Environment(tools = ['default', 'intelc'], options = opts) |
293 |
|
if env['CXX'] == 'icpc': |
294 |
|
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 |
295 |
|
else: |
296 |
|
env = Environment(tools = ['default'], options = opts) |
297 |
|
Help(opts.GenerateHelpText(env)) |
298 |
|
#================================================================================================= |
299 |
|
# |
300 |
|
# Initialise Scons Build Environment |
301 |
|
# check for user environment variables we are interested in |
302 |
|
try: |
303 |
|
python_path = os.environ['PYTHONPATH'] |
304 |
|
env['ENV']['PYTHONPATH'] = python_path |
305 |
|
except KeyError: |
306 |
|
python_path = '' |
307 |
|
|
308 |
|
try: |
309 |
|
omp_num_threads = os.environ['OMP_NUM_THREADS'] |
310 |
|
except KeyError: |
311 |
|
omp_num_threads = 1 |
312 |
|
env['ENV']['OMP_NUM_THREADS'] = omp_num_threads |
313 |
|
|
314 |
|
try: |
315 |
|
env['ENV']['DISPLAY'] = os.environ['DISPLAY'] |
316 |
|
env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY'] |
317 |
|
except KeyError: |
318 |
|
pass |
319 |
|
|
320 |
|
try: |
321 |
|
path = os.environ['PATH'] |
322 |
|
env['ENV']['PATH'] = path |
323 |
|
except KeyError: |
324 |
|
path = '' |
325 |
|
try: |
326 |
|
ld_library_path = os.environ['LD_LIBRARY_PATH'] |
327 |
|
env['ENV']['LD_LIBRARY_PATH'] = ld_library_path |
328 |
|
except KeyError: |
329 |
|
ld_library_path = '' |
330 |
|
#========================================================================== |
331 |
|
# |
332 |
|
# Add some customer builders |
333 |
|
# |
334 |
|
py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True) |
335 |
|
env.Append(BUILDERS = {'PyCompile' : py_builder}); |
336 |
|
|
337 |
if ARGUMENTS.get('usegcc',0): |
if IS_WINDOWS_PLATFORM: |
338 |
usegcc = 1 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True) |
339 |
else: |
else: |
340 |
usegcc = 0 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True) |
341 |
Export(["usegcc"]) |
env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder}); |
342 |
|
|
343 |
# |
runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True) |
344 |
# set and export esysroot |
env.Append(BUILDERS = {'RunPyUnitTest' : runPyUnitTest_builder}); |
345 |
|
|
346 |
esysroot = Dir('#.') |
# Convert the options which are held in environment variable into python variables for ease of handling and configure compilation options |
347 |
Export(["esysroot"]) |
try: |
348 |
|
incinstall = env['incinstall'] |
349 |
|
env.Append(CPPPATH = [incinstall,]) |
350 |
|
except KeyError: |
351 |
|
incinstall = None |
352 |
|
try: |
353 |
|
libinstall = env['libinstall'] |
354 |
|
env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so |
355 |
|
env.PrependENVPath('LD_LIBRARY_PATH', libinstall) |
356 |
|
if env['PLATFORM'] == "win32": |
357 |
|
env.PrependENVPath('PATH', libinstall) |
358 |
|
env.PrependENVPath('PATH', env['boost_libs_path']) |
359 |
|
except KeyError: |
360 |
|
libinstall = None |
361 |
|
try: |
362 |
|
pyinstall = env['pyinstall'] # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc |
363 |
|
env.PrependENVPath('PYTHONPATH', env['pyinstall']) |
364 |
|
except KeyError: |
365 |
|
pyinstall = None |
366 |
|
try: |
367 |
|
exinstall = env['exinstall'] |
368 |
|
except KeyError: |
369 |
|
exinstall = None |
370 |
|
try: |
371 |
|
dodebug = env['dodebug'] |
372 |
|
except KeyError: |
373 |
|
dodebug = None |
374 |
|
try: |
375 |
|
useMPI = env['useMPI'] |
376 |
|
except KeyError: |
377 |
|
useMPI = None |
378 |
|
try: |
379 |
|
cc_defines = env['cc_defines'] |
380 |
|
env.Append(CPPDEFINES = cc_defines) |
381 |
|
except KeyError: |
382 |
|
pass |
383 |
|
|
384 |
|
if dodebug: |
385 |
|
if useMPI: |
386 |
|
try: |
387 |
|
flags = env['cc_flags_debug_MPI'] |
388 |
|
env.Append(CCFLAGS = flags) |
389 |
|
except KeyError: |
390 |
|
pass |
391 |
|
else: |
392 |
|
try: |
393 |
|
flags = env['cc_flags_debug'] |
394 |
|
env.Append(CCFLAGS = flags) |
395 |
|
except KeyError: |
396 |
|
pass |
397 |
|
else: |
398 |
|
if useMPI: |
399 |
|
try: |
400 |
|
flags = env['cc_flags_MPI'] |
401 |
|
env.Append(CCFLAGS = flags) |
402 |
|
except KeyError: |
403 |
|
pass |
404 |
|
else: |
405 |
|
try: |
406 |
|
flags = env['cc_flags'] |
407 |
|
env.Append(CCFLAGS = flags) |
408 |
|
except KeyError: |
409 |
|
pass |
410 |
|
if dodebug: |
411 |
|
if useMPI: |
412 |
|
try: |
413 |
|
flags = env['cxx_flags_debug_MPI'] |
414 |
|
env.Append(CXXFLAGS = flags) |
415 |
|
except KeyError: |
416 |
|
pass |
417 |
|
else: |
418 |
|
try: |
419 |
|
flags = env['cxx_flags_debug'] |
420 |
|
env.Append(CXXFLAGS = flags) |
421 |
|
except KeyError: |
422 |
|
pass |
423 |
|
else: |
424 |
|
if useMPI: |
425 |
|
try: |
426 |
|
flags = env['cxx_flags_MPI'] |
427 |
|
env.Append(CXXFLAGS = flags) |
428 |
|
except KeyError: |
429 |
|
pass |
430 |
|
else: |
431 |
|
try: |
432 |
|
flags = env['cxx_flags'] |
433 |
|
env.Append(CXXFLAGS = flags) |
434 |
|
except KeyError: |
435 |
|
pass |
436 |
|
try: |
437 |
|
flags = env['ar_flags'] |
438 |
|
env.Append(ARFLAGS = flags) |
439 |
|
except KeyError: |
440 |
|
ar_flags = None |
441 |
|
try: |
442 |
|
sys_libs = env['sys_libs'] |
443 |
|
except KeyError: |
444 |
|
sys_libs = [] |
445 |
|
|
446 |
|
try: |
447 |
|
tar_flags = env['tar_flags'] |
448 |
|
env.Replace(TARFLAGS = tar_flags) |
449 |
|
except KeyError: |
450 |
|
pass |
451 |
|
|
452 |
|
try: |
453 |
|
includes = env['mkl_path'] |
454 |
|
env.Append(CPPPATH = [includes,]) |
455 |
|
except KeyError: |
456 |
|
pass |
457 |
|
|
458 |
|
try: |
459 |
|
lib_path = env['mkl_lib_path'] |
460 |
|
env.Append(LIBPATH = [lib_path,]) |
461 |
|
except KeyError: |
462 |
|
pass |
463 |
|
|
464 |
# |
if useMPI: |
465 |
# call appropriate SConscripts |
mkl_libs = [] |
466 |
|
else: |
467 |
|
try: |
468 |
|
mkl_libs = env['mkl_libs'] |
469 |
|
except KeyError: |
470 |
|
mkl_libs = [] |
471 |
|
|
472 |
|
try: |
473 |
|
includes = env['scsl_path'] |
474 |
|
env.Append(CPPPATH = [includes,]) |
475 |
|
except KeyError: |
476 |
|
pass |
477 |
|
|
478 |
|
try: |
479 |
|
lib_path = env['scsl_lib_path'] |
480 |
|
env.Append(LIBPATH = [lib_path,]) |
481 |
|
except KeyError: |
482 |
|
pass |
483 |
|
|
484 |
|
if useMPI: |
485 |
|
try: |
486 |
|
scsl_libs = env['scsl_libs_MPI'] |
487 |
|
except KeyError: |
488 |
|
scsl_libs = [] |
489 |
|
else: |
490 |
|
try: |
491 |
|
scsl_libs = env['scsl_libs'] |
492 |
|
except KeyError: |
493 |
|
scsl_libs = [] |
494 |
|
|
495 |
|
try: |
496 |
|
includes = env['umf_path'] |
497 |
|
env.Append(CPPPATH = [includes,]) |
498 |
|
except KeyError: |
499 |
|
pass |
500 |
|
|
501 |
|
try: |
502 |
|
lib_path = env['umf_lib_path'] |
503 |
|
env.Append(LIBPATH = [lib_path,]) |
504 |
|
except KeyError: |
505 |
|
pass |
506 |
|
|
507 |
|
if useMPI: |
508 |
|
umf_libs = [] |
509 |
|
else: |
510 |
|
try: |
511 |
|
umf_libs = env['umf_libs'] |
512 |
|
except KeyError: |
513 |
|
umf_libs = [] |
514 |
|
|
515 |
|
try: |
516 |
|
includes = env['ufc_path'] |
517 |
|
env.Append(CPPPATH = [includes,]) |
518 |
|
except KeyError: |
519 |
|
pass |
520 |
|
|
521 |
|
try: |
522 |
|
includes = env['amd_path'] |
523 |
|
env.Append(CPPPATH = [includes,]) |
524 |
|
except KeyError: |
525 |
|
pass |
526 |
|
|
527 |
|
try: |
528 |
|
lib_path = env['amd_lib_path'] |
529 |
|
env.Append(LIBPATH = [lib_path,]) |
530 |
|
except KeyError: |
531 |
|
pass |
532 |
|
|
533 |
target_scripts = ['tools/CppUnitTest/SConstruct', |
if useMPI: |
534 |
'tools/mmio/SConstruct', |
amd_libs = [] |
535 |
'esysUtils/SConstruct', |
else: |
536 |
'escript/SConstruct', |
try: |
537 |
'bruce/SConstruct', |
amd_libs = env['amd_libs'] |
538 |
'paso/SConstruct', |
except KeyError: |
539 |
'finley/SConstruct'] |
amd_libs = [] |
540 |
|
|
541 |
|
try: |
542 |
|
includes = env['blas_path'] |
543 |
|
env.Append(CPPPATH = [includes,]) |
544 |
|
except KeyError: |
545 |
|
pass |
546 |
|
|
547 |
|
try: |
548 |
|
lib_path = env['blas_lib_path'] |
549 |
|
env.Append(LIBPATH = [lib_path,]) |
550 |
|
except KeyError: |
551 |
|
pass |
552 |
|
|
553 |
|
try: |
554 |
|
blas_libs = env['blas_libs'] |
555 |
|
except KeyError: |
556 |
|
blas_libs = [] |
557 |
|
|
558 |
|
try: |
559 |
|
useNetCDF = env['useNetCDF'] |
560 |
|
except KeyError: |
561 |
|
useNetCDF = 'yes' |
562 |
|
pass |
563 |
|
|
564 |
|
if not useNetCDF == 'yes': |
565 |
|
print "Warning: Installation is not configured with netCDF. Some I/O function may not be available." |
566 |
|
|
567 |
|
if useNetCDF == 'yes': |
568 |
|
try: |
569 |
|
includes = env['netCDF_path'] |
570 |
|
env.Append(CPPPATH = [includes,]) |
571 |
|
except KeyError: |
572 |
|
pass |
573 |
|
|
574 |
|
try: |
575 |
|
lib_path = env['netCDF_lib_path'] |
576 |
|
if IS_WINDOWS_PLATFORM: env['ENV']['PATH']+=";"+lib_path |
577 |
|
env.Append(LIBPATH = [ lib_path, ]) |
578 |
|
except KeyError: |
579 |
|
pass |
580 |
|
|
581 |
|
try: |
582 |
|
netCDF_libs = env['netCDF_libs'] |
583 |
|
except KeyError: |
584 |
|
netCDF_libs = [ ] |
585 |
|
else: |
586 |
|
netCDF_libs=[ ] |
587 |
|
|
588 |
SConscript(target_scripts, duplicate=0) |
try: |
589 |
|
includes = env['boost_path'] |
590 |
|
env.Append(CPPPATH = [includes,]) |
591 |
|
except KeyError: |
592 |
|
pass |
593 |
|
try: |
594 |
|
lib_path = env['boost_libs_path'] |
595 |
|
env.Append(LIBPATH = [lib_path,]) |
596 |
|
except KeyError: |
597 |
|
pass |
598 |
|
try: |
599 |
|
boost_libs = env['boost_libs'] |
600 |
|
except KeyError: |
601 |
|
boost_libs = None |
602 |
|
try: |
603 |
|
includes = env['python_path'] |
604 |
|
env.Append(CPPPATH = [includes,]) |
605 |
|
except KeyError: |
606 |
|
pass |
607 |
|
try: |
608 |
|
lib_path = env['python_lib_path'] |
609 |
|
env.Append(LIBPATH = [lib_path,]) |
610 |
|
except KeyError: |
611 |
|
pass |
612 |
|
try: |
613 |
|
python_libs = env['python_libs'] |
614 |
|
except KeyError: |
615 |
|
python_libs = None |
616 |
|
try: |
617 |
|
doxygen_path = env['doxygen_path'] |
618 |
|
except KeyError: |
619 |
|
doxygen_path = None |
620 |
|
try: |
621 |
|
epydoc_path = env['epydoc_path'] |
622 |
|
except KeyError: |
623 |
|
epydoc_path = None |
624 |
|
try: |
625 |
|
includes = env['papi_path'] |
626 |
|
env.Append(CPPPATH = [includes,]) |
627 |
|
except KeyError: |
628 |
|
pass |
629 |
|
try: |
630 |
|
lib_path = env['papi_lib_path'] |
631 |
|
env.Append(LIBPATH = [lib_path,]) |
632 |
|
except KeyError: |
633 |
|
pass |
634 |
|
try: |
635 |
|
papi_libs = env['papi_libs'] |
636 |
|
except KeyError: |
637 |
|
papi_libs = None |
638 |
|
|
639 |
|
|
640 |
|
try: |
641 |
|
src_zipfile = env.File(env['src_zipfile']) |
642 |
|
except KeyError: |
643 |
|
src_zipfile = None |
644 |
|
try: |
645 |
|
test_zipfile = env.File(env['test_zipfile']) |
646 |
|
except KeyError: |
647 |
|
test_zipfile = None |
648 |
|
try: |
649 |
|
examples_zipfile = env.File(env['examples_zipfile']) |
650 |
|
except KeyError: |
651 |
|
examples_zipfile = None |
652 |
|
|
653 |
|
try: |
654 |
|
src_tarfile = env.File(env['src_tarfile']) |
655 |
|
except KeyError: |
656 |
|
src_tarfile = None |
657 |
|
try: |
658 |
|
test_tarfile = env.File(env['test_tarfile']) |
659 |
|
except KeyError: |
660 |
|
test_tarfile = None |
661 |
|
try: |
662 |
|
examples_tarfile = env.File(env['examples_tarfile']) |
663 |
|
except KeyError: |
664 |
|
examples_tarfile = None |
665 |
|
|
666 |
|
try: |
667 |
|
guide_pdf = env.File(env['guide_pdf']) |
668 |
|
except KeyError: |
669 |
|
guide_pdf = None |
670 |
|
|
671 |
|
try: |
672 |
|
guide_html_index = env.File('index.htm',env['guide_html']) |
673 |
|
except KeyError: |
674 |
|
guide_html_index = None |
675 |
|
|
676 |
|
try: |
677 |
|
api_epydoc = env.Dir(env['api_epydoc']) |
678 |
|
except KeyError: |
679 |
|
api_epydoc = None |
680 |
|
|
681 |
|
try: |
682 |
|
api_doxygen = env.Dir(env['api_doxygen']) |
683 |
|
except KeyError: |
684 |
|
api_doxygen = None |
685 |
|
|
686 |
|
# Zipgets |
687 |
|
env.Default(libinstall) |
688 |
|
env.Default(incinstall) |
689 |
|
env.Default(pyinstall) |
690 |
|
### env.Default(exinstall) # ksteube this causes dependency error |
691 |
|
env.Alias('release_src',[ src_zipfile, src_tarfile ]) |
692 |
|
env.Alias('release_tests',[ test_zipfile, test_tarfile]) |
693 |
|
env.Alias('release_examples',[ examples_zipfile, examples_tarfile]) |
694 |
|
env.Alias('examples_zipfile',examples_zipfile) |
695 |
|
env.Alias('examples_tarfile',examples_tarfile) |
696 |
|
env.Alias('api_epydoc',api_epydoc) |
697 |
|
env.Alias('api_doxygen',api_doxygen) |
698 |
|
env.Alias('guide_html_index',guide_html_index) |
699 |
|
env.Alias('guide_pdf', guide_pdf) |
700 |
|
env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index]) |
701 |
|
env.Alias('release', ['release_src', 'release_tests', 'docs']) |
702 |
|
env.Alias('build_tests') # target to build all C++ tests |
703 |
|
env.Alias('build_py_tests') # target to build all python tests |
704 |
|
env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests |
705 |
|
env.Alias('run_tests', 'build_tests') # target to run all C++ test |
706 |
|
env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests |
707 |
|
env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests |
708 |
|
|
709 |
|
# Python install - esys __init__.py |
710 |
|
init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET')) |
711 |
|
env.Alias(init_target) |
712 |
|
|
713 |
|
# Allow sconscripts to see the env |
714 |
|
Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", "netCDF_libs", "useNetCDF", |
715 |
|
"boost_libs", "python_libs", "doxygen_path", "epydoc_path", "papi_libs", |
716 |
|
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile", |
717 |
|
"guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ]) |
718 |
|
|
719 |
|
# End initialisation section |
720 |
|
# Begin configuration section |
721 |
|
# adds this file and the scons option directore to the source tar |
722 |
|
release_srcfiles=[env.File('SConstruct'),]+[ env.File(x) for x in glob.glob('scons/*.py') ] |
723 |
|
release_testfiles=[env.File('README_TESTS'),] |
724 |
|
env.Zip(src_zipfile, release_srcfiles) |
725 |
|
env.Zip(test_zipfile, release_testfiles) |
726 |
|
try: |
727 |
|
env.Tar(src_tarfile, release_srcfiles) |
728 |
|
env.Tar(test_tarfile, release_testfiles) |
729 |
|
except AttributeError: |
730 |
|
pass |
731 |
|
# Insert new components to be build here |
732 |
|
# FIXME: might be nice to replace this verbosity with a list of targets and some |
733 |
|
# FIXME: nifty python to create the lengthy but very similar env.Sconscript lines |
734 |
|
# Third Party libraries |
735 |
|
env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0) |
736 |
|
# C/C++ Libraries |
737 |
|
env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0) |
738 |
|
# bruce is removed for now as it doesn't really do anything |
739 |
|
# env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0) |
740 |
|
env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0) |
741 |
|
env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0) |
742 |
|
env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0) |
743 |
|
env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0) |
744 |
|
env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0) |
745 |
|
env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0) |
746 |
|
env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0) |
747 |
|
|
748 |
|
# added by Ben Cumming |
749 |
|
env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0) |
750 |
|
#env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0) |