54 |
vars.AddVariables( |
vars.AddVariables( |
55 |
PathVariable('options_file', 'Path to options file', options_file, PathVariable.PathIsFile), |
PathVariable('options_file', 'Path to options file', options_file, PathVariable.PathIsFile), |
56 |
PathVariable('prefix', 'Installation prefix', Dir('#.').abspath, PathVariable.PathIsDirCreate), |
PathVariable('prefix', 'Installation prefix', Dir('#.').abspath, PathVariable.PathIsDirCreate), |
57 |
|
PathVariable('build_dir', 'Top-level build directory', Dir('#/build').abspath, PathVariable.PathIsDirCreate), |
58 |
BoolVariable('verbose', 'Output full compile/link lines', False), |
BoolVariable('verbose', 'Output full compile/link lines', False), |
59 |
# Compiler/Linker options |
# Compiler/Linker options |
60 |
('cc', 'Path to C compiler', 'default'), |
('cc', 'Path to C compiler', 'default'), |
72 |
('omp_ldflags', 'OpenMP linker flags', 'default'), |
('omp_ldflags', 'OpenMP linker flags', 'default'), |
73 |
# Mandatory libraries |
# Mandatory libraries |
74 |
('boost_prefix', 'Prefix/Paths of boost installation', default_prefix), |
('boost_prefix', 'Prefix/Paths of boost installation', default_prefix), |
75 |
('boost_libs', 'Boost libraries to link with', ['boost_python']), |
('boost_libs', 'Boost libraries to link with', ['boost_python-mt']), |
76 |
# Optional libraries and options |
# Optional libraries and options |
77 |
EnumVariable('mpi', 'Compile parallel version using MPI flavour', 'none', allowed_values=mpi_flavours), |
EnumVariable('mpi', 'Compile parallel version using MPI flavour', 'none', allowed_values=mpi_flavours), |
78 |
('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix), |
('mpi_prefix', 'Prefix/Paths of MPI installation', default_prefix), |
103 |
('visit_prefix', 'Prefix/Paths to VisIt installation', default_prefix), |
('visit_prefix', 'Prefix/Paths to VisIt installation', default_prefix), |
104 |
('visit_libs', 'VisIt libraries to link with', ['simV2']), |
('visit_libs', 'VisIt libraries to link with', ['simV2']), |
105 |
BoolVariable('pyvisi', 'Enable pyvisi (deprecated, requires VTK module)', False), |
BoolVariable('pyvisi', 'Enable pyvisi (deprecated, requires VTK module)', False), |
106 |
|
BoolVariable('vsl_random', 'Use VSL from intel for random data', False), |
107 |
# Advanced settings |
# Advanced settings |
108 |
#dudley_assemble_flags = -funroll-loops to actually do something |
#dudley_assemble_flags = -funroll-loops to actually do something |
109 |
('dudley_assemble_flags', 'compiler flags for some dudley optimisations', ''), |
('dudley_assemble_flags', 'compiler flags for some dudley optimisations', ''), |
127 |
# Intel's compiler uses regular expressions improperly and emits a warning |
# Intel's compiler uses regular expressions improperly and emits a warning |
128 |
# about failing to find the compilers. This warning can be safely ignored. |
# about failing to find the compilers. This warning can be safely ignored. |
129 |
|
|
130 |
env = Environment(tools = ['default'], options = vars) |
# PATH is needed so the compiler, linker and tools are found if they are not |
131 |
|
# in default locations. |
132 |
|
env = Environment(tools = ['default'], options = vars, |
133 |
|
ENV = {'PATH': os.environ['PATH']}) |
134 |
if env['tools_names'] != 'default': |
if env['tools_names'] != 'default': |
135 |
env = Environment(tools = ['default'] + env['tools_names'], options = vars) |
env = Environment(tools = ['default'] + env['tools_names'], options = vars, |
136 |
|
ENV = {'PATH' : os.environ['PATH']}) |
137 |
|
|
138 |
if options_file: |
if options_file: |
139 |
opts_valid=False |
opts_valid=False |
159 |
|
|
160 |
#################### Make sure install directories exist ##################### |
#################### Make sure install directories exist ##################### |
161 |
|
|
162 |
|
env['BUILD_DIR']=env['build_dir'] |
163 |
prefix=Dir(env['prefix']).abspath |
prefix=Dir(env['prefix']).abspath |
164 |
env['incinstall'] = os.path.join(prefix, 'include') |
env['incinstall'] = os.path.join(prefix, 'include') |
165 |
env['bininstall'] = os.path.join(prefix, 'bin') |
env['bininstall'] = os.path.join(prefix, 'bin') |
304 |
else: |
else: |
305 |
LD_LIBRARY_PATH_KEY='LD_LIBRARY_PATH' |
LD_LIBRARY_PATH_KEY='LD_LIBRARY_PATH' |
306 |
|
|
307 |
# the following env variables are exported for the unit tests, PATH is needed |
# the following env variables are exported for the unit tests |
|
# so the compiler/linker is found if they are not in default locations. |
|
308 |
|
|
309 |
for key in 'OMP_NUM_THREADS', 'ESCRIPT_NUM_PROCS', 'ESCRIPT_NUM_NODES': |
for key in 'OMP_NUM_THREADS', 'ESCRIPT_NUM_PROCS', 'ESCRIPT_NUM_NODES': |
310 |
try: |
try: |
313 |
env['ENV'][key] = 1 |
env['ENV'][key] = 1 |
314 |
|
|
315 |
env_export=env['env_export'] |
env_export=env['env_export'] |
316 |
env_export.extend(['ESCRIPT_NUM_THREADS','ESCRIPT_HOSTFILE','DISPLAY','XAUTHORITY','PATH','HOME']) |
env_export.extend(['ESCRIPT_NUM_THREADS','ESCRIPT_HOSTFILE','DISPLAY','XAUTHORITY','PATH','HOME','TMPDIR','TEMP','TMP']) |
317 |
|
|
318 |
for key in set(env_export): |
for key in set(env_export): |
319 |
try: |
try: |
382 |
python_inc_path=sysconfig.get_python_inc() |
python_inc_path=sysconfig.get_python_inc() |
383 |
if IS_WINDOWS: |
if IS_WINDOWS: |
384 |
python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs') |
python_lib_path=os.path.join(sysconfig.get_config_var('prefix'), 'libs') |
385 |
|
elif env['PLATFORM']=='darwin': |
386 |
|
python_lib_path=sysconfig.get_config_var('LIBPL') |
387 |
else: |
else: |
388 |
python_lib_path=sysconfig.get_config_var('LIBDIR') |
python_lib_path=sysconfig.get_config_var('LIBDIR') |
389 |
#python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux |
#python_libs=[sysconfig.get_config_var('LDLIBRARY')] # only on linux |
527 |
# weipa library and tools. |
# weipa library and tools. |
528 |
#env.AppendUnique(LIBS = [env['silo_libs']]) |
#env.AppendUnique(LIBS = [env['silo_libs']]) |
529 |
|
|
530 |
|
######## VSL random numbers (optional) |
531 |
|
if env['vsl_random']: |
532 |
|
env.Append(CPPDEFINES = ['MKLRANDOM']) |
533 |
|
|
534 |
######## VisIt (optional) |
######## VisIt (optional) |
535 |
|
|
536 |
visit_inc_path='' |
visit_inc_path='' |
572 |
env.PrependENVPath(LD_LIBRARY_PATH_KEY, parmetis_lib_path) |
env.PrependENVPath(LD_LIBRARY_PATH_KEY, parmetis_lib_path) |
573 |
env.Append(CPPDEFINES = ['USE_PARMETIS']) |
env.Append(CPPDEFINES = ['USE_PARMETIS']) |
574 |
|
|
575 |
|
######## gmsh (optional, for tests) |
576 |
|
|
577 |
|
try: |
578 |
|
import subprocess |
579 |
|
p=subprocess.Popen(['gmsh', '-version'], stderr=subprocess.PIPE) |
580 |
|
p.poll() |
581 |
|
env['gmsh']=True |
582 |
|
except OSError: |
583 |
|
env['gmsh']=False |
584 |
|
|
585 |
######################## Summarize our environment ########################### |
######################## Summarize our environment ########################### |
586 |
|
|
587 |
# keep some of our install paths first in the list for the unit tests |
# keep some of our install paths first in the list for the unit tests |
620 |
print(" LAPACK: DISABLED") |
print(" LAPACK: DISABLED") |
621 |
d_list=[] |
d_list=[] |
622 |
e_list=[] |
e_list=[] |
623 |
for i in 'debug','openmp','netcdf','parmetis','papi','mkl','umfpack','silo','visit','pyvisi': |
for i in 'debug','openmp','netcdf','parmetis','papi','mkl','umfpack','silo','visit': |
624 |
if env[i]: e_list.append(i) |
if env[i]: e_list.append(i) |
625 |
else: d_list.append(i) |
else: d_list.append(i) |
626 |
for i in e_list: |
for i in e_list: |
627 |
print("%16s: YES"%i) |
print("%16s: YES"%i) |
628 |
for i in d_list: |
for i in d_list: |
629 |
print("%16s: DISABLED"%i) |
print("%16s: DISABLED"%i) |
630 |
|
if env['gmsh']: |
631 |
|
print(" gmsh: FOUND") |
632 |
|
else: |
633 |
|
print(" gmsh: NOT FOUND") |
634 |
|
print(" vsl_random: %s"%env['vsl_random']) |
635 |
|
|
636 |
if ((fatalwarning != '') and (env['werror'])): |
if ((fatalwarning != '') and (env['werror'])): |
637 |
print(" Treating warnings as errors") |
print(" Treating warnings as errors") |
638 |
else: |
else: |
661 |
] |
] |
662 |
) |
) |
663 |
|
|
664 |
env.SConscript(dirs = ['tools/CppUnitTest/src'], variant_dir='build/$PLATFORM/tools/CppUnitTest', duplicate=0) |
env.SConscript(dirs = ['tools/CppUnitTest/src'], variant_dir='$BUILD_DIR/$PLATFORM/tools/CppUnitTest', duplicate=0) |
665 |
env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='build/$PLATFORM/tools/escriptconvert', duplicate=0) |
env.SConscript(dirs = ['tools/escriptconvert'], variant_dir='$BUILD_DIR/$PLATFORM/tools/escriptconvert', duplicate=0) |
666 |
env.SConscript(dirs = ['paso/src'], variant_dir='build/$PLATFORM/paso', duplicate=0) |
env.SConscript(dirs = ['paso/src'], variant_dir='$BUILD_DIR/$PLATFORM/paso', duplicate=0) |
667 |
env.SConscript(dirs = ['weipa/src'], variant_dir='build/$PLATFORM/weipa', duplicate=0) |
env.SConscript(dirs = ['weipa/src'], variant_dir='$BUILD_DIR/$PLATFORM/weipa', duplicate=0) |
668 |
env.SConscript(dirs = ['escript/src'], variant_dir='build/$PLATFORM/escript', duplicate=0) |
env.SConscript(dirs = ['escript/src'], variant_dir='$BUILD_DIR/$PLATFORM/escript', duplicate=0) |
669 |
env.SConscript(dirs = ['esysUtils/src'], variant_dir='build/$PLATFORM/esysUtils', duplicate=0) |
env.SConscript(dirs = ['esysUtils/src'], variant_dir='$BUILD_DIR/$PLATFORM/esysUtils', duplicate=0) |
670 |
env.SConscript(dirs = ['dudley/src'], variant_dir='build/$PLATFORM/dudley', duplicate=0) |
env.SConscript(dirs = ['dudley/src'], variant_dir='$BUILD_DIR/$PLATFORM/dudley', duplicate=0) |
671 |
env.SConscript(dirs = ['finley/src'], variant_dir='build/$PLATFORM/finley', duplicate=0) |
env.SConscript(dirs = ['finley/src'], variant_dir='$BUILD_DIR/$PLATFORM/finley', duplicate=0) |
672 |
env.SConscript(dirs = ['modellib/py_src'], variant_dir='build/$PLATFORM/modellib', duplicate=0) |
env.SConscript(dirs = ['modellib/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/modellib', duplicate=0) |
673 |
env.SConscript(dirs = ['doc'], variant_dir='build/$PLATFORM/doc', duplicate=0) |
env.SConscript(dirs = ['doc'], variant_dir='$BUILD_DIR/$PLATFORM/doc', duplicate=0) |
674 |
env.SConscript(dirs = ['pyvisi/py_src'], variant_dir='build/$PLATFORM/pyvisi', duplicate=0) |
env.SConscript(dirs = ['pyvisi/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pyvisi', duplicate=0) |
675 |
env.SConscript(dirs = ['pycad/py_src'], variant_dir='build/$PLATFORM/pycad', duplicate=0) |
env.SConscript(dirs = ['pycad/py_src'], variant_dir='$BUILD_DIR/$PLATFORM/pycad', duplicate=0) |
676 |
env.SConscript(dirs = ['pythonMPI/src'], variant_dir='build/$PLATFORM/pythonMPI', duplicate=0) |
env.SConscript(dirs = ['pythonMPI/src'], variant_dir='$BUILD_DIR/$PLATFORM/pythonMPI', duplicate=0) |
677 |
env.SConscript(dirs = ['paso/profiling'], variant_dir='build/$PLATFORM/paso/profiling', duplicate=0) |
env.SConscript(dirs = ['paso/profiling'], variant_dir='$BUILD_DIR/$PLATFORM/paso/profiling', duplicate=0) |
678 |
|
|
679 |
######################## Populate the buildvars file ######################### |
######################## Populate the buildvars file ######################### |
680 |
|
|
712 |
buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path) |
buildvars.write("mpi_lib_path=%s\n"%mpi_lib_path) |
713 |
buildvars.write("lapack=%s\n"%env['lapack']) |
buildvars.write("lapack=%s\n"%env['lapack']) |
714 |
buildvars.write("pyvisi=%d\n"%env['pyvisi']) |
buildvars.write("pyvisi=%d\n"%env['pyvisi']) |
715 |
|
buildvars.write("vsl_random=%d"%int(env['vsl_random'])) |
716 |
for i in 'netcdf','parmetis','papi','mkl','umfpack','silo','visit': |
for i in 'netcdf','parmetis','papi','mkl','umfpack','silo','visit': |
717 |
buildvars.write("%s=%d\n"%(i, int(env[i]))) |
buildvars.write("%s=%d\n"%(i, int(env[i]))) |
718 |
if env[i]: |
if env[i]: |
787 |
env.Alias('run_tests', ['install_all', 'install_cppunittest_lib']) |
env.Alias('run_tests', ['install_all', 'install_cppunittest_lib']) |
788 |
env.Alias('all_tests', ['install_all', 'install_cppunittest_lib', 'run_tests', 'py_tests']) |
env.Alias('all_tests', ['install_all', 'install_cppunittest_lib', 'run_tests', 'py_tests']) |
789 |
env.Alias('build_full',['install_all','build_tests','build_py_tests']) |
env.Alias('build_full',['install_all','build_tests','build_py_tests']) |
790 |
env.Alias('build_PasoTests','build/$PLATFORM/paso/profiling/PasoTests') |
env.Alias('build_PasoTests','$BUILD_DIR/$PLATFORM/paso/profiling/PasoTests') |
791 |
|
|
792 |
##################### Targets to build the documentation ##################### |
##################### Targets to build the documentation ##################### |
793 |
|
|
794 |
env.Alias('api_epydoc','install_all') |
env.Alias('api_epydoc','install_all') |
795 |
env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'guide_pdf', 'install_pdf', 'cookbook_pdf']) |
env.Alias('docs', ['examples_tarfile', 'examples_zipfile', 'api_epydoc', 'api_doxygen', 'user_pdf', 'install_pdf', 'cookbook_pdf']) |
796 |
env.Alias('release_prep', ['docs', 'install_all']) |
env.Alias('release_prep', ['docs', 'install_all']) |
797 |
|
|
798 |
if not IS_WINDOWS: |
if not IS_WINDOWS: |
811 |
# Make sure that the escript wrapper is in place |
# Make sure that the escript wrapper is in place |
812 |
if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')): |
if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')): |
813 |
print("Copying escript wrapper.") |
print("Copying escript wrapper.") |
814 |
Execute(Copy(os.path.join(env['bininstall'],'escript'), 'bin/run-escript')) |
Execute(Copy(os.path.join(env['bininstall'],'run-escript'), 'bin/run-escript')) |
815 |
|
|