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