diff options
author | Gary Oberbrunner <garyo@oberbrunner.com> | 2011-05-15 14:05:26 (GMT) |
---|---|---|
committer | Gary Oberbrunner <garyo@oberbrunner.com> | 2011-05-15 14:05:26 (GMT) |
commit | e4b3ac6a7bf6a3484607fae8675e80d205d63892 (patch) | |
tree | 90a06df59a3591b9cf37937f2c34a6936c4ec645 /src | |
parent | f96b105c4c523f898d53d11c601360e2ac8468d8 (diff) | |
download | SCons-e4b3ac6a7bf6a3484607fae8675e80d205d63892.zip SCons-e4b3ac6a7bf6a3484607fae8675e80d205d63892.tar.gz SCons-e4b3ac6a7bf6a3484607fae8675e80d205d63892.tar.bz2 |
Fix issue #2702, MSVS generation fails when CPPPATH contains Dir nodes. Also make MSVS project depend on values of CPPDEFINES and CPPPATH so it gets properly regenerated when they change.
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 2 | ||||
-rw-r--r-- | src/RELEASE.txt | 3 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msvs.py | 21 |
3 files changed, 24 insertions, 2 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 147a016..c1467b3 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -26,6 +26,8 @@ RELEASE 2.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE embed manifests in Windows EXEs and DLLs. From Gary Oberbrunner: + - Fix Visual Studio project generation when CPPPATH contains Dir nodes + - Ensure Visual Studio project is regenerated when CPPPATH or CPPDEFINES change - Fix unicode error when using non-ASCII filenames with Copy or Install - Put RPATH in LINKCOM rather than LINKFLAGS so resetting LINKFLAGS doesn't kill RPATH diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 67f27a4..8cd46a9 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -56,6 +56,9 @@ FIXES + - Visual Studio project generation now works when CPPPATH contains Dir nodes + - Visual Studio projects are regenerated when CPPPATH or CPPDEFINES change + NOTE: this will cause all MSVS projects to be regenerated with this version. - Passing MSVC_BATCH=False works now (treated same as 0) - Long compile lines no longer break MSVC_BATCH mode - RPATH is now in LINKCOM rather than LINKFLAGS, so resetting diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 7eae6e9..5414ada 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -47,6 +47,7 @@ import SCons.Builder import SCons.Node.FS import SCons.Platform.win32 import SCons.Script.SConscript +import SCons.PathList import SCons.Util import SCons.Warnings @@ -64,6 +65,12 @@ def xmlify(s): s = s.replace('"', """) return s +# Process a CPPPATH list in includes, given the env, target and source. +# Returns a tuple of nodes. +def processIncludes(includes, env, target, source): + return SCons.PathList.PathList(includes).subst_path(env, target, source) + + external_makefile_guid = '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}' def _generateGUID(slnfile, name): @@ -705,9 +712,13 @@ class _GenerateV7DSP(_DSPGenerator): rebuildcmd = xmlify(starting + self.env.subst('$MSVSREBUILDCOM', 1) + cmdargs) cleancmd = xmlify(starting + self.env.subst('$MSVSCLEANCOM', 1) + cmdargs) + # This isn't perfect; CPPDEFINES and CPPPATH can contain $TARGET and $SOURCE, + # so they could vary depending on the command being generated. This code + # assumes they don't. preprocdefs = xmlify(';'.join(processDefines(self.env.get('CPPDEFINES', [])))) - includepath = xmlify(';'.join(self.env.get('CPPPATH', []))) - + includepath_Dirs = processIncludes(self.env.get('CPPPATH', []), self.env, None, None) + includepath = xmlify(';'.join([str(x) for x in includepath_Dirs])) + if not env_has_buildtarget: del self.env['MSVSBUILDTARGET'] @@ -1568,6 +1579,12 @@ def projectEmitter(target, source, env): source = source + env.subst('$MSVSSCONSCOM', 1) source = source + env.subst('$MSVSENCODING', 1) + # Project file depends on CPPDEFINES and CPPPATH + preprocdefs = xmlify(';'.join(processDefines(env.get('CPPDEFINES', [])))) + includepath_Dirs = processIncludes(env.get('CPPPATH', []), env, None, None) + includepath = xmlify(';'.join([str(x) for x in includepath_Dirs])) + source = source + "; ppdefs:%s incpath:%s"%(preprocdefs, includepath) + if 'buildtarget' in env and env['buildtarget'] != None: if SCons.Util.is_String(env['buildtarget']): source = source + ' "%s"' % env['buildtarget'] |