Files
cantera/ext/SConscript
T

78 lines
2.9 KiB
Python
Raw Normal View History

from buildutils import *
Import('env', 'build', 'install', 'libraryTargets')
localenv = env.Clone()
def prep_default(env):
localenv = env.Clone()
# Suppress warnings from external code and auto-generated code
if 'g++' in localenv['CXX'] or 'clang' in localenv['CXX']:
localenv.Append(CCFLAGS='-w')
return localenv
2013-02-01 23:39:53 +00:00
2012-02-01 23:34:40 +00:00
def prep_gtest(env):
localenv = prep_default(env)
2015-10-17 23:52:04 -04:00
localenv.Prepend(CPPPATH=[Dir('#ext/googletest'),
Dir('#ext/googletest/include')],
2012-02-01 23:35:01 +00:00
CPPDEFINES={'GTEST_HAS_PTHREAD': 0})
2012-02-01 23:34:40 +00:00
return localenv
2016-05-01 22:40:49 -04:00
def prep_fmt(env):
localenv = prep_default(env)
build(localenv.Command("#include/cantera/ext/format.h",
2016-05-01 22:40:49 -04:00
"#ext/fmt/fmt/format.h",
Copy('$TARGET', '$SOURCE')))
return localenv
# each element of libs is: (subdir, (file extensions), prepfunction)
libs = [('libexecstream', ['cpp'], prep_default),
2016-05-01 22:40:49 -04:00
('fmt/fmt', ['cc'], prep_fmt)]
for subdir, extensions, prepFunction in libs:
localenv = prepFunction(env)
objects = localenv.SharedObject(mglob(localenv, subdir, *extensions))
libraryTargets.extend(objects)
2013-02-15 17:32:31 +00:00
if env['system_sundials'] == 'n':
localenv = prep_default(env)
localenv.Prepend(CPPPATH=Dir('#include/cantera/ext'))
# Generate sundials_config.h
sundials_configh = {}
if env['OS'] != 'Windows':
sundials_configh['SUNDIALS_USE_GENERIC_MATH'] = 1
if env['use_lapack']:
sundials_configh['SUNDIALS_BLAS_LAPACK'] = 1
localenv.AlwaysBuild(env.Command('#include/cantera/ext/sundials/sundials_config.h',
'sundials_config.h.in',
ConfigBuilder(sundials_configh)))
# Copy sundials header files into common include directory
for subdir in ('sundials', 'nvector', 'cvodes', 'ida'):
for header in mglob(env, 'sundials/include/'+subdir, 'h'):
build(localenv.Command('#include/cantera/ext/%s/%s' % (subdir, header.name),
'#ext/sundials/include/%s/%s' % (subdir, header.name),
Copy('$TARGET', '$SOURCE')))
# Compile Sundials source files
exclude = ['_klu', '_superlumt']
if not env['use_lapack']:
exclude.append('_lapack')
for subdir in ('sundials', 'nvec_ser', 'cvodes', 'ida'):
libraryTargets.extend(localenv.SharedObject(
[f for f in mglob(localenv, 'sundials/src/'+subdir, 'c')
if not any(pattern in f.name for pattern in exclude)]))
2016-04-09 22:31:40 -04:00
if not env['system_eigen']:
build(localenv.Command('#include/cantera/ext/Eigen', '#ext/eigen/Eigen',
Copy('$TARGET', '$SOURCE')))
# Google Test: Used internally for Cantera unit tests.
2015-10-17 23:52:04 -04:00
if not env['system_googletest']:
localenv = prep_gtest(env)
gtest = build(localenv.Library('../lib/gtest',
source=['googletest/src/gtest-all.cc']))