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 |
#=============================================================== |
#=============================================================== |
27 |
|
|
28 |
tools_prefix="/usr" |
tools_prefix="/usr" |
31 |
# |
# |
32 |
# get the installation prefix |
# get the installation prefix |
33 |
# |
# |
34 |
prefix = ARGUMENTS.get('prefix', '/usr') |
prefix = ARGUMENTS.get('prefix', sys.prefix ) |
35 |
|
|
36 |
# We may also need to know where python's site-packages subdirectory lives |
# 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]) |
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 |
# 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"): |
if os.path.isdir( prefix+"/lib64/"+python_version+"/site-packages"): |
40 |
sys_dir_packages = prefix+"/lib64/"+python_version+"/site-packages/esys" |
sys_dir_packages = prefix+"/lib64/"+python_version+"/site-packages/esys" |
51 |
dir_examples = os.path.join(source_root,"examples") |
dir_examples = os.path.join(source_root,"examples") |
52 |
dir_libraries = os.path.join(source_root,"lib") |
dir_libraries = os.path.join(source_root,"lib") |
53 |
|
|
54 |
|
print "Source root is : ",source_root |
55 |
print " Default packages local installation: ", dir_packages |
print " Default packages local installation: ", dir_packages |
56 |
print " Default library local installation ", dir_libraries |
print " Default library local installation ", dir_libraries |
57 |
print " Default example local installation: ", dir_examples |
print " Default example local installation: ", dir_examples |
78 |
|
|
79 |
if not options_file : |
if not options_file : |
80 |
import socket |
import socket |
81 |
from string import ascii_letters,digits |
hostname = re.sub("[^0-9a-zA-Z]", "_", socket.gethostname().split('.')[0]) |
|
hostname="" |
|
|
for s in socket.gethostname().split('.')[0]: |
|
|
if s in ascii_letters+digits: |
|
|
hostname+=s |
|
|
else: |
|
|
hostname+="_" |
|
82 |
tmp = os.path.join("scons",hostname+"_options.py") |
tmp = os.path.join("scons",hostname+"_options.py") |
83 |
|
|
84 |
if os.path.isfile(tmp) : |
if os.path.isfile(tmp) : |
138 |
boost_path_default=os.path.join(tools_prefix,'include') |
boost_path_default=os.path.join(tools_prefix,'include') |
139 |
boost_lib_path_default=os.path.join(tools_prefix,'lib') |
boost_lib_path_default=os.path.join(tools_prefix,'lib') |
140 |
boost_lib_default=['boost_python'] |
boost_lib_default=['boost_python'] |
141 |
|
|
142 |
#========================================================================== |
#========================================================================== |
143 |
# |
# |
144 |
# check if netCDF is installed on the system: |
# check if netCDF is installed on the system: |
145 |
# |
# |
146 |
netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3') |
netCDF_path_default=os.path.join(tools_prefix,'include','netcdf-3') |
147 |
netCDF_lib_path_default=os.path.join(tools_prefix,'lib','netcdf-3') |
netCDF_lib_path_default=os.path.join(tools_prefix,'lib') |
148 |
|
|
149 |
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): |
150 |
useNetCDF_default='yes' |
useNetCDF_default='yes' |
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 |
cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
cc_flags_default='-O3 -std=c99 -ffast-math -fpic -Wno-unknown-pragmas -ansi' |
181 |
cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi -pedantic-errors' |
cc_flags_debug_default='-g -O0 -ffast-math -std=c99 -fpic -Wno-unknown-pragmas -ansi' |
182 |
cxx_flags_default='--no-warn -ansi' |
cxx_flags_default='--no-warn -ansi' |
183 |
cxx_flags_debug_default='--no-warn -ansi -DDOASSERT' |
cxx_flags_debug_default='--no-warn -ansi -DDOASSERT' |
184 |
|
|
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. |
208 |
('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"), |
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 |
|
# ParMETIS |
242 |
|
('parmetis_path', 'Path to ParMETIS includes', ''), |
243 |
|
('parmetis_lib_path', 'Path to ParMETIS library', ''), |
244 |
|
('parmetis_lib', 'ParMETIS library to link with', []), |
245 |
|
# TRILINOS |
246 |
|
PathOption('trilinos_path', 'Path to TRILINOS includes', None), |
247 |
|
PathOption('trilinos_lib_path', 'Path to TRILINOS libs', None), |
248 |
|
('trilinos_libs', 'TRILINOS libraries to link with', None), |
249 |
# BLAS |
# BLAS |
250 |
PathOption('blas_path', 'Path to BLAS includes', None), |
PathOption('blas_path', 'Path to BLAS includes', None), |
251 |
PathOption('blas_lib_path', 'Path to BLAS libs', None), |
PathOption('blas_lib_path', 'Path to BLAS libs', None), |
273 |
PathOption('papi_path', 'Path to PAPI includes', None), |
PathOption('papi_path', 'Path to PAPI includes', None), |
274 |
PathOption('papi_lib_path', 'Path to PAPI libs', None), |
PathOption('papi_lib_path', 'Path to PAPI libs', None), |
275 |
('papi_libs', 'PAPI libraries to link with', None), |
('papi_libs', 'PAPI libraries to link with', None), |
276 |
|
('papi_instrument_solver', 'use PAPI in Solver.c to instrument each iteration of the solver', None), |
277 |
# MPI |
# MPI |
278 |
BoolOption('useMPI', 'Compile parallel version using MPI', 'no'), |
BoolOption('useMPI', 'Compile parallel version using MPI', useMPI_default), |
279 |
|
('MPICH_IGNORE_CXX_SEEK', 'name of macro to ignore MPI settings of C++ SEEK macro (for MPICH)' , 'MPICH_IGNORE_CXX_SEEK'), |
280 |
|
PathOption('mpi_path', 'Path to MPI includes', mpi_path_default), |
281 |
|
('mpi_run', 'mpirun name' , mpi_run_default), |
282 |
|
PathOption('mpi_lib_path', 'Path to MPI libs (needs to be added to the LD_LIBRARY_PATH)',mpi_lib_path_default), |
283 |
|
('mpi_libs', 'MPI libraries to link with (needs to be shared!)', mpi_libs_default) |
284 |
) |
) |
285 |
#================================================================================================= |
#================================================================================================= |
286 |
# |
# |
295 |
|
|
296 |
if IS_WINDOWS_PLATFORM: |
if IS_WINDOWS_PLATFORM: |
297 |
env = Environment(tools = ['default', 'msvc'], options = opts) |
env = Environment(tools = ['default', 'msvc'], options = opts) |
298 |
|
#env = Environment(tools = ['default', 'intelc'], options = opts) |
299 |
else: |
else: |
300 |
if os.uname()[4]=='ia64': |
if os.uname()[4]=='ia64': |
301 |
env = Environment(tools = ['default', 'intelc'], options = opts) |
env = Environment(tools = ['default', 'intelc'], options = opts) |
305 |
env = Environment(tools = ['default'], options = opts) |
env = Environment(tools = ['default'], options = opts) |
306 |
Help(opts.GenerateHelpText(env)) |
Help(opts.GenerateHelpText(env)) |
307 |
|
|
308 |
|
if env['bounds_check']: |
309 |
|
env.Append(CPPDEFINES = [ 'BOUNDS_CHECK' ]) |
310 |
|
env.Append(CXXDEFINES = [ 'BOUNDS_CHECK' ]) |
311 |
|
bounds_check = env['bounds_check'] |
312 |
|
else: |
313 |
|
bounds_check = 0 |
314 |
|
|
315 |
#================================================================================================= |
#================================================================================================= |
316 |
# |
# |
317 |
# Initialise Scons Build Environment |
# Initialise Scons Build Environment |
328 |
omp_num_threads = os.environ['OMP_NUM_THREADS'] |
omp_num_threads = os.environ['OMP_NUM_THREADS'] |
329 |
except KeyError: |
except KeyError: |
330 |
omp_num_threads = 1 |
omp_num_threads = 1 |
331 |
|
env['ENV']['OMP_NUM_THREADS'] = omp_num_threads |
332 |
|
|
333 |
|
try: |
334 |
|
path = os.environ['PATH'] |
335 |
|
env['ENV']['PATH'] = path |
336 |
|
except KeyError: |
337 |
|
omp_num_threads = 1 |
338 |
|
|
339 |
env['ENV']['OMP_NUM_THREADS'] = omp_num_threads |
env['ENV']['OMP_NUM_THREADS'] = omp_num_threads |
340 |
|
|
341 |
|
|
342 |
|
# Copy some variables from the system environment to the build environment |
343 |
try: |
try: |
344 |
env['ENV']['DISPLAY'] = os.environ['DISPLAY'] |
env['ENV']['DISPLAY'] = os.environ['DISPLAY'] |
345 |
env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY'] |
env['ENV']['XAUTHORITY'] = os.environ['XAUTHORITY'] |
346 |
|
home_temp = os.environ['HOME'] # MPICH2's mpd needs $HOME to find $HOME/.mpd.conf |
347 |
|
env['ENV']['HOME'] = home_temp |
348 |
except KeyError: |
except KeyError: |
349 |
pass |
pass |
350 |
|
|
356 |
|
|
357 |
try: |
try: |
358 |
tmp = os.environ['LD_LIBRARY_PATH'] |
tmp = os.environ['LD_LIBRARY_PATH'] |
359 |
|
print tmp |
360 |
env['ENV']['LD_LIBRARY_PATH'] = tmp |
env['ENV']['LD_LIBRARY_PATH'] = tmp |
361 |
except KeyError: |
except KeyError: |
362 |
pass |
pass |
387 |
env.PrependENVPath('LD_LIBRARY_PATH', libinstall) |
env.PrependENVPath('LD_LIBRARY_PATH', libinstall) |
388 |
if IS_WINDOWS_PLATFORM : |
if IS_WINDOWS_PLATFORM : |
389 |
env.PrependENVPath('PATH', libinstall) |
env.PrependENVPath('PATH', libinstall) |
390 |
|
env.PrependENVPath('PATH', env['boost_lib_path']) |
391 |
except KeyError: |
except KeyError: |
392 |
libinstall = None |
libinstall = None |
393 |
try: |
try: |
394 |
pyinstall = env['pyinstall'] # 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 |
395 |
except KeyError: |
except KeyError: |
396 |
pyinstall = None |
pyinstall = None |
397 |
|
|
398 |
|
try: |
399 |
|
cc_defines = env['cc_defines'] |
400 |
|
env.Append(CPPDEFINES = cc_defines) |
401 |
|
except KeyError: |
402 |
|
pass |
403 |
|
try: |
404 |
|
flags = env['ar_flags'] |
405 |
|
env.Append(ARFLAGS = flags) |
406 |
|
except KeyError: |
407 |
|
ar_flags = None |
408 |
|
try: |
409 |
|
sys_libs = env['sys_libs'] |
410 |
|
except KeyError: |
411 |
|
sys_libs = [] |
412 |
|
|
413 |
|
try: |
414 |
|
tar_flags = env['tar_flags'] |
415 |
|
env.Replace(TARFLAGS = tar_flags) |
416 |
|
except KeyError: |
417 |
|
pass |
418 |
|
|
419 |
try: |
try: |
420 |
exinstall = env['exinstall'] |
exinstall = env['exinstall'] |
421 |
except KeyError: |
except KeyError: |
432 |
sys_exinstall = env['sys_exinstall'] |
sys_exinstall = env['sys_exinstall'] |
433 |
except KeyError: |
except KeyError: |
434 |
sys_exinstall = None |
sys_exinstall = None |
435 |
|
|
436 |
|
# ====================== debugging =================================== |
437 |
try: |
try: |
438 |
dodebug = env['dodebug'] |
dodebug = env['dodebug'] |
439 |
except KeyError: |
except KeyError: |
440 |
dodebug = None |
dodebug = None |
441 |
|
|
442 |
|
# === switch on omp =================================================== |
443 |
try: |
try: |
444 |
useMPI = env['useMPI'] |
omp_flags = env['omp_flags'] |
445 |
except KeyError: |
except KeyError: |
446 |
useMPI = None |
omp_flags = '' |
447 |
|
|
448 |
try: |
try: |
449 |
cc_defines = env['cc_defines'] |
omp_flags_debug = env['omp_flags_debug'] |
|
env.Append(CPPDEFINES = cc_defines) |
|
450 |
except KeyError: |
except KeyError: |
451 |
pass |
omp_flags_debug = '' |
452 |
|
|
453 |
|
# ========= use mpi? ===================================================== |
454 |
|
try: |
455 |
|
useMPI = env['useMPI'] |
456 |
|
except KeyError: |
457 |
|
useMPI = None |
458 |
|
# ========= set compiler flags =========================================== |
459 |
|
|
460 |
if dodebug: |
if dodebug: |
|
if useMPI: |
|
461 |
try: |
try: |
462 |
flags = env['cc_flags_debug_MPI'] |
flags = env['cc_flags_debug'] + ' ' + omp_flags_debug |
|
env.Append(CCFLAGS = flags) |
|
|
except KeyError: |
|
|
pass |
|
|
else: |
|
|
try: |
|
|
flags = env['cc_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 |
|
ar_flags = None |
|
|
try: |
|
|
sys_libs = env['sys_libs'] |
|
|
except KeyError: |
|
|
sys_libs = [] |
|
488 |
|
|
489 |
try: |
# ============= Remember what options were used in the compile ===================================== |
490 |
tar_flags = env['tar_flags'] |
if not IS_WINDOWS_PLATFORM: |
491 |
env.Replace(TARFLAGS = tar_flags) |
env.Execute("/bin/rm -f " + libinstall + "/Compiled.with.*") |
492 |
except KeyError: |
if dodebug: env.Execute("touch " + libinstall + "/Compiled.with.debug") |
493 |
pass |
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 |
includes = env['mkl_path'] |
if not useMPI: |
499 |
env.Append(CPPPATH = [includes,]) |
try: |
500 |
except KeyError: |
includes = env['mkl_path'] |
501 |
pass |
env.Append(CPPPATH = [includes,]) |
502 |
|
except KeyError: |
503 |
|
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: |
except KeyError: |
615 |
amd_libs = [] |
pass |
616 |
|
|
617 |
|
try: |
618 |
|
lib_path = env['trilinos_lib_path'] |
619 |
|
env.Append(LIBPATH = [lib_path,]) |
620 |
|
except KeyError: |
621 |
|
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 |
|
|
655 |
if useNetCDF == 'yes': |
if useNetCDF == 'yes': |
656 |
try: |
try: |
657 |
netCDF_libs = env['netCDF_libs'] |
netCDF_libs = env['netCDF_libs'] |
669 |
try: |
try: |
670 |
lib_path = env['netCDF_lib_path'] |
lib_path = env['netCDF_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 : |
if IS_WINDOWS_PLATFORM : |
674 |
env.PrependENVPath('PATH', lib_path) |
env.PrependENVPath('PATH', lib_path) |
675 |
except KeyError: |
except KeyError: |
678 |
print "Warning: Installation is not configured with netCDF. Some I/O function may not be available." |
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,]) |
687 |
try: |
try: |
688 |
lib_path = env['boost_lib_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 : |
if IS_WINDOWS_PLATFORM : |
692 |
env.PrependENVPath('PATH', lib_path) |
env.PrependENVPath('PATH', lib_path) |
693 |
except KeyError: |
except KeyError: |
696 |
boost_lib = env['boost_lib'] |
boost_lib = env['boost_lib'] |
697 |
except KeyError: |
except KeyError: |
698 |
boost_lib = 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 |
712 |
python_lib = env['python_lib'] |
python_lib = env['python_lib'] |
713 |
except KeyError: |
except KeyError: |
714 |
python_lib = 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 |
|
# =============== ParMETIS ======================================= |
725 |
|
try: |
726 |
|
parmetis_path = env['parmetis_path'] |
727 |
|
parmetis_lib_path = env['parmetis_lib_path'] |
728 |
|
parmetis_lib = env['parmetis_lib'] |
729 |
|
except KeyError: |
730 |
|
parmetis_path = '' |
731 |
|
parmetis_lib_path = '' |
732 |
|
parmetis_lib = '' |
733 |
|
|
734 |
|
if useMPI and os.path.isdir(parmetis_lib_path): |
735 |
|
env.Append(CPPDEFINES = [ 'PARMETIS' ]) |
736 |
|
env.Append(CXXDEFINES = [ 'PARMETIS' ]) |
737 |
|
env.Append(CPPPATH = [parmetis_path]) |
738 |
|
env.Append(LIBPATH = [parmetis_lib_path]) |
739 |
|
env.Append(LIBS = parmetis_lib) |
740 |
|
# =============== PAPI ======================================= |
741 |
try: |
try: |
742 |
includes = env['papi_path'] |
includes = env['papi_path'] |
743 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
752 |
papi_libs = env['papi_libs'] |
papi_libs = env['papi_libs'] |
753 |
except KeyError: |
except KeyError: |
754 |
papi_libs = None |
papi_libs = None |
755 |
|
# ============= set mpi ===================================== |
756 |
|
if useMPI: |
757 |
|
env.Append(CPPDEFINES=['PASO_MPI',]) |
758 |
|
try: |
759 |
|
includes = env['mpi_path'] |
760 |
|
env.Append(CPPPATH = [includes,]) |
761 |
|
except KeyError: |
762 |
|
pass |
763 |
|
try: |
764 |
|
lib_path = env['mpi_lib_path'] |
765 |
|
env.Append(LIBPATH = [lib_path,]) |
766 |
|
env['ENV']['LD_LIBRARY_PATH']+=":"+lib_path |
767 |
|
except KeyError: |
768 |
|
pass |
769 |
|
try: |
770 |
|
mpi_libs = env['mpi_libs'] |
771 |
|
except KeyError: |
772 |
|
mpi_libs = [] |
773 |
|
|
774 |
|
try: |
775 |
|
mpi_run = env['mpi_run'] |
776 |
|
except KeyError: |
777 |
|
mpi_run = '' |
778 |
|
|
779 |
|
try: |
780 |
|
mpich_ignore_cxx_seek=env['MPICH_IGNORE_CXX_SEEK'] |
781 |
|
env.Append(CPPDEFINES = [ mpich_ignore_cxx_seek ] ) |
782 |
|
except KeyError: |
783 |
|
pass |
784 |
|
else: |
785 |
|
mpi_libs=[] |
786 |
|
mpi_run = mpi_run_default |
787 |
|
# =========== zip files =========================================== |
788 |
|
try: |
789 |
|
includes = env['papi_path'] |
790 |
|
env.Append(CPPPATH = [includes,]) |
791 |
|
except KeyError: |
792 |
|
pass |
793 |
|
try: |
794 |
|
lib_path = env['papi_lib_path'] |
795 |
|
env.Append(LIBPATH = [lib_path,]) |
796 |
|
except KeyError: |
797 |
|
pass |
798 |
|
try: |
799 |
|
papi_libs = env['papi_libs'] |
800 |
|
except KeyError: |
801 |
|
papi_libs = None |
802 |
|
try: |
803 |
|
papi_instrument_solver = env['papi_instrument_solver'] |
804 |
|
except KeyError: |
805 |
|
papi_instrument_solver = None |
806 |
|
|
807 |
|
|
808 |
|
# ============= and some helpers ===================================== |
809 |
|
try: |
810 |
|
doxygen_path = env['doxygen_path'] |
811 |
|
except KeyError: |
812 |
|
doxygen_path = None |
813 |
|
try: |
814 |
|
epydoc_path = env['epydoc_path'] |
815 |
|
except KeyError: |
816 |
|
epydoc_path = None |
817 |
try: |
try: |
818 |
src_zipfile = env.File(env['src_zipfile']) |
src_zipfile = env.File(env['src_zipfile']) |
819 |
except KeyError: |
except KeyError: |
861 |
api_doxygen = None |
api_doxygen = None |
862 |
|
|
863 |
try: |
try: |
864 |
svn_pipe = os.popen("svn info | grep '^Revision'") |
svn_pipe = os.popen("svnversion -n .") |
865 |
rev = svn_pipe.readlines() |
global_revision = svn_pipe.readlines() |
866 |
svn_pipe.close() |
svn_pipe.close() |
867 |
svn_version = re.sub("[^0-9]", "", rev[0]) |
global_revision = re.sub(":.*", "", global_revision[0]) |
868 |
|
global_revision = re.sub("[^0-9]", "", global_revision) |
869 |
except: |
except: |
870 |
svn_version = "0" |
global_revision="-1" |
871 |
env.Append(CPPDEFINES = "SVN_VERSION="+svn_version) |
print "Warning: unable to recover global revsion number." |
872 |
|
if global_revision == "": global_revision="0" |
873 |
|
print "Revision number is %s."%global_revision |
874 |
|
env.Append(CPPDEFINES = "SVN_VERSION="+global_revision) |
875 |
|
|
876 |
# Python install - esys __init__.py |
# Python install - esys __init__.py |
877 |
init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET')) |
init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET')) |
903 |
|
|
904 |
|
|
905 |
# Allow sconscripts to see the env |
# Allow sconscripts to see the env |
906 |
Export(["env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug", |
Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "blas_libs", "netCDF_libs", "useNetCDF", "mpi_run", |
|
"mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", |
|
|
"netCDF_libs", |
|
907 |
"boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs", |
"boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs", |
908 |
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", |
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile", "trilinos_libs", "mpi_libs", "papi_instrument_solver", |
909 |
"src_tarfile", "examples_tarfile", "examples_zipfile", |
"guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ]) |
|
"guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" |
|
|
]) |
|
910 |
|
|
911 |
# End initialisation section |
# End initialisation section |
912 |
# Begin configuration section |
# Begin configuration section |
913 |
# adds this file and the scons option directore to the source tar |
# adds this file and the scons option directore to the source tar |
914 |
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') ] |
915 |
release_testfiles=[env.File('README_TESTS'),] |
release_testfiles=[env.File('README_TESTS'),] |
916 |
env.Zip(src_zipfile, release_srcfiles) |
env.Zip(src_zipfile, release_srcfiles) |
917 |
env.Zip(test_zipfile, release_testfiles) |
env.Zip(test_zipfile, release_testfiles) |
936 |
env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0) |
env.SConscript(dirs = ['doc'], build_dir='build/$PLATFORM/doc', duplicate=0) |
937 |
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) |
938 |
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 |
|
939 |
env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0) |
env.SConscript(dirs = ['pythonMPI/src'], build_dir='build/$PLATFORM/pythonMPI', duplicate=0) |
940 |
#env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0) |
#env.SConscript(dirs = ['../test'], build_dir='../test/build', duplicate=0) |
941 |
|
|