summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Oberbrunner <garyo@oberbrunner.com>2011-04-24 21:32:20 +0000
committerGary Oberbrunner <garyo@oberbrunner.com>2011-04-24 21:32:20 +0000
commit0dbdd137355656705e184722b01d920f06ec10b6 (patch)
tree71aea99f0013fe3365d718df212c67fd474dfc34
parent7dd60e2f36a88d71ac7a58152b60f70f7b76dee9 (diff)
downloadscons-0dbdd137355656705e184722b01d920f06ec10b6.tar.gz
Fix issue 2627: MSVC_BATCH=False should turn off batch, not turn it on.
-rw-r--r--src/CHANGES.txt1
-rw-r--r--src/RELEASE.txt1
-rw-r--r--src/engine/SCons/Tool/msvc.py18
-rw-r--r--test/MSVC/batch.py13
4 files changed, 29 insertions, 4 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 6c930e6d..7066eec9 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -9,6 +9,7 @@ RELEASE 2.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
From Grzegorz BizoƄ:
- Fix long compile lines in batch mode by using TEMPFILE
+ - Fix MSVC_BATCH=False (was treating it as true)
From Justin Gullingsrud:
- support -std=c++0x and related CXXFLAGS in pkgconfig (ParseFlags)
diff --git a/src/RELEASE.txt b/src/RELEASE.txt
index 6fde09ca..67f27a4e 100644
--- a/src/RELEASE.txt
+++ b/src/RELEASE.txt
@@ -56,6 +56,7 @@
FIXES
+ - 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
LINKFLAGS doesn't kill RPATH
diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py
index 36b65ca6..d42c2570 100644
--- a/src/engine/SCons/Tool/msvc.py
+++ b/src/engine/SCons/Tool/msvc.py
@@ -140,8 +140,13 @@ def msvc_batch_key(action, env, target, source):
Returning None specifies that the specified target+source should not
be batched with other compilations.
"""
- b = env.subst('$MSVC_BATCH')
- if b in (None, '', '0'):
+
+ # Fixing MSVC_BATCH mode. Previous if did not work when MSVC_BATCH
+ # was set to False. This new version should work better.
+ # Note we need to do the env.subst so $MSVC_BATCH can be a reference to
+ # another construction variable, which is why we test for False and 0
+ # as strings.
+ if not 'MSVC_BATCH' in env or env.subst('$MSVC_BATCH') in ('0', 'False', '', None):
# We're not using batching; return no key.
return None
t = target[0]
@@ -161,8 +166,13 @@ def msvc_output_flag(target, source, env, for_signature):
we return an /Fo string that just specifies the first target's
directory (where the Visual C/C++ compiler will put the .obj files).
"""
- b = env.subst('$MSVC_BATCH')
- if b in (None, '', '0') or len(source) == 1:
+
+ # Fixing MSVC_BATCH mode. Previous if did not work when MSVC_BATCH
+ # was set to False. This new version should work better. Removed
+ # len(source)==1 as batch mode can compile only one file
+ # (and it also fixed problem with compiling only one changed file
+ # with batch mode enabled)
+ if not 'MSVC_BATCH' in env or env.subst('$MSVC_BATCH') in ('0', 'False', '', None):
return '/Fo$TARGET'
else:
# The Visual C/C++ compiler requires a \ at the end of the /Fo
diff --git a/test/MSVC/batch.py b/test/MSVC/batch.py
index f089b605..fbb32180 100644
--- a/test/MSVC/batch.py
+++ b/test/MSVC/batch.py
@@ -132,6 +132,19 @@ test.must_match('fake_cl.log', """\
/Foprog.obj prog.c
""")
+test.run(arguments = '-c .')
+test.unlink('fake_cl.log')
+
+
+test.run(arguments = '. MSVC_BATCH=False')
+
+test.must_match('prog.exe', "prog.c\nf1.c 2\nf2.c\n")
+test.must_match('fake_cl.log', """\
+/Fof1.obj f1.c
+/Fof2.obj f2.c
+/Foprog.obj prog.c
+""")
+
test.write('f1.c', "f1.c 3\n")