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'])] 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']) libs = (['cantera'] + localenv['sundials_libs'] + localenv['boost_libs'] + localenv['blas_lapack_libs']) libdirs = (localenv['ct_libdir'], localenv['sundials_libdir'], localenv['blas_lapack_dir'], localenv['boost_lib_dir']) linkflags = ('-g', localenv['thread_flags']) localenv['tmpl_cantera_incdirs'] = repr([x for x in incdirs if x]) localenv['tmpl_cantera_libs'] = repr([x for x in libs if x]) 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)