1 |
# Copyright 2006 by ACcESS MNRF |
# Copyright 2006 by ACcESS MNRF |
2 |
# |
# |
3 |
# http://www.access.edu.au |
# http://www.access.edu.au |
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 |
|
# import tools: |
17 |
import glob |
import glob |
18 |
import sys, os |
import sys, os |
19 |
import socket |
import socket |
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: |
#=============================================================== |
25 |
if os.path.isdir('/opt/UMFPACK/Include') and os.path.isdir('/opt/UMFPACK/Lib'): |
# check on windows or linux platform |
26 |
umf_path_default='/opt/UMFPACK/Include' |
# |
27 |
umf_lib_path_default='/opt/UMFPACK/Lib' |
IS_WINDOWS_PLATFORM = (os.name== "nt") |
|
umf_libs_default=['umfpack'] |
|
|
else: |
|
|
umf_path_default=None |
|
|
umf_lib_path_default=None |
|
|
umf_libs_default=None |
|
28 |
|
|
29 |
if os.path.isdir('/opt/AMD/Include') and os.path.isdir('/opt/AMD/Lib'): |
if IS_WINDOWS_PLATFORM: |
30 |
amd_path_default='/opt/AMD/Include' |
tools_prefix="C:\\Program Files\\" |
|
amd_lib_path_default='/opt/AMD/Lib' |
|
|
amd_libs_default=['amd'] |
|
31 |
else: |
else: |
32 |
amd_path_default=None |
tools_prefix="/usr" |
|
amd_lib_path_default=None |
|
|
amd_libs_default=None |
|
33 |
|
|
34 |
if os.path.isdir('/opt/UFconfig'): |
#============================================================================================== |
35 |
ufc_path_default='/opt/UFconfig' |
# |
36 |
else: |
# get the installation prefix |
37 |
ufc_path_default=None |
# |
38 |
|
prefix = ARGUMENTS.get('prefix', Dir('#.').abspath) |
39 |
|
|
40 |
|
# We may also need to know where python's site-packages subdirectory lives |
41 |
|
python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1]) |
42 |
|
|
43 |
|
if prefix == "/usr": |
44 |
|
# Install as a standard python package in /usr/lib64 if available, else in /usr/lib |
45 |
|
if os.path.isdir( prefix+"/lib64/"+python_version+"/site-packages"): |
46 |
|
dir_packages = prefix+"/lib64/"+python_version+"/site-packages" |
47 |
|
dir_libraries = prefix+"/lib64" |
48 |
|
elif os.path.isdir(prefix+"/lib/"+python_version+"/site-packages"): |
49 |
|
dir_packages = prefix+"/lib/"+python_version+"/site-packages" |
50 |
|
dir_libraries = prefix+"/lib" |
51 |
|
else: |
52 |
|
print "Install prefix is /usr but couldn't find python package directory in either" |
53 |
|
print "/usr/lib64/"+python_version+"/site-packages or /usr/lib/"+python_version+"/site-packages" |
54 |
|
sys.exit(1) |
55 |
|
dir_examples = prefix+"/share/doc/esys" |
56 |
|
else: |
57 |
|
# Install using the usual escript directory structure |
58 |
|
dir_packages = prefix |
59 |
|
dir_libraries = prefix+"/lib" |
60 |
|
dir_examples = prefix |
61 |
|
dir_packages += "/esys" |
62 |
|
dir_examples += "/examples" |
63 |
|
|
64 |
|
print "Install prefix is: ", prefix |
65 |
|
print " python packages will be installed in: ", dir_packages |
66 |
|
print " libraries will be installed in: ", dir_libraries |
67 |
|
print " examples will be installed in: ", dir_examples |
68 |
|
|
69 |
|
#============================================================================================== |
70 |
|
|
71 |
# Default options and options help text |
# Default options and options help text |
72 |
# 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. |
73 |
# 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 |
74 |
# DO NOT CHANGE THEM HERE |
# DO NOT CHANGE THEM HERE |
75 |
|
# Where to install? |
76 |
|
#============================================================================================== |
77 |
|
# |
78 |
|
# get the options file if present: |
79 |
|
# |
80 |
if ARGUMENTS.get('options_file',0): |
if ARGUMENTS.get('options_file',0): |
81 |
options_file = ARGUMENTS.get('options_file',0) |
options_file = ARGUMENTS.get('options_file',0) |
82 |
else: |
else: |
87 |
hostname+=s |
hostname+=s |
88 |
else: |
else: |
89 |
hostname+="_" |
hostname+="_" |
90 |
options_file = "scons/"+hostname+"_options.py" |
options_file = os.path.join("scons",hostname+"_options.py") |
91 |
|
|
92 |
|
if os.path.isfile(options_file): |
93 |
|
print "option file is ",options_file,"." |
94 |
|
else: |
95 |
|
print "option file is ",options_file, "(not present)." |
96 |
|
# and load it |
97 |
opts = Options(options_file, ARGUMENTS) |
opts = Options(options_file, ARGUMENTS) |
98 |
|
#================================================================ |
99 |
|
# |
100 |
|
# check if UMFPACK is installed on the system: |
101 |
|
# |
102 |
|
uf_root=None |
103 |
|
for i in [ 'UMFPACK', 'umfpack', 'ufsparse', 'UFSPARSE']: |
104 |
|
if os.path.isdir(os.path.join(tools_prefix,'include',i)): |
105 |
|
uf_root=i |
106 |
|
print i," is used form ",tools_prefix |
107 |
|
break |
108 |
|
if not uf_root==None: |
109 |
|
umf_path_default=os.path.join(tools_prefix,'include',uf_root) |
110 |
|
umf_lib_path_default=os.path.join(tools_prefix,'lib') |
111 |
|
umf_libs_default=['umfpack'] |
112 |
|
amd_path_default=os.path.join(tools_prefix,'include',uf_root) |
113 |
|
amd_lib_path_default=os.path.join(tools_prefix,'lib') |
114 |
|
amd_libs_default=['amd'] |
115 |
|
ufc_path_default=os.path.join(tools_prefix,'include',uf_root) |
116 |
|
else: |
117 |
|
umf_path_default=None |
118 |
|
umf_lib_path_default=None |
119 |
|
umf_libs_default=None |
120 |
|
amd_path_default=None |
121 |
|
amd_lib_path_default=None |
122 |
|
amd_libs_default=None |
123 |
|
ufc_path_default=None |
124 |
|
# |
125 |
|
#========================================================================== |
126 |
|
# |
127 |
|
# python installation: |
128 |
|
# |
129 |
|
if IS_WINDOWS_PLATFORM: |
130 |
|
python_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"include") |
131 |
|
python_lib_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"libs") |
132 |
|
python_libs_default=["python%s%s"%(sys.version_info[0],sys.version_info[1])] |
133 |
|
else: |
134 |
|
python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1])) |
135 |
|
python_lib_path_default=os.path.join(tools_prefix,'lib') |
136 |
|
python_libs_default=["python%s.%s"%(sys.version_info[0],sys.version_info[1])] |
137 |
|
|
138 |
|
#========================================================================== |
139 |
|
# |
140 |
|
# boost installation: |
141 |
|
# |
142 |
|
if IS_WINDOWS_PLATFORM: |
143 |
|
boost_libs_path_default=os.path.join(tools_prefix,'boost','lib') |
144 |
|
boost_libs_default=None |
145 |
|
for i in os.listdir(boost_libs_path_default): |
146 |
|
name=os.path.splitext(i) |
147 |
|
if name[1] == ".dll" and name[0].startswith("boost_python"): |
148 |
|
if boost_libs_default == None: |
149 |
|
boost_libs_default= [ name[0] ] |
150 |
|
else: |
151 |
|
if not name[0].find("-gd-"): boost_libs_default=[ name[0] ] |
152 |
|
boost_path_default=os.path.join(tools_prefix,'boost','include','boost-%s'%(boost_libs_default[0].split("-")[-1],)) |
153 |
|
else: |
154 |
|
boost_path_default=os.path.join(tools_prefix,'include') |
155 |
|
boost_libs_path_default=os.path.join(tools_prefix,'lib') |
156 |
|
boost_libs_default=['boost_python'] |
157 |
|
#========================================================================== |
158 |
|
# |
159 |
|
# check if netCDF is installed on the system: |
160 |
|
# |
161 |
|
if IS_WINDOWS_PLATFORM: |
162 |
|
netcdf_dir=os.path.join(tools_prefix,'netcdf') |
163 |
|
netCDF_path_default=os.path.join(netcdf_dir,'include') |
164 |
|
netCDF_lib_path_default=os.path.join(netcdf_dir,'lib') |
165 |
|
else: |
166 |
|
netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3') |
167 |
|
netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3') |
168 |
|
|
169 |
|
if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default): |
170 |
|
useNetCDF_default='yes' |
171 |
|
netCDF_libs_default=[ 'netcdf_c++', 'netcdf' ] |
172 |
|
else: |
173 |
|
useNetCDF_default='no' |
174 |
|
netCDF_path_default=None |
175 |
|
netCDF_lib_path_default=None |
176 |
|
netCDF_libs_default=None |
177 |
|
|
178 |
|
if IS_WINDOWS_PLATFORM: |
179 |
|
useNetCDF_default='no' # be default netcdf is not supported on windows. |
180 |
|
#========================================================================== |
181 |
|
# |
182 |
|
# compile: |
183 |
|
# |
184 |
|
if IS_WINDOWS_PLATFORM: |
185 |
|
# cc_flags_default = '/GR /EHsc /MD /Qc99 /Qopenmp /Qopenmp-report1 /O3 /G7 /Qprec /Qpar-report1 /QxP /QaxP' |
186 |
|
# cc_flags_debug_default = '/Od /MDd /RTC1 /GR /EHsc /Qc99 /Qopenmp /Qopenmp-report1 /Qprec' |
187 |
|
cc_flags_default = '/nologo /EHsc /GR /wd4068 /O2 /Op /MT /W3 /Ob0 /Z7' |
188 |
|
cc_flags_debug_default ='/nologo /EHsc /GR /wd4068 /Od /RTC1 /MTd /ZI /Ob0 /Z7' |
189 |
|
|
190 |
|
cc_flags_default = '/nologo /EHsc /GR /O2 /MT /W3 /Ob0 /Z7 /wd4068' |
191 |
|
cc_flags_debug_default ='/nologo /EHsc /GR /Od /RTC1 /MTd /W3 /Ob0 /Z7/wd4068' |
192 |
|
cxx_flags_default = '' |
193 |
|
cxx_flags_debug_default = '' |
194 |
|
cc_common_flags = '/FD /EHsc /GR /wd4068 ' |
195 |
|
else: |
196 |
|
cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
197 |
|
cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
198 |
|
cxx_flags_default='--no-warn -ansi' |
199 |
|
cxx_flags_debug_default='--no-warn -ansi -DDOASSERT' |
200 |
|
#============================================================================================== |
201 |
|
# Default options and options help text |
202 |
|
# These are defaults and can be overridden using command line arguments or an options file. |
203 |
|
# if the options_file or ARGUMENTS do not exist then the ones listed as default here are used |
204 |
|
# DO NOT CHANGE THEM HERE |
205 |
opts.AddOptions( |
opts.AddOptions( |
206 |
# Where to install esys stuff |
# Where to install esys stuff |
207 |
('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'), |
('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'), |
208 |
('libinstall', 'where the esys libraries will be installed', Dir('#.').abspath+'/lib'), |
('libinstall', 'where the esys libraries will be installed', dir_libraries), |
209 |
('pyinstall', 'where the esys python modules will be installed', Dir('#.').abspath), |
('pyinstall', 'where the esys python modules will be installed', dir_packages), |
210 |
('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), |
211 |
('test_zipfile', 'the test zip file will be installed.', Dir('#.').abspath+"/release/escript_tests.zip"), |
('src_zipfile', 'the source zip file will be installed.', Dir('#.').abspath+"/release/escript_src.zip"), |
212 |
('src_tarfile', 'the source tar file will be installed.', Dir('#.').abspath+"/release/escript_src.tar.gz"), |
('test_zipfile', 'the test zip file will be installed.', Dir('#.').abspath+"/release/escript_tests.zip"), |
213 |
('test_tarfile', 'the test tar file will be installed.', Dir('#.').abspath+"/release/escript_tests.tar.gz"), |
('src_tarfile', 'the source tar file will be installed.', Dir('#.').abspath+"/release/escript_src.tar.gz"), |
214 |
('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"), |
('test_tarfile', 'the test tar file will be installed.', Dir('#.').abspath+"/release/escript_tests.tar.gz"), |
215 |
('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"), |
('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"), |
216 |
('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"), |
('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"), |
217 |
('api_epydoc', 'name of the epydoc api docs directory',Dir('#.').abspath+"/release/doc/epydoc"), |
('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"), |
218 |
('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"), |
('api_epydoc', 'name of the epydoc api docs directory', Dir('#.').abspath+"/release/doc/epydoc"), |
219 |
|
('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"), |
220 |
|
('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"), |
221 |
# Compilation options |
# Compilation options |
222 |
BoolOption('dodebug', 'Do you want a debug build?', 'no'), |
BoolOption('dodebug', 'Do you want a debug build?', 'no'), |
223 |
('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/hostname_options.py)", options_file), |
('options_file', "Optional file containing preferred options. Ignored if it doesn't exist (default: scons/<hostname>_options.py)", options_file), |
224 |
('cc_defines','C/C++ defines to use', None), |
('cc_defines','C/C++ defines to use', None), |
225 |
('cc_flags','C compiler flags to use (Release build)', '-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas'), |
('cc_flags','C compiler flags to use (Release build)', cc_flags_default), |
226 |
('cc_flags_debug', 'C compiler flags to use (Debug build)', '-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas'), |
('cc_flags_debug', 'C compiler flags to use (Debug build)', cc_flags_debug_default), |
227 |
('cxx_flags', 'C++ compiler flags to use (Release build)', '--no-warn -ansi'), |
('cxx_flags', 'C++ compiler flags to use (Release build)', cxx_flags_default), |
228 |
('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), |
|
('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'), |
|
|
('cc_flags_debug_MPI', 'C compiler flags to use (Debug MPI build)', '-g -O0 -c99 -w1 -fpic -wd161'), |
|
|
('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'), |
|
229 |
('ar_flags', 'Static library archiver flags to use', None), |
('ar_flags', 'Static library archiver flags to use', None), |
230 |
('sys_libs', 'System libraries to link with', None), |
('sys_libs', 'System libraries to link with', None), |
231 |
('tar_flags','flags for zip files','-c -z'), |
('tar_flags','flags for zip files','-c -z'), |
251 |
PathOption('blas_path', 'Path to BLAS includes', None), |
PathOption('blas_path', 'Path to BLAS includes', None), |
252 |
PathOption('blas_lib_path', 'Path to BLAS libs', None), |
PathOption('blas_lib_path', 'Path to BLAS libs', None), |
253 |
('blas_libs', 'BLAS libraries to link with', None), |
('blas_libs', 'BLAS libraries to link with', None), |
254 |
|
# netCDF |
255 |
|
('useNetCDF', 'switch on/off the usage of netCDF', useNetCDF_default), |
256 |
|
PathOption('netCDF_path', 'Path to netCDF includes', netCDF_path_default), |
257 |
|
PathOption('netCDF_lib_path', 'Path to netCDF libs', netCDF_lib_path_default), |
258 |
|
('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default), |
259 |
# Python |
# Python |
260 |
# locations of include files for python |
# locations of include files for python |
261 |
PathOption('python_path', 'Path to Python includes', '/usr/include/python%s.%s'%(sys.version_info[0],sys.version_info[1])), |
PathOption('python_path', 'Path to Python includes', python_path_default), |
262 |
PathOption('python_lib_path', 'Path to Python libs', '/usr/lib'), |
PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default), |
263 |
('python_lib', 'Python libraries to link with', ["python%s.%s"%(sys.version_info[0],sys.version_info[1]),]), |
('python_libs', 'Python libraries to link with', python_libs_default), |
264 |
# Boost |
# Boost |
265 |
PathOption('boost_path', 'Path to Boost includes', '/usr/include'), |
PathOption('boost_path', 'Path to Boost includes', boost_path_default), |
266 |
PathOption('boost_lib_path', 'Path to Boost libs', '/usr/lib'), |
PathOption('boost_libs_path', 'Path to Boost libs', boost_libs_path_default), |
267 |
('boost_lib', 'Boost libraries to link with', ['boost_python',]), |
('boost_libs', 'Boost libraries to link with', boost_libs_default), |
268 |
# Doc building |
# Doc building |
269 |
# PathOption('doxygen_path', 'Path to Doxygen executable', None), |
# PathOption('doxygen_path', 'Path to Doxygen executable', None), |
270 |
# PathOption('epydoc_path', 'Path to Epydoc executable', None), |
# PathOption('epydoc_path', 'Path to Epydoc executable', None), |
275 |
# MPI |
# MPI |
276 |
BoolOption('useMPI', 'Compile parallel version using MPI', 'no'), |
BoolOption('useMPI', 'Compile parallel version using MPI', 'no'), |
277 |
) |
) |
278 |
|
#================================================================================================= |
279 |
# Initialise Scons Build Environment |
# |
280 |
# check for user environment variables we are interested in |
# Note: On the Altix the intel compilers are not automatically |
281 |
|
# detected by scons intelc.py script. The Altix has a different directory |
282 |
|
# path and in some locations the "modules" facility is used to support |
283 |
|
# multiple compiler versions. This forces the need to import the users PATH |
284 |
|
# environment which isn't the "scons way" |
285 |
|
# This doesn't impact linux and windows which will use the default compiler (g++ or msvc, or the intel compiler if it is installed on both platforms) |
286 |
|
# FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix |
287 |
|
# |
288 |
|
if IS_WINDOWS_PLATFORM: |
289 |
|
env = Environment(tools = ['default', 'msvc'], options = opts) |
290 |
|
else: |
291 |
|
if os.uname()[4]=='ia64': |
292 |
|
env = Environment(tools = ['default', 'intelc'], options = opts) |
293 |
|
if env['CXX'] == 'icpc': |
294 |
|
env['LINK'] = env['CXX'] # version >=9 of intel c++ compiler requires use of icpc to link in C++ runtimes (icc does not). FIXME: this behaviour could be directly incorporated into scons intelc.py |
295 |
|
else: |
296 |
|
env = Environment(tools = ['default'], options = opts) |
297 |
|
Help(opts.GenerateHelpText(env)) |
298 |
|
#================================================================================================= |
299 |
|
# |
300 |
|
# Initialise Scons Build Environment |
301 |
|
# check for user environment variables we are interested in |
302 |
try: |
try: |
303 |
python_path = os.environ['PYTHONPATH'] |
python_path = os.environ['PYTHONPATH'] |
304 |
|
env['ENV']['PYTHONPATH'] = python_path |
305 |
except KeyError: |
except KeyError: |
306 |
python_path = '' |
python_path = '' |
307 |
|
|
308 |
|
try: |
309 |
|
omp_num_threads = os.environ['OMP_NUM_THREADS'] |
310 |
|
except KeyError: |
311 |
|
omp_num_threads = 1 |
312 |
|
env['ENV']['OMP_NUM_THREADS'] = omp_num_threads |
313 |
|
|
314 |
|
try: |
315 |
|
env['ENV']['DISPLAY'] = os.environ['DISPLAY'] |
316 |
|
env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY'] |
317 |
|
except KeyError: |
318 |
|
pass |
319 |
|
|
320 |
try: |
try: |
321 |
path = os.environ['PATH'] |
path = os.environ['PATH'] |
322 |
|
env['ENV']['PATH'] = path |
323 |
except KeyError: |
except KeyError: |
324 |
path = '' |
path = '' |
325 |
try: |
try: |
326 |
ld_library_path = os.environ['LD_LIBRARY_PATH'] |
ld_library_path = os.environ['LD_LIBRARY_PATH'] |
327 |
|
env['ENV']['LD_LIBRARY_PATH'] = ld_library_path |
328 |
except KeyError: |
except KeyError: |
329 |
ld_library_path = '' |
ld_library_path = '' |
330 |
|
#========================================================================== |
331 |
# Note: On the Altix the intel compilers are not automatically |
# |
332 |
# detected by scons intelc.py script. The Altix has a different directory |
# Add some customer builders |
333 |
# path and in some locations the "modules" facility is used to support |
# |
|
# multiple compiler versions. This forces the need to import the users PATH |
|
|
# environment which isn't the "scons way" |
|
|
# 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) |
|
|
# FIXME: Perhaps a modification to intelc.py will allow better support for ia64 on altix |
|
|
|
|
|
if os.name != "nt" and os.uname()[4]=='ia64': |
|
|
env = Environment(ENV = {'PATH':path}, tools = ['default', 'intelc'], options = opts) |
|
|
env['ENV']['PATH'] = path |
|
|
env['ENV']['LD_LIBRARY_PATH'] = ld_library_path |
|
|
env['ENV']['PYTHONPATH'] = python_path |
|
|
if env['CXX'] == 'icpc': |
|
|
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 |
|
|
elif os.name == "nt": |
|
|
env = Environment(tools = ['default', 'intelc'], options = opts) |
|
|
env['ENV']['PYTHONPATH'] = python_path |
|
|
else: |
|
|
env = Environment(tools = ['default'], options = opts) |
|
|
env['ENV']['PATH'] = path |
|
|
env['ENV']['LD_LIBRARY_PATH'] = ld_library_path |
|
|
env['ENV']['PYTHONPATH'] = python_path |
|
|
|
|
|
# Setup help for options |
|
|
Help(opts.GenerateHelpText(env)) |
|
|
|
|
|
# Add some customer builders |
|
334 |
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) |
335 |
env.Append(BUILDERS = {'PyCompile' : py_builder}); |
env.Append(BUILDERS = {'PyCompile' : py_builder}); |
336 |
|
|
337 |
if env['PLATFORM'] == "win32": |
if IS_WINDOWS_PLATFORM: |
338 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True) |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True) |
339 |
else: |
else: |
340 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True) |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True) |
351 |
incinstall = None |
incinstall = None |
352 |
try: |
try: |
353 |
libinstall = env['libinstall'] |
libinstall = env['libinstall'] |
354 |
env.Append(LIBPATH = [libinstall,]) |
env.Append(LIBPATH = [libinstall,]) # Adds -L for building of libescript.so libfinley.so escriptcpp.so finleycpp.so |
355 |
env.PrependENVPath('LD_LIBRARY_PATH', libinstall) |
env.PrependENVPath('LD_LIBRARY_PATH', libinstall) |
356 |
if env['PLATFORM'] == "win32": |
if env['PLATFORM'] == "win32": |
357 |
env.PrependENVPath('PATH', libinstall) |
env.PrependENVPath('PATH', libinstall) |
358 |
env.PrependENVPath('PATH', env['boost_lib_path']) |
env.PrependENVPath('PATH', env['boost_libs_path']) |
359 |
except KeyError: |
except KeyError: |
360 |
libinstall = None |
libinstall = None |
361 |
try: |
try: |
362 |
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 |
363 |
env.PrependENVPath('PYTHONPATH', env['pyinstall']) |
env.PrependENVPath('PYTHONPATH', env['pyinstall']) |
364 |
except KeyError: |
except KeyError: |
365 |
pyinstall = None |
pyinstall = None |
366 |
try: |
try: |
367 |
|
exinstall = env['exinstall'] |
368 |
|
except KeyError: |
369 |
|
exinstall = None |
370 |
|
try: |
371 |
dodebug = env['dodebug'] |
dodebug = env['dodebug'] |
372 |
except KeyError: |
except KeyError: |
373 |
dodebug = None |
dodebug = None |
381 |
except KeyError: |
except KeyError: |
382 |
pass |
pass |
383 |
|
|
|
if 'shake71' == socket.gethostname().split('.')[0]: |
|
|
if useMPI: |
|
|
env['CC'] = 'mpicc' |
|
|
env['CXX'] = 'mpiCC' |
|
|
|
|
384 |
if dodebug: |
if dodebug: |
385 |
if useMPI: |
if useMPI: |
386 |
try: |
try: |
441 |
try: |
try: |
442 |
sys_libs = env['sys_libs'] |
sys_libs = env['sys_libs'] |
443 |
except KeyError: |
except KeyError: |
444 |
sys_libs = '' |
sys_libs = [] |
445 |
|
|
446 |
try: |
try: |
447 |
tar_flags = env['tar_flags'] |
tar_flags = env['tar_flags'] |
462 |
pass |
pass |
463 |
|
|
464 |
if useMPI: |
if useMPI: |
465 |
mkl_libs = '' |
mkl_libs = [] |
466 |
else: |
else: |
467 |
try: |
try: |
468 |
mkl_libs = env['mkl_libs'] |
mkl_libs = env['mkl_libs'] |
469 |
except KeyError: |
except KeyError: |
470 |
mkl_libs = '' |
mkl_libs = [] |
471 |
|
|
472 |
try: |
try: |
473 |
includes = env['scsl_path'] |
includes = env['scsl_path'] |
485 |
try: |
try: |
486 |
scsl_libs = env['scsl_libs_MPI'] |
scsl_libs = env['scsl_libs_MPI'] |
487 |
except KeyError: |
except KeyError: |
488 |
scsl_libs = '' |
scsl_libs = [] |
489 |
else: |
else: |
490 |
try: |
try: |
491 |
scsl_libs = env['scsl_libs'] |
scsl_libs = env['scsl_libs'] |
492 |
except KeyError: |
except KeyError: |
493 |
scsl_libs = '' |
scsl_libs = [] |
494 |
|
|
495 |
try: |
try: |
496 |
includes = env['umf_path'] |
includes = env['umf_path'] |
505 |
pass |
pass |
506 |
|
|
507 |
if useMPI: |
if useMPI: |
508 |
umf_libs = '' |
umf_libs = [] |
509 |
else: |
else: |
510 |
try: |
try: |
511 |
umf_libs = env['umf_libs'] |
umf_libs = env['umf_libs'] |
512 |
except KeyError: |
except KeyError: |
513 |
umf_libs = '' |
umf_libs = [] |
514 |
|
|
515 |
try: |
try: |
516 |
includes = env['ufc_path'] |
includes = env['ufc_path'] |
531 |
pass |
pass |
532 |
|
|
533 |
if useMPI: |
if useMPI: |
534 |
amd_libs = '' |
amd_libs = [] |
535 |
else: |
else: |
536 |
try: |
try: |
537 |
amd_libs = env['amd_libs'] |
amd_libs = env['amd_libs'] |
538 |
except KeyError: |
except KeyError: |
539 |
amd_libs = '' |
amd_libs = [] |
540 |
|
|
541 |
try: |
try: |
542 |
includes = env['blas_path'] |
includes = env['blas_path'] |
553 |
try: |
try: |
554 |
blas_libs = env['blas_libs'] |
blas_libs = env['blas_libs'] |
555 |
except KeyError: |
except KeyError: |
556 |
blas_libs = '' |
blas_libs = [] |
557 |
|
|
558 |
|
try: |
559 |
|
useNetCDF = env['useNetCDF'] |
560 |
|
except KeyError: |
561 |
|
useNetCDF = 'yes' |
562 |
|
pass |
563 |
|
|
564 |
|
if not useNetCDF == 'yes': |
565 |
|
print "Warning: Installation is not configured with netCDF. Some I/O function may not be available." |
566 |
|
|
567 |
|
if useNetCDF == 'yes': |
568 |
|
try: |
569 |
|
includes = env['netCDF_path'] |
570 |
|
env.Append(CPPPATH = [includes,]) |
571 |
|
except KeyError: |
572 |
|
pass |
573 |
|
|
574 |
|
try: |
575 |
|
lib_path = env['netCDF_lib_path'] |
576 |
|
if IS_WINDOWS_PLATFORM: env['ENV']['PATH']+=";"+lib_path |
577 |
|
env.Append(LIBPATH = [ lib_path, ]) |
578 |
|
except KeyError: |
579 |
|
pass |
580 |
|
|
581 |
|
try: |
582 |
|
netCDF_libs = env['netCDF_libs'] |
583 |
|
except KeyError: |
584 |
|
netCDF_libs = [ ] |
585 |
|
else: |
586 |
|
netCDF_libs=[ ] |
587 |
|
|
588 |
try: |
try: |
589 |
includes = env['boost_path'] |
includes = env['boost_path'] |
591 |
except KeyError: |
except KeyError: |
592 |
pass |
pass |
593 |
try: |
try: |
594 |
lib_path = env['boost_lib_path'] |
lib_path = env['boost_libs_path'] |
595 |
env.Append(LIBPATH = [lib_path,]) |
env.Append(LIBPATH = [lib_path,]) |
596 |
except KeyError: |
except KeyError: |
597 |
pass |
pass |
598 |
try: |
try: |
599 |
boost_lib = env['boost_lib'] |
boost_libs = env['boost_libs'] |
600 |
except KeyError: |
except KeyError: |
601 |
boost_lib = None |
boost_libs = None |
602 |
try: |
try: |
603 |
includes = env['python_path'] |
includes = env['python_path'] |
604 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
610 |
except KeyError: |
except KeyError: |
611 |
pass |
pass |
612 |
try: |
try: |
613 |
python_lib = env['python_lib'] |
python_libs = env['python_libs'] |
614 |
except KeyError: |
except KeyError: |
615 |
python_lib = None |
python_libs = None |
616 |
try: |
try: |
617 |
doxygen_path = env['doxygen_path'] |
doxygen_path = env['doxygen_path'] |
618 |
except KeyError: |
except KeyError: |
678 |
except KeyError: |
except KeyError: |
679 |
api_epydoc = None |
api_epydoc = None |
680 |
|
|
681 |
# Zipgets |
try: |
682 |
|
api_doxygen = env.Dir(env['api_doxygen']) |
683 |
|
except KeyError: |
684 |
|
api_doxygen = None |
685 |
|
|
686 |
|
# Zipgets |
687 |
env.Default(libinstall) |
env.Default(libinstall) |
688 |
env.Default(incinstall) |
env.Default(incinstall) |
689 |
env.Default(pyinstall) |
env.Default(pyinstall) |
690 |
|
### env.Default(exinstall) # ksteube this causes dependency error |
691 |
env.Alias('release_src',[ src_zipfile, src_tarfile ]) |
env.Alias('release_src',[ src_zipfile, src_tarfile ]) |
692 |
env.Alias('release_tests',[ test_zipfile, test_tarfile]) |
env.Alias('release_tests',[ test_zipfile, test_tarfile]) |
693 |
env.Alias('release_examples',[ examples_zipfile, examples_tarfile]) |
env.Alias('release_examples',[ examples_zipfile, examples_tarfile]) |
694 |
|
env.Alias('examples_zipfile',examples_zipfile) |
695 |
|
env.Alias('examples_tarfile',examples_tarfile) |
696 |
env.Alias('api_epydoc',api_epydoc) |
env.Alias('api_epydoc',api_epydoc) |
697 |
|
env.Alias('api_doxygen',api_doxygen) |
698 |
|
env.Alias('guide_html_index',guide_html_index) |
699 |
env.Alias('guide_pdf', guide_pdf) |
env.Alias('guide_pdf', guide_pdf) |
700 |
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]) |
701 |
env.Alias('release', ['release_src', 'release_tests', 'docs']) |
env.Alias('release', ['release_src', 'release_tests', 'docs']) |
702 |
env.Alias('build_tests') # target to build all C++ tests |
env.Alias('build_tests') # target to build all C++ tests |
703 |
env.Alias('build_py_tests') # target to build all python tests |
env.Alias('build_py_tests') # target to build all python tests |
711 |
env.Alias(init_target) |
env.Alias(init_target) |
712 |
|
|
713 |
# Allow sconscripts to see the env |
# Allow sconscripts to see the env |
714 |
Export(["env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", |
Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", "netCDF_libs", "useNetCDF", |
715 |
"boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs", |
"boost_libs", "python_libs", "doxygen_path", "epydoc_path", "papi_libs", |
716 |
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile", |
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile", |
717 |
"guide_pdf", "guide_html_index", "api_epydoc", "useMPI"]) |
"guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ]) |
718 |
|
|
719 |
# End initialisation section |
# End initialisation section |
720 |
# Begin configuration section |
# Begin configuration section |
723 |
release_testfiles=[env.File('README_TESTS'),] |
release_testfiles=[env.File('README_TESTS'),] |
724 |
env.Zip(src_zipfile, release_srcfiles) |
env.Zip(src_zipfile, release_srcfiles) |
725 |
env.Zip(test_zipfile, release_testfiles) |
env.Zip(test_zipfile, release_testfiles) |
726 |
env.Tar(src_tarfile, release_srcfiles) |
try: |
727 |
env.Tar(test_tarfile, release_testfiles) |
env.Tar(src_tarfile, release_srcfiles) |
728 |
|
env.Tar(test_tarfile, release_testfiles) |
729 |
|
except AttributeError: |
730 |
|
pass |
731 |
# Insert new components to be build here |
# Insert new components to be build here |
732 |
# 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 |
733 |
# 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 |
735 |
env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0) |
env.SConscript(dirs = ['tools/CppUnitTest/src'], build_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0) |
736 |
# C/C++ Libraries |
# C/C++ Libraries |
737 |
env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0) |
env.SConscript(dirs = ['paso/src'], build_dir='build/$PLATFORM/paso', duplicate=0) |
738 |
env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0) |
# bruce is removed for now as it doesn't really do anything |
739 |
|
# env.SConscript(dirs = ['bruce/src'], build_dir='build/$PLATFORM/bruce', duplicate=0) |
740 |
env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0) |
env.SConscript(dirs = ['escript/src'], build_dir='build/$PLATFORM/escript', duplicate=0) |
741 |
env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0) |
env.SConscript(dirs = ['esysUtils/src'], build_dir='build/$PLATFORM/esysUtils', duplicate=0) |
742 |
env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0) |
env.SConscript(dirs = ['finley/src'], build_dir='build/$PLATFORM/finley', duplicate=0) |
743 |
env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0) |
env.SConscript(dirs = ['modellib/py_src'], build_dir='build/$PLATFORM/modellib', duplicate=0) |
744 |
env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0) |
env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0) |
745 |
env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0) |
env.SConscript(dirs = ['pyvisi/py_src'], build_dir='build/$PLATFORM/pyvisi', duplicate=0) |
746 |
|
env.SConscript(dirs = ['pycad/py_src'], build_dir='build/$PLATFORM/pycad', duplicate=0) |
747 |
|
|
748 |
# added by Ben Cumming |
# added by Ben Cumming |
749 |
env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0) |
env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0) |