4 |
# Primary Business: Queensland, Australia |
# Primary Business: Queensland, Australia |
5 |
# Licensed under the Open Software License version 3.0 |
# Licensed under the Open Software License version 3.0 |
6 |
# http://www.opensource.org/licenses/osl-3.0.php |
# 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 |
# Begin initialisation Section |
12 |
EnsureSConsVersion(0,96,91) |
EnsureSConsVersion(0,96,91) |
13 |
EnsurePythonVersion(2,3) |
EnsurePythonVersion(2,3) |
14 |
|
|
15 |
# import tools: |
|
16 |
|
#=============================================================== |
17 |
|
# import tools: |
18 |
import glob |
import glob |
19 |
import sys, os |
import sys, os, re |
|
import socket |
|
20 |
# Add our extensions |
# Add our extensions |
21 |
if sys.path.count('scons')==0: sys.path.append('scons') |
if sys.path.count('scons')==0: sys.path.append('scons') |
22 |
import scons_extensions |
import scons_extensions |
23 |
|
|
24 |
# check if UMFPACK is installed on the system: |
# We may also need to know where python's site-packages subdirectory lives |
25 |
if os.path.isdir('/opt/UMFPACK/Include') and os.path.isdir('/opt/UMFPACK/Lib'): |
python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1]) |
26 |
umf_path_default='/opt/UMFPACK/Include' |
|
27 |
umf_lib_path_default='/opt/UMFPACK/Lib' |
#=============================================================== |
28 |
|
|
29 |
|
tools_prefix="/usr" |
30 |
|
|
31 |
|
#============================================================================================== |
32 |
|
# |
33 |
|
# get the installation prefix |
34 |
|
# |
35 |
|
prefix = ARGUMENTS.get('prefix', sys.prefix ) |
36 |
|
|
37 |
|
# We may also need to know where python's site-packages subdirectory lives |
38 |
|
python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1]) |
39 |
|
# Install as a standard python package in /usr/lib64 if available, else in /usr/lib |
40 |
|
if os.path.isdir( prefix+"/lib64/"+python_version+"/site-packages"): |
41 |
|
sys_dir_packages = prefix+"/lib64/"+python_version+"/site-packages/esys" |
42 |
|
sys_dir_libraries = prefix+"/lib64" |
43 |
|
else: |
44 |
|
sys_dir_packages = prefix+"/lib/"+python_version+"/site-packages/esys" |
45 |
|
sys_dir_libraries = prefix+"/lib" |
46 |
|
|
47 |
|
sys_dir_examples = prefix+"/share/doc/esys" |
48 |
|
|
49 |
|
source_root = Dir('#.').abspath |
50 |
|
|
51 |
|
dir_packages = os.path.join(source_root,"esys") |
52 |
|
dir_examples = os.path.join(source_root,"examples") |
53 |
|
dir_libraries = os.path.join(source_root,"lib") |
54 |
|
|
55 |
|
print "Source root is : ",source_root |
56 |
|
print " Default packages local installation: ", dir_packages |
57 |
|
print " Default library local installation ", dir_libraries |
58 |
|
print " Default example local installation: ", dir_examples |
59 |
|
print "Install prefix is: ", prefix |
60 |
|
print " Default packages system installation: ", sys_dir_packages |
61 |
|
print " Default library system installation ", sys_dir_libraries |
62 |
|
print " Default example system installation: ", sys_dir_examples |
63 |
|
|
64 |
|
#============================================================================================== |
65 |
|
|
66 |
|
# Default options and options help text |
67 |
|
# These are defaults and can be overridden using command line arguments or an options file. |
68 |
|
# if the options_file or ARGUMENTS do not exist then the ones listed as default here are used |
69 |
|
# DO NOT CHANGE THEM HERE |
70 |
|
# Where to install? |
71 |
|
#============================================================================================== |
72 |
|
# |
73 |
|
# get the options file if present: |
74 |
|
# |
75 |
|
options_file = ARGUMENTS.get('options_file','') |
76 |
|
|
77 |
|
if not os.path.isfile(options_file) : |
78 |
|
options_file = False |
79 |
|
|
80 |
|
if not options_file : |
81 |
|
import socket |
82 |
|
hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0]) |
83 |
|
tmp = os.path.join("scons",hostname+"_options.py") |
84 |
|
|
85 |
|
if os.path.isfile(tmp) : |
86 |
|
options_file = tmp |
87 |
|
|
88 |
|
IS_WINDOWS_PLATFORM = (os.name== "nt") |
89 |
|
|
90 |
|
# If you're not going to tell me then...... |
91 |
|
# FIXME: add one for the altix too. |
92 |
|
if not options_file : |
93 |
|
if IS_WINDOWS_PLATFORM : |
94 |
|
options_file = "scons/windows_mscv71_options.py" |
95 |
|
else: |
96 |
|
options_file = "scons/linux_gcc_eg_options.py" |
97 |
|
|
98 |
|
# and load it |
99 |
|
opts = Options(options_file, ARGUMENTS) |
100 |
|
#================================================================ |
101 |
|
# |
102 |
|
# check if UMFPACK is installed on the system: |
103 |
|
# |
104 |
|
uf_root=None |
105 |
|
for i in [ 'UMFPACK', 'umfpack', 'ufsparse', 'UFSPARSE']: |
106 |
|
if os.path.isdir(os.path.join(tools_prefix,'include',i)): |
107 |
|
uf_root=i |
108 |
|
print i," is used form ",tools_prefix |
109 |
|
break |
110 |
|
if not uf_root==None: |
111 |
|
umf_path_default=os.path.join(tools_prefix,'include',uf_root) |
112 |
|
umf_lib_path_default=os.path.join(tools_prefix,'lib') |
113 |
umf_libs_default=['umfpack'] |
umf_libs_default=['umfpack'] |
114 |
|
amd_path_default=os.path.join(tools_prefix,'include',uf_root) |
115 |
|
amd_lib_path_default=os.path.join(tools_prefix,'lib') |
116 |
|
amd_libs_default=['amd'] |
117 |
|
ufc_path_default=os.path.join(tools_prefix,'include',uf_root) |
118 |
else: |
else: |
119 |
umf_path_default=None |
umf_path_default=None |
120 |
umf_lib_path_default=None |
umf_lib_path_default=None |
121 |
umf_libs_default=None |
umf_libs_default=None |
|
|
|
|
if os.path.isdir('/opt/AMD/Include') and os.path.isdir('/opt/AMD/Lib'): |
|
|
amd_path_default='/opt/AMD/Include' |
|
|
amd_lib_path_default='/opt/AMD/Lib' |
|
|
amd_libs_default=['amd'] |
|
|
else: |
|
122 |
amd_path_default=None |
amd_path_default=None |
123 |
amd_lib_path_default=None |
amd_lib_path_default=None |
124 |
amd_libs_default=None |
amd_libs_default=None |
|
|
|
|
if os.path.isdir('/opt/UFconfig'): |
|
|
ufc_path_default='/opt/UFconfig' |
|
|
else: |
|
125 |
ufc_path_default=None |
ufc_path_default=None |
126 |
|
# |
127 |
|
#========================================================================== |
128 |
|
# |
129 |
|
# python installation: |
130 |
|
# |
131 |
|
python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1])) |
132 |
|
python_lib_path_default=os.path.join(tools_prefix,'lib') |
133 |
|
python_lib_default="python%s.%s"%(sys.version_info[0],sys.version_info[1]) |
134 |
|
|
135 |
|
#========================================================================== |
136 |
|
# |
137 |
|
# boost installation: |
138 |
|
# |
139 |
|
boost_path_default=os.path.join(tools_prefix,'include') |
140 |
|
boost_lib_path_default=os.path.join(tools_prefix,'lib') |
141 |
|
boost_lib_default=['boost_python'] |
142 |
|
|
143 |
|
#========================================================================== |
144 |
|
# |
145 |
|
# check if netCDF is installed on the system: |
146 |
|
# |
147 |
|
netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3') |
148 |
|
netCDF_lib_path_default=os.path.join(tools_prefix,'lib') |
149 |
|
|
150 |
|
if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default): |
151 |
|
useNetCDF_default='yes' |
152 |
|
netCDF_libs_default=[ 'netcdf_c++', 'netcdf' ] |
153 |
|
else: |
154 |
|
useNetCDF_default='no' |
155 |
|
netCDF_path_default=None |
156 |
|
netCDF_lib_path_default=None |
157 |
|
netCDF_libs_default=None |
158 |
|
|
159 |
|
#========================================================================== |
160 |
|
# |
161 |
|
# MPI: |
162 |
|
# |
163 |
|
if IS_WINDOWS_PLATFORM: |
164 |
|
useMPI_default='no' |
165 |
|
mpi_path_default=None |
166 |
|
mpi_lib_path_default=None |
167 |
|
mpi_libs_default=[] |
168 |
|
mpi_run_default=None |
169 |
|
else: |
170 |
|
useMPI_default='no' |
171 |
|
mpi_root='/usr/local' |
172 |
|
mpi_path_default=os.path.join(mpi_root,'include') |
173 |
|
mpi_lib_path_default=os.path.join(mpi_root,'lib') |
174 |
|
mpi_libs_default=[ 'mpich' , 'pthread', 'rt' ] |
175 |
|
mpi_run_default='mpiexec -np 1' |
176 |
|
# |
177 |
|
#========================================================================== |
178 |
|
# |
179 |
|
# compile: |
180 |
|
# |
181 |
|
cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi' |
182 |
|
cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi' |
183 |
|
cxx_flags_default='--no-warn -ansi' |
184 |
|
cxx_flags_debug_default='--no-warn -ansi -DDOASSERT' |
185 |
|
|
186 |
if os.path.isdir('/usr/local/include') and os.path.isdir('/usr/local/lib'): |
#============================================================================================== |
|
netCDF_path_default='/usr/local/include' |
|
|
netCDF_lib_path_default='/usr/local/lib' |
|
|
netCDF_libs_cxx_default=[ 'netcdf_c++', 'netcdf'] |
|
|
else: |
|
|
netCDF_path_default=None |
|
|
netCDF_lib_path_default=None |
|
|
netCDF_libs_cxx_default=None |
|
187 |
# Default options and options help text |
# Default options and options help text |
188 |
# These are defaults and can be overridden using command line arguments or an options file. |
# These are defaults and can be overridden using command line arguments or an options file. |
189 |
# if the options_file or ARGUMENTS do not exist then the ones listed as default here are used |
# if the options_file or ARGUMENTS do not exist then the ones listed as default here are used |
190 |
# DO NOT CHANGE THEM HERE |
# DO NOT CHANGE THEM HERE |
|
if ARGUMENTS.get('options_file',0): |
|
|
options_file = ARGUMENTS.get('options_file',0) |
|
|
else: |
|
|
from string import ascii_letters,digits |
|
|
hostname="" |
|
|
for s in socket.gethostname().split('.')[0]: |
|
|
if s in ascii_letters+digits: |
|
|
hostname+=s |
|
|
else: |
|
|
hostname+="_" |
|
|
options_file = "scons/"+hostname+"_options.py" |
|
|
if os.path.isfile(options_file): |
|
|
print "option file is ",options_file,"." |
|
|
else: |
|
|
print "option file is ",options_file, "(not present)." |
|
|
|
|
|
opts = Options(options_file, ARGUMENTS) |
|
191 |
opts.AddOptions( |
opts.AddOptions( |
192 |
# Where to install esys stuff |
# Where to install esys stuff |
193 |
('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'), |
('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'), |
194 |
('libinstall', 'where the esys libraries will be installed', Dir('#.').abspath+'/lib'), |
('libinstall', 'where the esys libraries will be installed', dir_libraries), |
195 |
('pyinstall', 'where the esys python modules will be installed', Dir('#.').abspath), |
('pyinstall', 'where the esys python modules will be installed', dir_packages), |
196 |
('src_zipfile', 'the source zip file will be installed.', Dir('#.').abspath+"/release/escript_src.zip"), |
('exinstall', 'where the esys examples will be installed', dir_examples), |
197 |
('test_zipfile', 'the test zip file will be installed.', Dir('#.').abspath+"/release/escript_tests.zip"), |
('sys_libinstall', 'where the system esys libraries will be installed', sys_dir_libraries), |
198 |
('src_tarfile', 'the source tar file will be installed.', Dir('#.').abspath+"/release/escript_src.tar.gz"), |
('sys_pyinstall', 'where the system esys python modules will be installed', sys_dir_packages), |
199 |
('test_tarfile', 'the test tar file will be installed.', Dir('#.').abspath+"/release/escript_tests.tar.gz"), |
('sys_exinstall', 'where the system esys examples will be installed', sys_dir_examples), |
200 |
('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"), |
('src_zipfile', 'the source zip file will be installed.', Dir('#.').abspath+"/release/escript_src.zip"), |
201 |
('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"), |
('test_zipfile', 'the test zip file will be installed.', Dir('#.').abspath+"/release/escript_tests.zip"), |
202 |
('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"), |
('src_tarfile', 'the source tar file will be installed.', Dir('#.').abspath+"/release/escript_src.tar.gz"), |
203 |
('api_epydoc', 'name of the epydoc api docs directory',Dir('#.').abspath+"/release/doc/epydoc"), |
('test_tarfile', 'the test tar file will be installed.', Dir('#.').abspath+"/release/escript_tests.tar.gz"), |
204 |
('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"), |
('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"), |
205 |
|
('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"), |
206 |
|
('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"), |
207 |
|
('api_epydoc', 'name of the epydoc api docs directory', Dir('#.').abspath+"/release/doc/epydoc"), |
208 |
|
('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"), |
209 |
|
('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"), |
210 |
# Compilation options |
# Compilation options |
211 |
BoolOption('dodebug', 'Do you want a debug build?', 'no'), |
BoolOption('dodebug', 'Do you want a debug build?', 'no'), |
212 |
('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/hostname_options.py)", options_file), |
BoolOption('bounds_check', 'Do you want extra array bounds checking?', 'no'), |
213 |
|
('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/<hostname>_options.py)", options_file), |
214 |
('cc_defines','C/C++ defines to use', None), |
('cc_defines','C/C++ defines to use', None), |
215 |
('cc_flags','C compiler flags to use (Release build)', '-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors'), |
('cc_flags','C compiler flags to use (Release build)', cc_flags_default), |
216 |
('cc_flags_debug', 'C compiler flags to use (Debug build)', '-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi -pedantic-errors'), |
('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default), |
217 |
('cxx_flags', 'C++ compiler flags to use (Release build)', '--no-warn -ansi'), |
('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default), |
218 |
('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', '--no-warn -ansi -DDOASSERT -DDOPROF'), |
('cxx_flags_debug', 'C++ compiler flags to use (Debug build)', cxx_flags_debug_default), |
219 |
('cc_flags_MPI','C compiler flags to use (Release MPI build)', '-O3 -ftz -IPF_ftlacc- -IPF_fma -fno-alias -fno-alias -c99 -w1 -fpic -wd161'), |
('omp_flags', 'OpenMP compiler flags to use (Release build)', ''), |
220 |
('cc_flags_debug_MPI', 'C compiler flags to use (Debug MPI build)', '-g -O0 -c99 -w1 -fpic -wd161'), |
('omp_flags_debug', 'OpenMP compiler flags to use (Debug build)', ''), |
|
('cxx_flags_MPI', 'C++ compiler flags to use (Release MPI build)', '-ansi -wd1563 -wd161'), |
|
|
('cxx_flags_debug_MPI', 'C++ compiler flags to use (Debug MPI build)', '-ansi -DDOASSERT -DDOPROF -wd1563 -wd161'), |
|
221 |
('ar_flags', 'Static library archiver flags to use', None), |
('ar_flags', 'Static library archiver flags to use', None), |
222 |
('sys_libs', 'System libraries to link with', None), |
('sys_libs', 'System libraries to link with', None), |
223 |
('tar_flags','flags for zip files','-c -z'), |
('tar_flags','flags for zip files','-c -z'), |
239 |
PathOption('amd_path', 'Path to AMD includes', amd_path_default), |
PathOption('amd_path', 'Path to AMD includes', amd_path_default), |
240 |
PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default), |
PathOption('amd_lib_path', 'Path to AMD libs', amd_lib_path_default), |
241 |
('amd_libs', 'AMD libraries to link with', amd_libs_default), |
('amd_libs', 'AMD libraries to link with', amd_libs_default), |
242 |
|
# TRILINOS |
243 |
|
PathOption('trilinos_path', 'Path to TRILINOS includes', None), |
244 |
|
PathOption('trilinos_lib_path', 'Path to TRILINOS libs', None), |
245 |
|
('trilinos_libs', 'TRILINOS libraries to link with', None), |
246 |
# BLAS |
# BLAS |
247 |
PathOption('blas_path', 'Path to BLAS includes', None), |
PathOption('blas_path', 'Path to BLAS includes', None), |
248 |
PathOption('blas_lib_path', 'Path to BLAS libs', None), |
PathOption('blas_lib_path', 'Path to BLAS libs', None), |
249 |
('blas_libs', 'BLAS libraries to link with', None), |
('blas_libs', 'BLAS libraries to link with', None), |
250 |
# netCDF |
# netCDF |
251 |
('useNetCDF', 'switch on/off the usage of netCDF', 'yes'), |
('useNetCDF', 'switch on/off the usage of netCDF', useNetCDF_default), |
252 |
PathOption('netCDF_path', 'Path to netCDF includes', netCDF_path_default), |
PathOption('netCDF_path', 'Path to netCDF includes', netCDF_path_default), |
253 |
PathOption('netCDF_lib_path', 'Path to netCDF libs', netCDF_lib_path_default), |
PathOption('netCDF_lib_path', 'Path to netCDF libs', netCDF_lib_path_default), |
254 |
('netCDF_libs_cxx', 'netCDF C++ libraries to link with', netCDF_libs_cxx_default), |
('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default), |
255 |
# Python |
# Python |
256 |
# locations of include files for python |
# locations of include files for python |
257 |
PathOption('python_path', 'Path to Python includes', '/usr/include/python%s.%s'%(sys.version_info[0],sys.version_info[1])), |
# FIXME: python_path should be python_inc_path and the same for boost etc. |
258 |
PathOption('python_lib_path', 'Path to Python libs', '/usr/lib'), |
PathOption('python_path', 'Path to Python includes', python_path_default), |
259 |
('python_lib', 'Python libraries to link with', ["python%s.%s"%(sys.version_info[0],sys.version_info[1]),]), |
PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default), |
260 |
|
('python_lib', 'Python libraries to link with', python_lib_default), |
261 |
|
('python_cmd', 'Python command', 'python'), |
262 |
# Boost |
# Boost |
263 |
PathOption('boost_path', 'Path to Boost includes', '/usr/include'), |
PathOption('boost_path', 'Path to Boost includes', boost_path_default), |
264 |
PathOption('boost_lib_path', 'Path to Boost libs', '/usr/lib'), |
PathOption('boost_lib_path', 'Path to Boost libs', boost_lib_path_default), |
265 |
('boost_lib', 'Boost libraries to link with', ['boost_python',]), |
('boost_lib', 'Boost libraries to link with', boost_lib_default), |
266 |
# Doc building |
# Doc building |
267 |
# PathOption('doxygen_path', 'Path to Doxygen executable', None), |
# PathOption('doxygen_path', 'Path to Doxygen executable', None), |
268 |
# PathOption('epydoc_path', 'Path to Epydoc executable', None), |
# PathOption('epydoc_path', 'Path to Epydoc executable', None), |
270 |
PathOption('papi_path', 'Path to PAPI includes', None), |
PathOption('papi_path', 'Path to PAPI includes', None), |
271 |
PathOption('papi_lib_path', 'Path to PAPI libs', None), |
PathOption('papi_lib_path', 'Path to PAPI libs', None), |
272 |
('papi_libs', 'PAPI libraries to link with', None), |
('papi_libs', 'PAPI libraries to link with', None), |
273 |
|
('papi_instrument_solver', 'use PAPI in Solver.c to instrument each iteration of the solver', None), |
274 |
# MPI |
# MPI |
275 |
BoolOption('useMPI', 'Compile parallel version using MPI', 'no'), |
BoolOption('useMPI', 'Compile parallel version using MPI', useMPI_default), |
276 |
|
('MPICH_IGNORE_CXX_SEEK', 'name of macro to ignore MPI settings of C++ SEEK macro (for MPICH)' , 'MPICH_IGNORE_CXX_SEEK'), |
277 |
|
PathOption('mpi_path', 'Path to MPI includes', mpi_path_default), |
278 |
|
('mpi_run', 'mpirun name' , mpi_run_default), |
279 |
|
PathOption('mpi_lib_path', 'Path to MPI libs (needs to be added to the LD_LIBRARY_PATH)',mpi_lib_path_default), |
280 |
|
('mpi_libs', 'MPI libraries to link with (needs to be shared!)', mpi_libs_default) |
281 |
) |
) |
282 |
# Note: On the Altix the intel compilers are not automatically |
#================================================================================================= |
283 |
# detected by scons intelc.py script. The Altix has a different directory |
# |
284 |
# path and in some locations the "modules" facility is used to support |
# Note: On the Altix the intel compilers are not automatically |
285 |
# multiple compiler versions. This forces the need to import the users PATH |
# detected by scons intelc.py script. The Altix has a different directory |
286 |
# environment which isn't the "scons way" |
# path and in some locations the "modules" facility is used to support |
287 |
# 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) |
# multiple compiler versions. This forces the need to import the users PATH |
288 |
# FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix |
# environment which isn't the "scons way" |
289 |
|
# 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) |
290 |
if os.name != "nt" and os.uname()[4]=='ia64': |
# FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix |
291 |
env = Environment(tools = ['default', 'intelc'], options = opts) |
# |
292 |
if env['CXX'] == 'icpc': |
|
293 |
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 |
if IS_WINDOWS_PLATFORM: |
294 |
elif os.name == "nt": |
env = Environment(tools = ['default', 'msvc'], options = opts) |
295 |
env = Environment(tools = ['default', 'msvc'], options = opts) |
else: |
296 |
#env = Environment(tools = ['default', 'intelc'], options = opts) |
if os.uname()[4]=='ia64': |
297 |
else: |
env = Environment(tools = ['default', 'intelc'], options = opts) |
298 |
env = Environment(tools = ['default'], options = opts) |
if env['CXX'] == 'icpc': |
299 |
# Initialise Scons Build Environment |
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 |
300 |
# check for user environment variables we are interested in |
else: |
301 |
|
env = Environment(tools = ['default'], options = opts) |
302 |
|
Help(opts.GenerateHelpText(env)) |
303 |
|
|
304 |
|
if env['bounds_check']: |
305 |
|
env.Append(CPPDEFINES = [ 'BOUNDS_CHECK' ]) |
306 |
|
env.Append(CXXDEFINES = [ 'BOUNDS_CHECK' ]) |
307 |
|
bounds_check = env['bounds_check'] |
308 |
|
else: |
309 |
|
bounds_check = 0 |
310 |
|
|
311 |
|
#================================================================================================= |
312 |
|
# |
313 |
|
# Initialise Scons Build Environment |
314 |
|
# check for user environment variables we are interested in |
315 |
try: |
try: |
316 |
python_path = os.environ['PYTHONPATH'] |
tmp = os.environ['PYTHONPATH'] |
317 |
env['ENV']['PYTHONPATH'] = python_path |
env['ENV']['PYTHONPATH'] = tmp |
318 |
except KeyError: |
except KeyError: |
319 |
python_path = '' |
pass |
320 |
|
|
321 |
|
env.PrependENVPath('PYTHONPATH', source_root) |
322 |
|
|
323 |
|
try: |
324 |
|
omp_num_threads = os.environ['OMP_NUM_THREADS'] |
325 |
|
except KeyError: |
326 |
|
omp_num_threads = 1 |
327 |
|
env['ENV']['OMP_NUM_THREADS'] = omp_num_threads |
328 |
|
|
329 |
try: |
try: |
330 |
path = os.environ['PATH'] |
path = os.environ['PATH'] |
331 |
env['ENV']['PATH'] = path |
env['ENV']['PATH'] = path |
332 |
except KeyError: |
except KeyError: |
333 |
path = '' |
omp_num_threads = 1 |
334 |
|
|
335 |
|
env['ENV']['OMP_NUM_THREADS'] = omp_num_threads |
336 |
|
|
337 |
|
|
338 |
|
# Copy some variables from the system environment to the build environment |
339 |
try: |
try: |
340 |
ld_library_path = os.environ['LD_LIBRARY_PATH'] |
env['ENV']['DISPLAY'] = os.environ['DISPLAY'] |
341 |
env['ENV']['LD_LIBRARY_PATH'] = ld_library_path |
env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY'] |
342 |
|
home_temp = os.environ['HOME'] # MPICH2's mpd needs $HOME to find $HOME/.mpd.conf |
343 |
|
env['ENV']['HOME'] = home_temp |
344 |
except KeyError: |
except KeyError: |
345 |
ld_library_path = '' |
pass |
|
|
|
346 |
|
|
347 |
# Setup help for options |
try: |
348 |
Help(opts.GenerateHelpText(env)) |
tmp = os.environ['PATH'] |
349 |
|
env['ENV']['PATH'] = tmp |
350 |
|
except KeyError: |
351 |
|
pass |
352 |
|
|
353 |
# Add some customer builders |
try: |
354 |
|
tmp = os.environ['LD_LIBRARY_PATH'] |
355 |
|
print tmp |
356 |
|
env['ENV']['LD_LIBRARY_PATH'] = tmp |
357 |
|
except KeyError: |
358 |
|
pass |
359 |
|
#========================================================================== |
360 |
|
# |
361 |
|
# Add some customer builders |
362 |
|
# |
363 |
py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True) |
py_builder = Builder(action = scons_extensions.build_py, suffix = '.pyc', src_suffix = '.py', single_source=True) |
364 |
env.Append(BUILDERS = {'PyCompile' : py_builder}); |
env.Append(BUILDERS = {'PyCompile' : py_builder}); |
365 |
|
|
366 |
if env['PLATFORM'] == "win32": |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', |
367 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True) |
src_suffix=env['PROGSUFFIX'], single_source=True) |
368 |
else: |
|
|
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True) |
|
369 |
env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder}); |
env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder}); |
370 |
|
|
371 |
runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True) |
runPyUnitTest_builder = Builder(action = scons_extensions.runPyUnitTest, suffix = '.passed', src_suffic='.py', single_source=True) |
379 |
incinstall = None |
incinstall = None |
380 |
try: |
try: |
381 |
libinstall = env['libinstall'] |
libinstall = env['libinstall'] |
382 |
env.Append(LIBPATH = [libinstall,]) |
env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so |
383 |
env.PrependENVPath('LD_LIBRARY_PATH', libinstall) |
env.PrependENVPath('LD_LIBRARY_PATH', libinstall) |
384 |
if env['PLATFORM'] == "win32": |
if IS_WINDOWS_PLATFORM : |
385 |
env.PrependENVPath('PATH', libinstall) |
env.PrependENVPath('PATH', libinstall) |
386 |
env.PrependENVPath('PATH', env['boost_lib_path']) |
env.PrependENVPath('PATH', env['boost_lib_path']) |
387 |
except KeyError: |
except KeyError: |
388 |
libinstall = None |
libinstall = None |
389 |
try: |
try: |
390 |
pyinstall = env['pyinstall']+'/esys' # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc |
pyinstall = env['pyinstall'] # all targets will install into pyinstall/esys but PYTHONPATH points at straight pyinstall so you go import esys.escript etc |
|
env.PrependENVPath('PYTHONPATH', env['pyinstall']) |
|
391 |
except KeyError: |
except KeyError: |
392 |
pyinstall = None |
pyinstall = None |
393 |
|
|
394 |
|
try: |
395 |
|
cc_defines = env['cc_defines'] |
396 |
|
env.Append(CPPDEFINES = cc_defines) |
397 |
|
except KeyError: |
398 |
|
pass |
399 |
|
try: |
400 |
|
flags = env['ar_flags'] |
401 |
|
env.Append(ARFLAGS = flags) |
402 |
|
except KeyError: |
403 |
|
ar_flags = None |
404 |
|
try: |
405 |
|
sys_libs = env['sys_libs'] |
406 |
|
except KeyError: |
407 |
|
sys_libs = [] |
408 |
|
|
409 |
|
try: |
410 |
|
tar_flags = env['tar_flags'] |
411 |
|
env.Replace(TARFLAGS = tar_flags) |
412 |
|
except KeyError: |
413 |
|
pass |
414 |
|
|
415 |
|
try: |
416 |
|
exinstall = env['exinstall'] |
417 |
|
except KeyError: |
418 |
|
exinstall = None |
419 |
|
try: |
420 |
|
sys_libinstall = env['sys_libinstall'] |
421 |
|
except KeyError: |
422 |
|
sys_libinstall = None |
423 |
|
try: |
424 |
|
sys_pyinstall = env['sys_pyinstall'] |
425 |
|
except KeyError: |
426 |
|
sys_pyinstall = None |
427 |
|
try: |
428 |
|
sys_exinstall = env['sys_exinstall'] |
429 |
|
except KeyError: |
430 |
|
sys_exinstall = None |
431 |
|
|
432 |
|
# ====================== debugging =================================== |
433 |
try: |
try: |
434 |
dodebug = env['dodebug'] |
dodebug = env['dodebug'] |
435 |
except KeyError: |
except KeyError: |
436 |
dodebug = None |
dodebug = None |
437 |
|
|
438 |
|
# === switch on omp =================================================== |
439 |
try: |
try: |
440 |
useMPI = env['useMPI'] |
omp_flags = env['omp_flags'] |
441 |
except KeyError: |
except KeyError: |
442 |
useMPI = None |
omp_flags = '' |
443 |
|
|
444 |
try: |
try: |
445 |
cc_defines = env['cc_defines'] |
omp_flags_debug = env['omp_flags_debug'] |
|
env.Append(CPPDEFINES = cc_defines) |
|
446 |
except KeyError: |
except KeyError: |
447 |
pass |
omp_flags_debug = '' |
448 |
|
|
449 |
if 'shake71' == socket.gethostname().split('.')[0]: |
# ========= use mpi? ===================================================== |
450 |
if useMPI: |
try: |
451 |
env['CC'] = 'mpicc' |
useMPI = env['useMPI'] |
452 |
env['CXX'] = 'mpiCC' |
except KeyError: |
453 |
|
useMPI = None |
454 |
|
# ========= set compiler flags =========================================== |
455 |
|
|
456 |
|
# Can't use MPI and OpenMP simultaneously at this time |
457 |
|
if useMPI: |
458 |
|
omp_flags='' |
459 |
|
omp_flags_debug='' |
460 |
|
|
461 |
if dodebug: |
if dodebug: |
|
if useMPI: |
|
|
try: |
|
|
flags = env['cc_flags_debug_MPI'] |
|
|
env.Append(CCFLAGS = flags) |
|
|
except KeyError: |
|
|
pass |
|
|
else: |
|
462 |
try: |
try: |
463 |
flags = env['cc_flags_debug'] |
flags = env['cc_flags_debug'] + ' ' + omp_flags_debug |
464 |
env.Append(CCFLAGS = flags) |
env.Append(CCFLAGS = flags) |
465 |
except KeyError: |
except KeyError: |
466 |
pass |
pass |
467 |
else: |
else: |
|
if useMPI: |
|
|
try: |
|
|
flags = env['cc_flags_MPI'] |
|
|
env.Append(CCFLAGS = flags) |
|
|
except KeyError: |
|
|
pass |
|
|
else: |
|
468 |
try: |
try: |
469 |
flags = env['cc_flags'] |
flags = env['cc_flags'] + ' ' + omp_flags |
470 |
env.Append(CCFLAGS = flags) |
env.Append(CCFLAGS = flags) |
471 |
except KeyError: |
except KeyError: |
472 |
pass |
pass |
473 |
if dodebug: |
if dodebug: |
|
if useMPI: |
|
|
try: |
|
|
flags = env['cxx_flags_debug_MPI'] |
|
|
env.Append(CXXFLAGS = flags) |
|
|
except KeyError: |
|
|
pass |
|
|
else: |
|
474 |
try: |
try: |
475 |
flags = env['cxx_flags_debug'] |
flags = env['cxx_flags_debug'] |
476 |
env.Append(CXXFLAGS = flags) |
env.Append(CXXFLAGS = flags) |
477 |
except KeyError: |
except KeyError: |
478 |
pass |
pass |
479 |
else: |
else: |
|
if useMPI: |
|
|
try: |
|
|
flags = env['cxx_flags_MPI'] |
|
|
env.Append(CXXFLAGS = flags) |
|
|
except KeyError: |
|
|
pass |
|
|
else: |
|
480 |
try: |
try: |
481 |
flags = env['cxx_flags'] |
flags = env['cxx_flags'] |
482 |
env.Append(CXXFLAGS = flags) |
env.Append(CXXFLAGS = flags) |
483 |
except KeyError: |
except KeyError: |
484 |
pass |
pass |
485 |
try: |
try: |
486 |
flags = env['ar_flags'] |
if env['CC'] == 'gcc': env.Append(CCFLAGS = "-pedantic-errors -Wno-long-long") |
487 |
env.Append(ARFLAGS = flags) |
except: |
488 |
except KeyError: |
pass |
489 |
ar_flags = None |
|
490 |
try: |
# ============= Remember what options were used in the compile ===================================== |
491 |
sys_libs = env['sys_libs'] |
if not IS_WINDOWS_PLATFORM: |
492 |
except KeyError: |
env.Execute("/bin/rm -f " + libinstall + "/Compiled.with.*") |
493 |
sys_libs = '' |
if dodebug: env.Execute("touch " + libinstall + "/Compiled.with.debug") |
494 |
|
if useMPI: env.Execute("touch " + libinstall + "/Compiled.with.mpi") |
495 |
|
if omp_flags != '': env.Execute("touch " + libinstall + "/Compiled.with.OpenMP") |
496 |
|
if bounds_check: env.Execute("touch " + libinstall + "/Compiled.with.bounds_check") |
497 |
|
|
498 |
try: |
# ============= set mkl (but only of no MPI) ===================================== |
499 |
tar_flags = env['tar_flags'] |
if not useMPI: |
500 |
env.Replace(TARFLAGS = tar_flags) |
try: |
501 |
except KeyError: |
includes = env['mkl_path'] |
502 |
pass |
env.Append(CPPPATH = [includes,]) |
503 |
|
except KeyError: |
504 |
try: |
pass |
|
includes = env['mkl_path'] |
|
|
env.Append(CPPPATH = [includes,]) |
|
|
except KeyError: |
|
|
pass |
|
505 |
|
|
506 |
try: |
try: |
507 |
lib_path = env['mkl_lib_path'] |
lib_path = env['mkl_lib_path'] |
508 |
env.Append(LIBPATH = [lib_path,]) |
env.Append(LIBPATH = [lib_path,]) |
509 |
except KeyError: |
env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path |
510 |
pass |
except KeyError: |
511 |
|
pass |
512 |
|
|
|
if useMPI: |
|
|
mkl_libs = '' |
|
|
else: |
|
513 |
try: |
try: |
514 |
mkl_libs = env['mkl_libs'] |
mkl_libs = env['mkl_libs'] |
515 |
except KeyError: |
except KeyError: |
516 |
mkl_libs = '' |
mkl_libs = [] |
517 |
|
else: |
518 |
|
mkl_libs = [] |
519 |
|
|
520 |
|
# ============= set scsl (but only of no MPI) ===================================== |
521 |
|
if not useMPI: |
522 |
|
try: |
523 |
|
includes = env['scsl_path'] |
524 |
|
env.Append(CPPPATH = [includes,]) |
525 |
|
except KeyError: |
526 |
|
pass |
527 |
|
|
528 |
try: |
try: |
529 |
includes = env['scsl_path'] |
lib_path = env['scsl_lib_path'] |
530 |
env.Append(CPPPATH = [includes,]) |
env.Append(LIBPATH = [lib_path,]) |
531 |
except KeyError: |
env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path |
532 |
pass |
except KeyError: |
533 |
|
pass |
534 |
|
|
535 |
|
try: |
536 |
|
scsl_libs = env['scsl_libs'] |
537 |
|
except KeyError: |
538 |
|
scsl_libs = [ ] |
539 |
|
|
540 |
try: |
else: |
541 |
lib_path = env['scsl_lib_path'] |
scsl_libs = [] |
|
env.Append(LIBPATH = [lib_path,]) |
|
|
except KeyError: |
|
|
pass |
|
542 |
|
|
543 |
|
# ============= set TRILINOS (but only with MPI) ===================================== |
544 |
if useMPI: |
if useMPI: |
545 |
try: |
try: |
546 |
scsl_libs = env['scsl_libs_MPI'] |
includes = env['trilinos_path'] |
547 |
except KeyError: |
env.Append(CPPPATH = [includes,]) |
548 |
scsl_libs = '' |
except KeyError: |
549 |
else: |
pass |
|
try: |
|
|
scsl_libs = env['scsl_libs'] |
|
|
except KeyError: |
|
|
scsl_libs = '' |
|
|
|
|
|
try: |
|
|
includes = env['umf_path'] |
|
|
env.Append(CPPPATH = [includes,]) |
|
|
except KeyError: |
|
|
pass |
|
550 |
|
|
551 |
try: |
try: |
552 |
lib_path = env['umf_lib_path'] |
lib_path = env['trilinos_lib_path'] |
553 |
env.Append(LIBPATH = [lib_path,]) |
env.Append(LIBPATH = [lib_path,]) |
554 |
except KeyError: |
except KeyError: |
555 |
pass |
pass |
556 |
|
|
557 |
if useMPI: |
try: |
558 |
umf_libs = '' |
trilinos_libs = env['trilinos_libs'] |
559 |
|
except KeyError: |
560 |
|
trilinos_libs = [] |
561 |
else: |
else: |
562 |
|
trilinos_libs = [] |
563 |
|
|
564 |
|
|
565 |
|
# ============= set umfpack (but only without MPI) ===================================== |
566 |
|
umf_libs=[ ] |
567 |
|
if not useMPI: |
568 |
|
try: |
569 |
|
includes = env['umf_path'] |
570 |
|
env.Append(CPPPATH = [includes,]) |
571 |
|
except KeyError: |
572 |
|
pass |
573 |
|
|
574 |
|
try: |
575 |
|
lib_path = env['umf_lib_path'] |
576 |
|
env.Append(LIBPATH = [lib_path,]) |
577 |
|
except KeyError: |
578 |
|
pass |
579 |
|
|
580 |
try: |
try: |
581 |
umf_libs = env['umf_libs'] |
umf_libs = env['umf_libs'] |
582 |
|
umf_libs+=umf_libs |
583 |
except KeyError: |
except KeyError: |
584 |
umf_libs = '' |
pass |
585 |
|
|
586 |
try: |
try: |
587 |
includes = env['ufc_path'] |
includes = env['ufc_path'] |
588 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
589 |
except KeyError: |
except KeyError: |
590 |
pass |
pass |
591 |
|
|
592 |
try: |
try: |
593 |
includes = env['amd_path'] |
includes = env['amd_path'] |
594 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
595 |
except KeyError: |
except KeyError: |
596 |
pass |
pass |
597 |
|
|
598 |
try: |
try: |
599 |
lib_path = env['amd_lib_path'] |
lib_path = env['amd_lib_path'] |
600 |
env.Append(LIBPATH = [lib_path,]) |
env.Append(LIBPATH = [lib_path,]) |
601 |
except KeyError: |
except KeyError: |
602 |
pass |
pass |
603 |
|
|
|
if useMPI: |
|
|
amd_libs = '' |
|
|
else: |
|
604 |
try: |
try: |
605 |
amd_libs = env['amd_libs'] |
amd_libs = env['amd_libs'] |
606 |
|
umf_libs+=amd_libs |
607 |
|
except KeyError: |
608 |
|
pass |
609 |
|
|
610 |
|
# ============= set TRILINOS (but only with MPI) ===================================== |
611 |
|
if useMPI: |
612 |
|
try: |
613 |
|
includes = env['trilinos_path'] |
614 |
|
env.Append(CPPPATH = [includes,]) |
615 |
except KeyError: |
except KeyError: |
616 |
amd_libs = '' |
pass |
617 |
|
|
618 |
|
try: |
619 |
|
lib_path = env['trilinos_lib_path'] |
620 |
|
env.Append(LIBPATH = [lib_path,]) |
621 |
|
except KeyError: |
622 |
|
pass |
623 |
|
|
624 |
|
try: |
625 |
|
trilinos_libs = env['trilinos_libs'] |
626 |
|
except KeyError: |
627 |
|
trilinos_libs = [] |
628 |
|
else: |
629 |
|
trilinos_libs = [] |
630 |
|
|
631 |
|
# ============= set blas ===================================== |
632 |
try: |
try: |
633 |
includes = env['blas_path'] |
includes = env['blas_path'] |
634 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
644 |
try: |
try: |
645 |
blas_libs = env['blas_libs'] |
blas_libs = env['blas_libs'] |
646 |
except KeyError: |
except KeyError: |
647 |
blas_libs = '' |
blas_libs = [ ] |
648 |
|
|
649 |
|
# ========== netcdf ==================================== |
650 |
try: |
try: |
651 |
useNetCDF = env['useNetCDF'] |
useNetCDF = env['useNetCDF'] |
652 |
except KeyError: |
except KeyError: |
653 |
useNetCDF = 'yes' |
useNetCDF = 'yes' |
654 |
pass |
pass |
655 |
|
|
|
if not useNetCDF == 'yes': |
|
|
print "Warning: Installation is not configured with netCDF. Some I/O function may not be available." |
|
|
|
|
656 |
if useNetCDF == 'yes': |
if useNetCDF == 'yes': |
657 |
try: |
try: |
658 |
includes = env['netCDF_path'] |
netCDF_libs = env['netCDF_libs'] |
|
env.Append(CPPPATH = [includes,]) |
|
659 |
except KeyError: |
except KeyError: |
660 |
pass |
pass |
661 |
|
|
662 |
|
env.Append(LIBS = netCDF_libs) |
663 |
|
env.Append(CPPDEFINES = [ 'USE_NETCDF' ]) |
664 |
try: |
try: |
665 |
lib_path = env['netCDF_lib_path'] |
includes = env['netCDF_path'] |
666 |
env.Append(LIBPATH = [lib_path,]) |
env.Append(CPPPATH = [includes,]) |
667 |
except KeyError: |
except KeyError: |
668 |
pass |
pass |
669 |
|
|
670 |
try: |
try: |
671 |
netCDF_libs_cxx = env['netCDF_libs_cxx'] |
lib_path = env['netCDF_lib_path'] |
672 |
|
env.Append(LIBPATH = [ lib_path, ]) |
673 |
|
env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path |
674 |
|
if IS_WINDOWS_PLATFORM : |
675 |
|
env.PrependENVPath('PATH', lib_path) |
676 |
except KeyError: |
except KeyError: |
677 |
netCDF_libs_cxx = [ ] |
pass |
678 |
else: |
else: |
679 |
netCDF_libs_cxx=[ ] |
print "Warning: Installation is not configured with netCDF. Some I/O function may not be available." |
680 |
|
netCDF_libs=[ ] |
681 |
|
|
682 |
|
# ====================== boost ====================================== |
683 |
try: |
try: |
684 |
includes = env['boost_path'] |
includes = env['boost_path'] |
685 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
688 |
try: |
try: |
689 |
lib_path = env['boost_lib_path'] |
lib_path = env['boost_lib_path'] |
690 |
env.Append(LIBPATH = [lib_path,]) |
env.Append(LIBPATH = [lib_path,]) |
691 |
|
env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path |
692 |
|
if IS_WINDOWS_PLATFORM : |
693 |
|
env.PrependENVPath('PATH', lib_path) |
694 |
except KeyError: |
except KeyError: |
695 |
pass |
pass |
696 |
try: |
try: |
697 |
boost_lib = env['boost_lib'] |
boost_lib = env['boost_lib'] |
698 |
except KeyError: |
except KeyError: |
699 |
boost_lib = None |
boost_lib = None |
700 |
|
# ====================== python ====================================== |
701 |
try: |
try: |
702 |
includes = env['python_path'] |
includes = env['python_path'] |
703 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
705 |
pass |
pass |
706 |
try: |
try: |
707 |
lib_path = env['python_lib_path'] |
lib_path = env['python_lib_path'] |
708 |
|
env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path |
709 |
env.Append(LIBPATH = [lib_path,]) |
env.Append(LIBPATH = [lib_path,]) |
710 |
except KeyError: |
except KeyError: |
711 |
pass |
pass |
713 |
python_lib = env['python_lib'] |
python_lib = env['python_lib'] |
714 |
except KeyError: |
except KeyError: |
715 |
python_lib = None |
python_lib = None |
716 |
|
# =============== documentation ======================================= |
717 |
try: |
try: |
718 |
doxygen_path = env['doxygen_path'] |
doxygen_path = env['doxygen_path'] |
719 |
except KeyError: |
except KeyError: |
722 |
epydoc_path = env['epydoc_path'] |
epydoc_path = env['epydoc_path'] |
723 |
except KeyError: |
except KeyError: |
724 |
epydoc_path = None |
epydoc_path = None |
725 |
|
# =============== PAPI ======================================= |
726 |
|
try: |
727 |
|
includes = env['papi_path'] |
728 |
|
env.Append(CPPPATH = [includes,]) |
729 |
|
except KeyError: |
730 |
|
pass |
731 |
|
try: |
732 |
|
lib_path = env['papi_lib_path'] |
733 |
|
env.Append(LIBPATH = [lib_path,]) |
734 |
|
except KeyError: |
735 |
|
pass |
736 |
|
try: |
737 |
|
papi_libs = env['papi_libs'] |
738 |
|
except KeyError: |
739 |
|
papi_libs = None |
740 |
|
# ============= set mpi ===================================== |
741 |
|
if useMPI: |
742 |
|
env.Append(CPPDEFINES=['PASO_MPI',]) |
743 |
|
try: |
744 |
|
includes = env['mpi_path'] |
745 |
|
env.Append(CPPPATH = [includes,]) |
746 |
|
except KeyError: |
747 |
|
pass |
748 |
|
try: |
749 |
|
lib_path = env['mpi_lib_path'] |
750 |
|
env.Append(LIBPATH = [lib_path,]) |
751 |
|
env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path |
752 |
|
except KeyError: |
753 |
|
pass |
754 |
|
try: |
755 |
|
mpi_libs = env['mpi_libs'] |
756 |
|
except KeyError: |
757 |
|
mpi_libs = [] |
758 |
|
|
759 |
|
try: |
760 |
|
mpi_run = env['mpi_run'] |
761 |
|
except KeyError: |
762 |
|
mpi_run = '' |
763 |
|
|
764 |
|
try: |
765 |
|
mpich_ignore_cxx_seek=env['MPICH_IGNORE_CXX_SEEK'] |
766 |
|
env.Append(CPPDEFINES = [ mpich_ignore_cxx_seek ] ) |
767 |
|
except KeyError: |
768 |
|
pass |
769 |
|
else: |
770 |
|
mpi_libs=[] |
771 |
|
mpi_run = mpi_run_default |
772 |
|
# =========== zip files =========================================== |
773 |
try: |
try: |
774 |
includes = env['papi_path'] |
includes = env['papi_path'] |
775 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
784 |
papi_libs = env['papi_libs'] |
papi_libs = env['papi_libs'] |
785 |
except KeyError: |
except KeyError: |
786 |
papi_libs = None |
papi_libs = None |
787 |
|
try: |
788 |
|
papi_instrument_solver = env['papi_instrument_solver'] |
789 |
|
except KeyError: |
790 |
|
papi_instrument_solver = None |
791 |
|
|
792 |
|
|
793 |
|
# ============= and some helpers ===================================== |
794 |
|
try: |
795 |
|
doxygen_path = env['doxygen_path'] |
796 |
|
except KeyError: |
797 |
|
doxygen_path = None |
798 |
|
try: |
799 |
|
epydoc_path = env['epydoc_path'] |
800 |
|
except KeyError: |
801 |
|
epydoc_path = None |
802 |
try: |
try: |
803 |
src_zipfile = env.File(env['src_zipfile']) |
src_zipfile = env.File(env['src_zipfile']) |
804 |
except KeyError: |
except KeyError: |
840 |
except KeyError: |
except KeyError: |
841 |
api_epydoc = None |
api_epydoc = None |
842 |
|
|
843 |
# Zipgets |
try: |
844 |
|
api_doxygen = env.Dir(env['api_doxygen']) |
845 |
|
except KeyError: |
846 |
|
api_doxygen = None |
847 |
|
|
848 |
env.Default(libinstall) |
try: |
849 |
env.Default(incinstall) |
svn_pipe = os.popen("svnversion -n .") |
850 |
env.Default(pyinstall) |
global_revision = svn_pipe.readlines() |
851 |
|
svn_pipe.close() |
852 |
|
global_revision = re.sub(":.*", "", global_revision[0]) |
853 |
|
global_revision = re.sub("[^0-9]", "", global_revision) |
854 |
|
except: |
855 |
|
global_revision="-1" |
856 |
|
print "Warning: unable to recover global revsion number." |
857 |
|
print "Revision number is %s."%global_revision |
858 |
|
env.Append(CPPDEFINES = "SVN_VERSION="+global_revision) |
859 |
|
|
860 |
|
# Python install - esys __init__.py |
861 |
|
init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET')) |
862 |
|
|
863 |
|
# FIXME: exinstall and friends related to examples are not working. |
864 |
|
build_target = env.Alias('build',[libinstall,incinstall,pyinstall,init_target]) |
865 |
|
|
866 |
|
env.Default(build_target) |
867 |
|
|
868 |
|
# Zipgets |
869 |
env.Alias('release_src',[ src_zipfile, src_tarfile ]) |
env.Alias('release_src',[ src_zipfile, src_tarfile ]) |
870 |
env.Alias('release_tests',[ test_zipfile, test_tarfile]) |
env.Alias('release_tests',[ test_zipfile, test_tarfile]) |
871 |
env.Alias('release_examples',[ examples_zipfile, examples_tarfile]) |
env.Alias('release_examples',[ examples_zipfile, examples_tarfile]) |
872 |
|
env.Alias('examples_zipfile',examples_zipfile) |
873 |
|
env.Alias('examples_tarfile',examples_tarfile) |
874 |
env.Alias('api_epydoc',api_epydoc) |
env.Alias('api_epydoc',api_epydoc) |
875 |
|
env.Alias('api_doxygen',api_doxygen) |
876 |
|
env.Alias('guide_html_index',guide_html_index) |
877 |
env.Alias('guide_pdf', guide_pdf) |
env.Alias('guide_pdf', guide_pdf) |
878 |
env.Alias('docs',[ 'release_examples', 'guide_pdf', guide_html_index, api_epydoc]) |
env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index]) |
879 |
env.Alias('release', ['release_src', 'release_tests', 'docs']) |
env.Alias('release', ['release_src', 'release_tests', 'docs']) |
880 |
env.Alias('build_tests') # target to build all C++ tests |
|
881 |
env.Alias('build_py_tests') # target to build all python tests |
env.Alias('build_tests',build_target) # target to build all C++ tests |
882 |
|
env.Alias('build_py_tests',build_target) # target to build all python tests |
883 |
env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests |
env.Alias('build_all_tests', [ 'build_tests', 'build_py_tests' ] ) # target to build all python tests |
884 |
env.Alias('run_tests', 'build_tests') # target to run all C++ test |
env.Alias('run_tests', 'build_tests') # target to run all C++ test |
885 |
env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests |
env.Alias('py_tests', 'build_py_tests') # taget to run all released python tests |
886 |
env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests |
env.Alias('all_tests', ['run_tests', 'py_tests']) # target to run all C++ and released python tests |
887 |
|
|
|
# Python install - esys __init__.py |
|
|
init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET')) |
|
|
env.Alias(init_target) |
|
888 |
|
|
889 |
# Allow sconscripts to see the env |
# Allow sconscripts to see the env |
890 |
Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", "netCDF_libs_cxx", "useNetCDF", |
Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "blas_libs", "netCDF_libs", "useNetCDF", "mpi_run", |
891 |
"boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs", |
"boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs", |
892 |
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile", |
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile", "trilinos_libs", "mpi_libs", "papi_instrument_solver", |
893 |
"guide_pdf", "guide_html_index", "api_epydoc", "useMPI"]) |
"guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ]) |
894 |
|
|
895 |
# End initialisation section |
# End initialisation section |
896 |
# Begin configuration section |
# Begin configuration section |
897 |
# adds this file and the scons option directore to the source tar |
# adds this file and the scons option directore to the source tar |
898 |
release_srcfiles=[env.File('SConstruct'),]+[ env.File(x) for x in glob.glob('scons/*.py') ] |
release_srcfiles=[env.File('SConstruct'),env.Dir('lib'),env.Dir('include'),]+[ env.File(x) for x in glob.glob('scons/*.py') ] |
899 |
release_testfiles=[env.File('README_TESTS'),] |
release_testfiles=[env.File('README_TESTS'),] |
900 |
env.Zip(src_zipfile, release_srcfiles) |
env.Zip(src_zipfile, release_srcfiles) |
901 |
env.Zip(test_zipfile, release_testfiles) |
env.Zip(test_zipfile, release_testfiles) |
902 |
env.Tar(src_tarfile, release_srcfiles) |
try: |
903 |
env.Tar(test_tarfile, release_testfiles) |
env.Tar(src_tarfile, release_srcfiles) |
904 |
|
env.Tar(test_tarfile, release_testfiles) |
905 |
|
except AttributeError: |
906 |
|
pass |
907 |
# Insert new components to be build here |
# Insert new components to be build here |
908 |
# FIXME: might be nice to replace this verbosity with a list of targets and some |
# FIXME: might be nice to replace this verbosity with a list of targets and some |
909 |
# FIXME: nifty python to create the lengthy but very similar env.Sconscript lines |
# FIXME: nifty python to create the lengthy but very similar env.Sconscript lines |
920 |
env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0) |
env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0) |
921 |
env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0) |
env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0) |
922 |
env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0) |
env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0) |
|
|
|
|
# added by Ben Cumming |
|
923 |
env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0) |
env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0) |
924 |
#env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0) |
#env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0) |
925 |
|
|
926 |
|
|
927 |
|
syslib_install_target = env.installDirectory(sys_libinstall,libinstall) |
928 |
|
syspy_install_target = env.installDirectory(sys_pyinstall,pyinstall,recursive=True) |
929 |
|
|
930 |
|
install_target = env.Alias("install", env.Flatten([syslib_install_target, syspy_install_target]) ) |