[SCons] SConstruct for C++ demos inherits compiler and options

Use the same values for the compiler name and the compiler flags as were used
when compiling Cantera.
This commit is contained in:
Ray Speth 2016-04-06 22:07:51 -04:00
parent ee1b07ac6b
commit 0a3927a077
2 changed files with 3 additions and 11 deletions

View file

@ -9,14 +9,6 @@ samples = [('combustor', 'combustor', ['cpp']),
('NASA_coeffs', 'NASA_coeffs', ['cpp']),
('rankine', 'rankine', ['cpp'])]
if env['CC'] == 'cl':
debug_link_flag = '/DEBUG'
compilerFlags = ['/EHsc', '/MD', '/nologo', '/W3',
'/D_SCL_SECURE_NO_WARNINGS', '/D_CRT_SECURE_NO_WARNINGS']
else:
debug_link_flag = '-g'
compilerFlags = ['-g', '-Wall']
for subdir, name, extensions in samples:
localenv = env.Clone()
buildSample(localenv.Program, pjoin(subdir, name),
@ -46,13 +38,12 @@ for subdir, name, extensions in samples:
localenv['boost_inc_dir']) + tuple(localenv['extra_inc_dirs'])
libdirs = ((localenv['ct_libdir'], localenv['sundials_libdir'],
localenv['blas_lapack_dir']) + tuple(localenv['extra_lib_dirs']))
linkflags = (debug_link_flag, localenv['thread_flags'])
localenv['tmpl_compiler_flags'] = repr(compilerFlags)
localenv['tmpl_compiler_flags'] = repr(localenv['CCFLAGS'] + localenv['CXXFLAGS'])
localenv['tmpl_cantera_frameworks'] = repr(localenv['FRAMEWORKS'])
localenv['tmpl_cantera_incdirs'] = repr([x for x in incdirs if x])
localenv['tmpl_cantera_libs'] = repr(localenv['cantera_libs'])
localenv['tmpl_cantera_libdirs'] = repr([x for x in libdirs if x])
localenv['tmpl_cantera_linkflags'] = repr([x for x in linkflags if x])
localenv['tmpl_cantera_linkflags'] = repr(localenv['LINKFLAGS'])
localenv['tmpl_progname'] = name
localenv['tmpl_sourcename'] = name + '.cpp'
env_args = []

View file

@ -1,5 +1,6 @@
env = Environment(@tmpl_env_args@)
env['CXX'] = '@CXX@'
env.Append(CCFLAGS=@tmpl_compiler_flags@,
CPPPATH=@tmpl_cantera_incdirs@,
LIBS=@tmpl_cantera_libs@,