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 |
#=============================================================== |
#=============================================================== |
|
# check on windows or linux platform |
|
|
# |
|
|
IS_WINDOWS_PLATFORM = (os.name== "nt") |
|
24 |
|
|
25 |
if IS_WINDOWS_PLATFORM: |
tools_prefix="/usr" |
|
tools_prefix="C:\\Program Files\\" |
|
|
else: |
|
|
tools_prefix="/usr" |
|
26 |
|
|
27 |
#============================================================================================== |
#============================================================================================== |
28 |
# |
# |
29 |
# get the installation prefix |
# get the installation prefix |
30 |
# |
# |
31 |
prefix = ARGUMENTS.get('prefix', Dir('#.').abspath) |
prefix = ARGUMENTS.get('prefix', '/usr') |
32 |
|
|
33 |
|
# We may also need to know where python's site-packages subdirectory lives |
34 |
|
python_version = 'python%s.%s'%(sys.version_info[0],sys.version_info[1]) |
35 |
|
|
36 |
|
# Install as a standard python package in /usr/lib64 if available, else in /usr/lib |
37 |
|
if os.path.isdir( prefix+"/lib64/"+python_version+"/site-packages"): |
38 |
|
sys_dir_packages = prefix+"/lib64/"+python_version+"/site-packages/esys" |
39 |
|
sys_dir_libraries = prefix+"/lib64" |
40 |
|
else: |
41 |
|
sys_dir_packages = prefix+"/lib/"+python_version+"/site-packages/esys" |
42 |
|
sys_dir_libraries = prefix+"/lib" |
43 |
|
|
44 |
|
sys_dir_examples = prefix+"/share/doc/esys" |
45 |
|
|
46 |
|
source_root = Dir('#.').abspath |
47 |
|
|
48 |
|
dir_packages = os.path.join(source_root,"esys") |
49 |
|
dir_examples = os.path.join(source_root,"examples") |
50 |
|
dir_libraries = os.path.join(source_root,"lib") |
51 |
|
|
52 |
|
print " Default packages local installation: ", dir_packages |
53 |
|
print " Default library local installation ", dir_libraries |
54 |
|
print " Default example local installation: ", dir_examples |
55 |
print "Install prefix is: ", prefix |
print "Install prefix is: ", prefix |
56 |
|
print " Default packages system installation: ", sys_dir_packages |
57 |
|
print " Default library system installation ", sys_dir_libraries |
58 |
|
print " Default example system installation: ", sys_dir_examples |
59 |
|
|
60 |
|
#============================================================================================== |
61 |
|
|
62 |
# Default options and options help text |
# Default options and options help text |
63 |
# 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. |
68 |
# |
# |
69 |
# get the options file if present: |
# get the options file if present: |
70 |
# |
# |
71 |
if ARGUMENTS.get('options_file',0): |
options_file = ARGUMENTS.get('options_file','') |
72 |
options_file = ARGUMENTS.get('options_file',0) |
|
73 |
else: |
if not os.path.isfile(options_file) : |
74 |
|
options_file = False |
75 |
|
|
76 |
|
if not options_file : |
77 |
|
import socket |
78 |
from string import ascii_letters,digits |
from string import ascii_letters,digits |
79 |
hostname="" |
hostname="" |
80 |
for s in socket.gethostname().split('.')[0]: |
for s in socket.gethostname().split('.')[0]: |
82 |
hostname+=s |
hostname+=s |
83 |
else: |
else: |
84 |
hostname+="_" |
hostname+="_" |
85 |
options_file = os.path.join("scons",hostname+"_options.py") |
tmp = os.path.join("scons",hostname+"_options.py") |
86 |
|
|
87 |
if os.path.isfile(options_file): |
if os.path.isfile(tmp) : |
88 |
print "option file is ",options_file,"." |
options_file = tmp |
89 |
else: |
|
90 |
print "option file is ",options_file, "(not present)." |
IS_WINDOWS_PLATFORM = (os.name== "nt") |
91 |
|
|
92 |
|
# If you're not going to tell me then...... |
93 |
|
# FIXME: add one for the altix too. |
94 |
|
if not options_file : |
95 |
|
if IS_WINDOWS_PLATFORM : |
96 |
|
options_file = "scons/windows_mscv71_options.py" |
97 |
|
else: |
98 |
|
options_file = "scons/linux_gcc_eg_options.py" |
99 |
|
|
100 |
# and load it |
# and load it |
101 |
opts = Options(options_file, ARGUMENTS) |
opts = Options(options_file, ARGUMENTS) |
102 |
#================================================================ |
#================================================================ |
130 |
# |
# |
131 |
# python installation: |
# python installation: |
132 |
# |
# |
133 |
if IS_WINDOWS_PLATFORM: |
python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1])) |
134 |
python_path_default=os.path.join(tools_prefix,'python%s%s'%(sys.version_info[0],sys.version_info[1]),"include") |
python_lib_path_default=os.path.join(tools_prefix,'lib') |
135 |
python_lib_path_default=os.path.join(tools_prefix,'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]) |
|
python_libs_default=["python%s%s"%(sys.version_info[0],sys.version_info[1])] |
|
|
else: |
|
|
python_path_default=os.path.join(tools_prefix,'include','python%s.%s'%(sys.version_info[0],sys.version_info[1])) |
|
|
python_lib_path_default=os.path.join(tools_prefix,'lib') |
|
|
python_libs_default=["python%s.%s"%(sys.version_info[0],sys.version_info[1])] |
|
136 |
|
|
137 |
#========================================================================== |
#========================================================================== |
138 |
# |
# |
139 |
# boost installation: |
# boost installation: |
140 |
# |
# |
141 |
if IS_WINDOWS_PLATFORM: |
boost_path_default=os.path.join(tools_prefix,'include') |
142 |
boost_libs_path_default=os.path.join(tools_prefix,'boost','lib') |
boost_lib_path_default=os.path.join(tools_prefix,'lib') |
143 |
boost_libs_default=None |
boost_lib_default=['boost_python'] |
|
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=os.path.join(tools_prefix,'boost','include','boost-%s'%(boost_libs_default[0].split("-")[-1],)) |
|
|
else: |
|
|
boost_path_default=os.path.join(tools_prefix,'include') |
|
|
boost_libs_path_default=os.path.join(tools_prefix,'lib') |
|
|
boost_libs_default=['boost_python'] |
|
144 |
#========================================================================== |
#========================================================================== |
145 |
# |
# |
146 |
# check if netCDF is installed on the system: |
# check if netCDF is installed on the system: |
147 |
# |
# |
148 |
if IS_WINDOWS_PLATFORM: |
netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3') |
149 |
netcdf_dir=os.path.join(tools_prefix,'netcdf') |
netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3') |
|
netCDF_path_default=os.path.join(netcdf_dir,'include') |
|
|
netCDF_lib_path_default=os.path.join(netcdf_dir,'lib') |
|
|
else: |
|
|
netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3') |
|
|
netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3') |
|
150 |
|
|
151 |
if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default): |
if os.path.isdir(netCDF_path_default) and os.path.isdir(netCDF_lib_path_default): |
152 |
useNetCDF_default='yes' |
useNetCDF_default='yes' |
157 |
netCDF_lib_path_default=None |
netCDF_lib_path_default=None |
158 |
netCDF_libs_default=None |
netCDF_libs_default=None |
159 |
|
|
|
if IS_WINDOWS_PLATFORM: |
|
|
useNetCDF_default='no' # be default netcdf is not supported on windows. |
|
160 |
#========================================================================== |
#========================================================================== |
161 |
# |
# |
162 |
# compile: |
# compile: |
163 |
# |
# |
164 |
if IS_WINDOWS_PLATFORM: |
cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
165 |
# 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 -pedantic-errors' |
166 |
# cc_flags_debug_default = '/Od /MDd /RTC1 /GR /EHsc /Qc99 /Qopenmp /Qopenmp-report1 /Qprec' |
cxx_flags_default='--no-warn -ansi' |
167 |
cc_flags_default = '/nologo /EHsc /GR /wd4068 /O2 /Op /MT /W3 /Ob0 /Z7' |
cxx_flags_debug_default='--no-warn -ansi -DDOASSERT' |
|
cc_flags_debug_default ='/nologo /EHsc /GR /wd4068 /Od /RTC1 /MTd /ZI /Ob0 /Z7' |
|
|
|
|
|
cc_flags_default = '/nologo /EHsc /GR /O2 /MT /W3 /Ob0 /Z7 /wd4068' |
|
|
cc_flags_debug_default ='/nologo /EHsc /GR /Od /RTC1 /MTd /W3 /Ob0 /Z7/wd4068' |
|
|
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' |
|
168 |
#============================================================================================== |
#============================================================================================== |
169 |
# Default options and options help text |
# Default options and options help text |
170 |
# 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. |
172 |
# DO NOT CHANGE THEM HERE |
# DO NOT CHANGE THEM HERE |
173 |
opts.AddOptions( |
opts.AddOptions( |
174 |
# Where to install esys stuff |
# Where to install esys stuff |
175 |
('incinstall', 'where the esys headers will be installed', prefix+'/include'), |
('incinstall', 'where the esys headers will be installed', Dir('#.').abspath+'/include'), |
176 |
('libinstall', 'where the esys libraries will be installed', prefix+'/lib'), |
('libinstall', 'where the esys libraries will be installed', dir_libraries), |
177 |
('pyinstall', 'where the esys python modules will be installed', prefix), |
('pyinstall', 'where the esys python modules will be installed', dir_packages), |
178 |
('src_zipfile', 'the source zip file will be installed.', prefix+"/release/escript_src.zip"), |
('exinstall', 'where the esys examples will be installed', dir_examples), |
179 |
('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), |
180 |
('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), |
181 |
('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), |
182 |
('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"), |
183 |
('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"), |
184 |
('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"), |
185 |
('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"), |
186 |
|
('examples_tarfile', 'the examples tar file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.tar.gz"), |
187 |
|
('examples_zipfile', 'the examples zip file will be installed.', Dir('#.').abspath+"/release/doc/escript_examples.zip"), |
188 |
|
('guide_pdf', 'name of the user guide in pdf format', Dir('#.').abspath+"/release/doc/user/guide.pdf"), |
189 |
|
('api_epydoc', 'name of the epydoc api docs directory', Dir('#.').abspath+"/release/doc/epydoc"), |
190 |
|
('guide_html', 'name of the directory for user guide in html format', Dir('#.').abspath+"/release/doc/user/html"), |
191 |
('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"), |
('api_doxygen', 'name of the doxygen api docs directory',prefix+"/release/doc/doxygen"), |
|
('guide_html', 'name of the directory for user guide in html format', prefix+"/release/doc/user/html"), |
|
192 |
# Compilation options |
# Compilation options |
193 |
BoolOption('dodebug', 'Do you want a debug build?', 'no'), |
BoolOption('dodebug', 'Do you want a debug build?', 'no'), |
194 |
('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), |
229 |
('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default), |
('netCDF_libs', 'netCDF C++ libraries to link with', netCDF_libs_default), |
230 |
# Python |
# Python |
231 |
# locations of include files for python |
# locations of include files for python |
232 |
|
# FIXME: python_path should be python_inc_path and the same for boost etc. |
233 |
PathOption('python_path', 'Path to Python includes', python_path_default), |
PathOption('python_path', 'Path to Python includes', python_path_default), |
234 |
PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default), |
PathOption('python_lib_path', 'Path to Python libs', python_lib_path_default), |
235 |
('python_libs', 'Python libraries to link with', python_libs_default), |
('python_lib', 'Python libraries to link with', python_lib_default), |
236 |
|
('python_cmd', 'Python command', 'python'), |
237 |
# Boost |
# Boost |
238 |
PathOption('boost_path', 'Path to Boost includes', boost_path_default), |
PathOption('boost_path', 'Path to Boost includes', boost_path_default), |
239 |
PathOption('boost_libs_path', 'Path to Boost libs', boost_libs_path_default), |
PathOption('boost_lib_path', 'Path to Boost libs', boost_lib_path_default), |
240 |
('boost_libs', 'Boost libraries to link with', boost_libs_default), |
('boost_lib', 'Boost libraries to link with', boost_lib_default), |
241 |
# Doc building |
# Doc building |
242 |
# PathOption('doxygen_path', 'Path to Doxygen executable', None), |
# PathOption('doxygen_path', 'Path to Doxygen executable', None), |
243 |
# PathOption('epydoc_path', 'Path to Epydoc executable', None), |
# PathOption('epydoc_path', 'Path to Epydoc executable', None), |
258 |
# 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) |
259 |
# 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 |
260 |
# |
# |
261 |
|
|
262 |
if IS_WINDOWS_PLATFORM: |
if IS_WINDOWS_PLATFORM: |
263 |
env = Environment(tools = ['default', 'msvc'], options = opts) |
env = Environment(tools = ['default', 'msvc'], options = opts) |
264 |
else: |
else: |
269 |
else: |
else: |
270 |
env = Environment(tools = ['default'], options = opts) |
env = Environment(tools = ['default'], options = opts) |
271 |
Help(opts.GenerateHelpText(env)) |
Help(opts.GenerateHelpText(env)) |
272 |
|
|
273 |
#================================================================================================= |
#================================================================================================= |
274 |
# |
# |
275 |
# Initialise Scons Build Environment |
# Initialise Scons Build Environment |
276 |
# check for user environment variables we are interested in |
# check for user environment variables we are interested in |
277 |
try: |
try: |
278 |
python_path = os.environ['PYTHONPATH'] |
tmp = os.environ['PYTHONPATH'] |
279 |
env['ENV']['PYTHONPATH'] = python_path |
env['ENV']['PYTHONPATH'] = tmp |
280 |
except KeyError: |
except KeyError: |
281 |
python_path = '' |
pass |
282 |
|
|
283 |
|
env.PrependENVPath('PYTHONPATH', source_root) |
284 |
|
|
285 |
try: |
try: |
286 |
omp_num_threads = os.environ['OMP_NUM_THREADS'] |
omp_num_threads = os.environ['OMP_NUM_THREADS'] |
287 |
except KeyError: |
except KeyError: |
288 |
omp_num_threads = 1 |
omp_num_threads = 1 |
289 |
|
|
290 |
env['ENV']['OMP_NUM_THREADS'] = omp_num_threads |
env['ENV']['OMP_NUM_THREADS'] = omp_num_threads |
291 |
|
|
292 |
try: |
try: |
296 |
pass |
pass |
297 |
|
|
298 |
try: |
try: |
299 |
path = os.environ['PATH'] |
tmp = os.environ['PATH'] |
300 |
env['ENV']['PATH'] = path |
env['ENV']['PATH'] = tmp |
301 |
except KeyError: |
except KeyError: |
302 |
path = '' |
pass |
303 |
|
|
304 |
try: |
try: |
305 |
ld_library_path = os.environ['LD_LIBRARY_PATH'] |
tmp = os.environ['LD_LIBRARY_PATH'] |
306 |
env['ENV']['LD_LIBRARY_PATH'] = ld_library_path |
env['ENV']['LD_LIBRARY_PATH'] = tmp |
307 |
except KeyError: |
except KeyError: |
308 |
ld_library_path = '' |
pass |
309 |
#========================================================================== |
#========================================================================== |
310 |
# |
# |
311 |
# Add some customer builders |
# Add some customer builders |
313 |
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) |
314 |
env.Append(BUILDERS = {'PyCompile' : py_builder}); |
env.Append(BUILDERS = {'PyCompile' : py_builder}); |
315 |
|
|
316 |
if IS_WINDOWS_PLATFORM: |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', |
317 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True) |
src_suffix=env['PROGSUFFIX'], single_source=True) |
318 |
else: |
|
|
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', single_source=True) |
|
319 |
env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder}); |
env.Append(BUILDERS = {'RunUnitTest' : runUnitTest_builder}); |
320 |
|
|
321 |
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) |
331 |
libinstall = env['libinstall'] |
libinstall = env['libinstall'] |
332 |
env.Append(LIBPATH = [libinstall,]) # 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 |
333 |
env.PrependENVPath('LD_LIBRARY_PATH', libinstall) |
env.PrependENVPath('LD_LIBRARY_PATH', libinstall) |
334 |
if env['PLATFORM'] == "win32": |
if IS_WINDOWS_PLATFORM : |
335 |
env.PrependENVPath('PATH', libinstall) |
env.PrependENVPath('PATH', libinstall) |
|
env.PrependENVPath('PATH', env['boost_libs_path']) |
|
336 |
except KeyError: |
except KeyError: |
337 |
libinstall = None |
libinstall = None |
338 |
try: |
try: |
339 |
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']) |
|
340 |
except KeyError: |
except KeyError: |
341 |
pyinstall = None |
pyinstall = None |
342 |
try: |
try: |
343 |
|
exinstall = env['exinstall'] |
344 |
|
except KeyError: |
345 |
|
exinstall = None |
346 |
|
try: |
347 |
|
sys_libinstall = env['sys_libinstall'] |
348 |
|
except KeyError: |
349 |
|
sys_libinstall = None |
350 |
|
try: |
351 |
|
sys_pyinstall = env['sys_pyinstall'] |
352 |
|
except KeyError: |
353 |
|
sys_pyinstall = None |
354 |
|
try: |
355 |
|
sys_exinstall = env['sys_exinstall'] |
356 |
|
except KeyError: |
357 |
|
sys_exinstall = None |
358 |
|
try: |
359 |
dodebug = env['dodebug'] |
dodebug = env['dodebug'] |
360 |
except KeyError: |
except KeyError: |
361 |
dodebug = None |
dodebug = None |
369 |
except KeyError: |
except KeyError: |
370 |
pass |
pass |
371 |
|
|
372 |
|
|
373 |
if dodebug: |
if dodebug: |
374 |
if useMPI: |
if useMPI: |
375 |
try: |
try: |
550 |
useNetCDF = 'yes' |
useNetCDF = 'yes' |
551 |
pass |
pass |
552 |
|
|
|
if not useNetCDF == 'yes': |
|
|
print "Warning: Installation is not configured with netCDF. Some I/O function may not be available." |
|
|
|
|
553 |
if useNetCDF == 'yes': |
if useNetCDF == 'yes': |
554 |
try: |
try: |
555 |
|
netCDF_libs = env['netCDF_libs'] |
556 |
|
except KeyError: |
557 |
|
pass |
558 |
|
|
559 |
|
env.Append(LIBS = netCDF_libs) |
560 |
|
env.Append(CPPDEFINES = [ 'USE_NETCDF' ]) |
561 |
|
try: |
562 |
includes = env['netCDF_path'] |
includes = env['netCDF_path'] |
563 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
564 |
except KeyError: |
except KeyError: |
566 |
|
|
567 |
try: |
try: |
568 |
lib_path = env['netCDF_lib_path'] |
lib_path = env['netCDF_lib_path'] |
|
if IS_WINDOWS_PLATFORM: env['ENV']['PATH']+=";"+lib_path |
|
569 |
env.Append(LIBPATH = [ lib_path, ]) |
env.Append(LIBPATH = [ lib_path, ]) |
570 |
|
if IS_WINDOWS_PLATFORM : |
571 |
|
env.PrependENVPath('PATH', lib_path) |
572 |
except KeyError: |
except KeyError: |
573 |
pass |
pass |
|
|
|
|
try: |
|
|
netCDF_libs = env['netCDF_libs'] |
|
|
except KeyError: |
|
|
netCDF_libs = [ ] |
|
574 |
else: |
else: |
575 |
|
print "Warning: Installation is not configured with netCDF. Some I/O function may not be available." |
576 |
netCDF_libs=[ ] |
netCDF_libs=[ ] |
577 |
|
|
578 |
try: |
try: |
581 |
except KeyError: |
except KeyError: |
582 |
pass |
pass |
583 |
try: |
try: |
584 |
lib_path = env['boost_libs_path'] |
lib_path = env['boost_lib_path'] |
585 |
env.Append(LIBPATH = [lib_path,]) |
env.Append(LIBPATH = [lib_path,]) |
586 |
|
if IS_WINDOWS_PLATFORM : |
587 |
|
env.PrependENVPath('PATH', lib_path) |
588 |
except KeyError: |
except KeyError: |
589 |
pass |
pass |
590 |
try: |
try: |
591 |
boost_libs = env['boost_libs'] |
boost_lib = env['boost_lib'] |
592 |
except KeyError: |
except KeyError: |
593 |
boost_libs = None |
boost_lib = None |
594 |
try: |
try: |
595 |
includes = env['python_path'] |
includes = env['python_path'] |
596 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
602 |
except KeyError: |
except KeyError: |
603 |
pass |
pass |
604 |
try: |
try: |
605 |
python_libs = env['python_libs'] |
python_lib = env['python_lib'] |
606 |
except KeyError: |
except KeyError: |
607 |
python_libs = None |
python_lib = None |
608 |
try: |
try: |
609 |
doxygen_path = env['doxygen_path'] |
doxygen_path = env['doxygen_path'] |
610 |
except KeyError: |
except KeyError: |
675 |
except KeyError: |
except KeyError: |
676 |
api_doxygen = None |
api_doxygen = None |
677 |
|
|
678 |
|
try: |
679 |
|
svn_pipe = os.popen("svn info | grep '^Revision'") |
680 |
|
rev = svn_pipe.readlines() |
681 |
|
svn_pipe.close() |
682 |
|
svn_version = re.sub("[^0-9]", "", rev[0]) |
683 |
|
except: |
684 |
|
svn_version = "0" |
685 |
|
env.Append(CPPDEFINES = "SVN_VERSION="+svn_version) |
686 |
|
|
687 |
|
# Python install - esys __init__.py |
688 |
|
init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET')) |
689 |
|
|
690 |
|
# FIXME: exinstall and friends related to examples are not working. |
691 |
|
build_target = env.Alias('build',[libinstall,incinstall,pyinstall,init_target]) |
692 |
|
|
693 |
|
env.Default(build_target) |
694 |
|
|
695 |
# Zipgets |
# Zipgets |
|
env.Default(libinstall) |
|
|
env.Default(incinstall) |
|
|
env.Default(pyinstall) |
|
696 |
env.Alias('release_src',[ src_zipfile, src_tarfile ]) |
env.Alias('release_src',[ src_zipfile, src_tarfile ]) |
697 |
env.Alias('release_tests',[ test_zipfile, test_tarfile]) |
env.Alias('release_tests',[ test_zipfile, test_tarfile]) |
698 |
env.Alias('release_examples',[ examples_zipfile, examples_tarfile]) |
env.Alias('release_examples',[ examples_zipfile, examples_tarfile]) |
704 |
env.Alias('guide_pdf', guide_pdf) |
env.Alias('guide_pdf', guide_pdf) |
705 |
env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index]) |
env.Alias('docs',[ 'release_examples', 'guide_pdf', api_epydoc, api_doxygen, guide_html_index]) |
706 |
env.Alias('release', ['release_src', 'release_tests', 'docs']) |
env.Alias('release', ['release_src', 'release_tests', 'docs']) |
707 |
env.Alias('build_tests') # target to build all C++ tests |
|
708 |
env.Alias('build_py_tests') # target to build all python tests |
env.Alias('build_tests',build_target) # target to build all C++ tests |
709 |
|
env.Alias('build_py_tests',build_target) # target to build all python tests |
710 |
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 |
711 |
env.Alias('run_tests', 'build_tests') # target to run all C++ test |
env.Alias('run_tests', 'build_tests') # target to run all C++ test |
712 |
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 |
713 |
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 |
714 |
|
|
|
# Python install - esys __init__.py |
|
|
init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET')) |
|
|
env.Alias(init_target) |
|
715 |
|
|
716 |
# Allow sconscripts to see the env |
# Allow sconscripts to see the env |
717 |
Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", "netCDF_libs", "useNetCDF", |
Export(["env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug", |
718 |
"boost_libs", "python_libs", "doxygen_path", "epydoc_path", "papi_libs", |
"mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", |
719 |
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile", |
"netCDF_libs", |
720 |
"guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ]) |
"boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs", |
721 |
|
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", |
722 |
|
"src_tarfile", "examples_tarfile", "examples_zipfile", |
723 |
|
"guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" |
724 |
|
]) |
725 |
|
|
726 |
# End initialisation section |
# End initialisation section |
727 |
# Begin configuration section |
# Begin configuration section |
755 |
# added by Ben Cumming |
# added by Ben Cumming |
756 |
env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0) |
env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0) |
757 |
#env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0) |
#env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0) |
758 |
|
|
759 |
|
|
760 |
|
syslib_install_target = env.installDirectory(sys_libinstall,libinstall) |
761 |
|
syspy_install_target = env.installDirectory(sys_pyinstall,pyinstall,recursive=True) |
762 |
|
|
763 |
|
install_target = env.Alias("install", env.Flatten([syslib_install_target, syspy_install_target]) ) |