From c77539e5777dc99b97a856e7f05b756549ed2ce2 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 13 Aug 2012 20:14:04 +0000 Subject: [PATCH] Fixed generated SConstruct files to work with MSVC cherry-pick of r1634 from 2.0 maintenance branch --- SConstruct | 5 +++-- samples/cxx/SConscript | 11 ++++++++++- samples/cxx/SConstruct.in | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index fe80b2350..71e942602 100644 --- a/SConstruct +++ b/SConstruct @@ -971,12 +971,13 @@ config_h = env.Command('include/cantera/base/config.h', env.AlwaysBuild(config_h) env['config_h_target'] = config_h +env['boost_libs'] = [] if env['build_thread_safe']: env['use_boost_libs'] = True - env['boost_libs'] = [env['boost_thread_lib']] + if env['CC'] != 'cl': + env['boost_libs'].append(env['boost_thread_lib']) else: env['use_boost_libs'] = False - env['boost_libs'] = [] # ********************* # *** Build Cantera *** diff --git a/samples/cxx/SConscript b/samples/cxx/SConscript index 0ed0f2f0d..e4094536f 100644 --- a/samples/cxx/SConscript +++ b/samples/cxx/SConscript @@ -9,6 +9,14 @@ 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), @@ -30,7 +38,8 @@ for subdir, name, extensions in samples: localenv['boost_inc_dir']) libdirs = (localenv['ct_libdir'], localenv['sundials_libdir'], localenv['blas_lapack_dir'], localenv['boost_lib_dir']) - linkflags = ('-g', localenv['thread_flags']) + 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]) diff --git a/samples/cxx/SConstruct.in b/samples/cxx/SConstruct.in index 898e4c7f2..3ef258db9 100644 --- a/samples/cxx/SConstruct.in +++ b/samples/cxx/SConstruct.in @@ -1,6 +1,6 @@ env = Environment() -env.Append(CCFLAGS='-g', +env.Append(CCFLAGS=@tmpl_compiler_flags@, CPPPATH=@tmpl_cantera_incdirs@, LIBS=@tmpl_cantera_libs@, LIBPATH=@tmpl_cantera_libdirs@,