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