diff --git a/SConstruct b/SConstruct index ccab139bc..149799fcc 100644 --- a/SConstruct +++ b/SConstruct @@ -61,6 +61,8 @@ if 'clean' in COMMAND_LINE_TARGETS: removeFile('.sconsign.dblite') removeFile('include/cantera/base/config.h') removeFile('include/cantera/base/system.h.gch') + removeFile('include/cantera/base/system.pch') + removeFile('include/cantera/base/system.obj') removeDirectory('include/cantera/ext') removeFile('interfaces/cython/cantera/_cantera.cpp') removeFile('interfaces/cython/cantera/_cantera.h') @@ -268,6 +270,8 @@ elif env['CC'] == 'cl': # Visual Studio defaults.optimizeCcFlags = '/O2' defaults.debugLinkFlags = '/DEBUG' defaults.warningFlags = '/W3' + defaults.buildPch = True + env['pch_flags'] = ['/FIcantera/base/system.h'] elif 'icc' in env.subst('$CC'): defaults.cxxFlags = '-std=c++0x' @@ -1407,15 +1411,6 @@ env['cantera_shared_libs'] = linkSharedLibs if not env['renamed_shared_libraries']: env['cantera_shared_libs'] = linkLibs -if env['use_pch']: - env['precompiled_header'] = File('include/cantera/base/system.h') - pch = build(env.GchSh('include/cantera/base/system.h.gch', env['precompiled_header'])) - # To force early compilaton of the precompiled header - env.Depends(config_h, pch) -else: - removeFile('include/cantera/base/system.h.gch') - env['pch_flags'] = [] - # Add targets from the SConscript files in the various subdirectories Export('env', 'build', 'libraryTargets', 'install', 'buildSample') diff --git a/appveyor.yml b/appveyor.yml index 55d9483d1..08c39e1b6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,7 +6,7 @@ install: C:\Python27-x64\Scripts\pip.exe install cython build_script: -- cmd: C:\Python27-x64\scons build boost_inc_dir=C:\Libraries\boost_1_62_0 +- cmd: C:\Python27-x64\scons build boost_inc_dir=C:\Libraries\boost_1_62_0 debug=n test_script: - ps: | diff --git a/include/cantera/base/system.cpp b/include/cantera/base/system.cpp new file mode 100644 index 000000000..fd6e27eec --- /dev/null +++ b/include/cantera/base/system.cpp @@ -0,0 +1 @@ +#include "cantera/base/system.h" diff --git a/src/SConscript b/src/SConscript index 19d67336b..3d5a7766c 100644 --- a/src/SConscript +++ b/src/SConscript @@ -24,18 +24,38 @@ libs = [('base', ['cpp'], baseSetup), ('clib', ['cpp'], defaultSetup), ] +localenv = env.Clone() +localenv.Prepend(CPPPATH=[Dir('#include'), Dir('#include/cantera/ext'), Dir('.')]) +localenv.Append(CCFLAGS=env['warning_flags']) + +if env['CC'] == 'cl' and env['debug']: + env['use_pch'] = False # PCH doesn't work with per-file PDB + +if env['use_pch']: + if env['CC'] == 'cl': + localenv['PCH'], pchobj = localenv.PCH('#include/cantera/base/system.cpp') + libraryTargets.append(pchobj) + localenv['PCHSTOP'] = 'cantera/base/system.h' + else: + localenv['precompiled_header'] = File('#include/cantera/base/system.h') + pch = build(localenv.GchSh('#include/cantera/base/system.h.gch', + localenv['precompiled_header'])) + # To force early compilaton of the precompiled header + localenv.Depends(env['config_h_target'], pch) + +else: + removeFile('include/cantera/base/system.h.gch') + env['pch_flags'] = [] + for subdir, extensions, setup in libs: - localenv = env.Clone() - localenv.Prepend(CPPPATH=[Dir('#include'), Dir('#include/cantera/ext')]) - localenv.Append(CCFLAGS=env['warning_flags']) - source = setup(localenv, subdir, extensions) - objects = localenv.SharedObject(source) - localenv.Depends(objects, localenv['config_h_target']) + env2 = localenv.Clone() + source = setup(env2, subdir, extensions) + objects = env2.SharedObject(source) + env2.Depends(objects, env2['config_h_target']) libraryTargets.extend(objects) # build the Cantera static library -localenv = env.Clone() lib = build(localenv.StaticLibrary('../lib/cantera', libraryTargets, SPAWN=getSpawn(localenv))) localenv.Depends(lib, localenv['config_h_target'])