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