cantera/samples/cxx/SConscript
Ray Speth c77539e577 Fixed generated SConstruct files to work with MSVC
cherry-pick of r1634 from 2.0 maintenance branch
2012-08-13 20:14:04 +00:00

51 lines
2.2 KiB
Python

from buildutils import *
Import('env', 'build', 'install', 'buildSample')
# (subdir, program name, [source extensions])
samples = [('combustor', 'combustor', ['cpp']),
('flamespeed', 'flamespeed', ['cpp']),
('kinetics1', 'kinetics1', ['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),
mglob(localenv, subdir, *extensions),
CPPPATH=['#include'],
LIBS=env['cantera_libs'])
# Note: These Makefiles and SConstruct files are automatically installed
# by the "RecursiveInstall" that grabs everything in the cxx directory.
## Generate Makefiles to be installed
localenv['make_sourcefile'] = '%s.cpp' % name
localenv['make_target'] = name
makefile = build(localenv.SubstFile(pjoin(subdir, 'Makefile'), 'Makefile.in'))
install(pjoin('$inst_sampledir', 'cxx', subdir), makefile)
## Generate SConstruct files to be installed
incdirs = (localenv['ct_incroot'], localenv['sundials_include'],
localenv['boost_inc_dir'])
libdirs = (localenv['ct_libdir'], localenv['sundials_libdir'],
localenv['blas_lapack_dir'], localenv['boost_lib_dir'])
linkflags = (debug_link_flag, localenv['thread_flags'])
localenv['tmpl_compiler_flags'] = repr(compilerFlags)
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_progname'] = name
localenv['tmpl_sourcename'] = name + '.cpp'
sconstruct = localenv.SubstFile(pjoin(subdir, 'SConstruct'), 'SConstruct.in')
install(pjoin('$inst_sampledir', 'cxx', subdir), sconstruct)