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 |
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 |
#================================================================ |
#================================================================ |
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 |
# |
# |
|
IS_WINDOWS_PLATFORM = (os.name== "nt") |
|
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) |
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 |
# FIXME: use the inbuilt scons suffix variable. |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', |
317 |
if IS_WINDOWS_PLATFORM: |
src_suffix=env['PROGSUFFIX'], single_source=True) |
318 |
runUnitTest_builder = Builder(action = scons_extensions.runUnitTest, suffix = '.passed', src_suffix='.exe', single_source=True) |
|
|
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) |
370 |
except KeyError: |
except KeyError: |
371 |
pass |
pass |
372 |
|
|
373 |
|
|
374 |
if dodebug: |
if dodebug: |
375 |
if useMPI: |
if useMPI: |
376 |
try: |
try: |
551 |
useNetCDF = 'yes' |
useNetCDF = 'yes' |
552 |
pass |
pass |
553 |
|
|
|
if not useNetCDF == 'yes': |
|
|
print "Warning: Installation is not configured with netCDF. Some I/O function may not be available." |
|
|
|
|
554 |
if useNetCDF == 'yes': |
if useNetCDF == 'yes': |
555 |
try: |
try: |
556 |
|
netCDF_libs = env['netCDF_libs'] |
557 |
|
except KeyError: |
558 |
|
pass |
559 |
|
|
560 |
|
env.Append(LIBS = netCDF_libs) |
561 |
|
env.Append(CPPDEFINES = [ 'USE_NETCDF' ]) |
562 |
|
try: |
563 |
includes = env['netCDF_path'] |
includes = env['netCDF_path'] |
564 |
env.Append(CPPPATH = [includes,]) |
env.Append(CPPPATH = [includes,]) |
565 |
except KeyError: |
except KeyError: |
571 |
env.Append(LIBPATH = [ lib_path, ]) |
env.Append(LIBPATH = [ 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: |
673 |
except KeyError: |
except KeyError: |
674 |
api_doxygen = None |
api_doxygen = None |
675 |
|
|
676 |
|
try: |
677 |
|
svn_pipe = os.popen("svn info | grep '^Revision'") |
678 |
|
rev = svn_pipe.readlines() |
679 |
|
svn_pipe.close() |
680 |
|
svn_version = re.sub("[^0-9]", "", rev[0]) |
681 |
|
except: |
682 |
|
svn_version = "0" |
683 |
|
env.Append(CPPDEFINES = "SVN_VERSION="+svn_version) |
684 |
|
|
685 |
|
# Python install - esys __init__.py |
686 |
|
init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET')) |
687 |
|
|
688 |
# FIXME: exinstall and friends related to examples are not working. |
# FIXME: exinstall and friends related to examples are not working. |
689 |
build_target = env.Alias('build',[libinstall,incinstall,pyinstall]) |
build_target = env.Alias('build',[libinstall,incinstall,pyinstall,init_target]) |
690 |
|
|
691 |
env.Default(build_target) |
env.Default(build_target) |
692 |
|
|
703 |
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]) |
704 |
env.Alias('release', ['release_src', 'release_tests', 'docs']) |
env.Alias('release', ['release_src', 'release_tests', 'docs']) |
705 |
|
|
706 |
env.Alias('build_tests') # target to build all C++ tests |
env.Alias('build_tests',build_target) # target to build all C++ tests |
707 |
env.Alias('build_py_tests') # target to build all python tests |
env.Alias('build_py_tests',build_target) # target to build all python tests |
708 |
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 |
709 |
env.Alias('run_tests', 'build_tests') # target to run all C++ test |
env.Alias('run_tests', 'build_tests') # target to run all C++ test |
710 |
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 |
711 |
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 |
712 |
|
|
|
# Python install - esys __init__.py |
|
|
init_target = env.Command(pyinstall+'/__init__.py', None, Touch('$TARGET')) |
|
|
env.Alias(init_target) |
|
713 |
|
|
714 |
# Allow sconscripts to see the env |
# Allow sconscripts to see the env |
715 |
Export(["IS_WINDOWS_PLATFORM", "env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug", "mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", "netCDF_libs", "useNetCDF", |
Export(["env", "incinstall", "libinstall", "pyinstall", "exinstall", "dodebug", |
716 |
|
"mkl_libs", "scsl_libs", "umf_libs", "amd_libs", "blas_libs", |
717 |
|
"netCDF_libs", |
718 |
"boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs", |
"boost_lib", "python_lib", "doxygen_path", "epydoc_path", "papi_libs", |
719 |
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", "src_tarfile", "examples_tarfile", "examples_zipfile", |
"sys_libs", "test_zipfile", "src_zipfile", "test_tarfile", |
720 |
"guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" ]) |
"src_tarfile", "examples_tarfile", "examples_zipfile", |
721 |
|
"guide_pdf", "guide_html_index", "api_epydoc", "api_doxygen", "useMPI" |
722 |
|
]) |
723 |
|
|
724 |
# End initialisation section |
# End initialisation section |
725 |
# Begin configuration section |
# Begin configuration section |