summaryrefslogtreecommitdiffstats
path: root/test/MSVC/pch_gen
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2021-08-30 17:39:14 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2021-09-18 23:45:08 (GMT)
commit76f770a7b4bbaaea25ef2670958b9136eea7049a (patch)
treed449250b3a69f76b81fc460df0eeeba19ba7fd2a /test/MSVC/pch_gen
parentaaeae85edd462782267da4bd07b27af1d4e785b7 (diff)
downloadSCons-76f770a7b4bbaaea25ef2670958b9136eea7049a.zip
SCons-76f770a7b4bbaaea25ef2670958b9136eea7049a.tar.gz
SCons-76f770a7b4bbaaea25ef2670958b9136eea7049a.tar.bz2
add logic to ensure PCH is subst() evaluated when it should be
Diffstat (limited to 'test/MSVC/pch_gen')
-rw-r--r--test/MSVC/pch_gen/fixture/SConstruct19
-rw-r--r--test/MSVC/pch_gen/fixture/sconstest.skip0
-rw-r--r--test/MSVC/pch_gen/pch_gen.py50
3 files changed, 69 insertions, 0 deletions
diff --git a/test/MSVC/pch_gen/fixture/SConstruct b/test/MSVC/pch_gen/fixture/SConstruct
new file mode 100644
index 0000000..5fea0a8
--- /dev/null
+++ b/test/MSVC/pch_gen/fixture/SConstruct
@@ -0,0 +1,19 @@
+import os
+DefaultEnvironment(tools=[])
+# TODO: this is order-dependent (putting 'mssdk' second or third breaks),
+# and ideally we shouldn't need to specify the tools= list anyway.
+env = Environment(tools=['mssdk', 'msvc', 'mslink'])
+env.Append(CPPPATH=os.environ.get('INCLUDE', ''),
+ LIBPATH=os.environ.get('LIB', ''),
+ CCFLAGS='/DPCHDEF')
+env['PDB'] = File('test.pdb')
+env['PCHSTOP'] = 'StdAfx.h'
+
+def pch_gen(env, target, source, for_signature):
+ return 'StdAfx.pch'
+env['PCH'] = pch_gen
+env.PCH('StdAfx.cpp')[0]
+env.Program('test', ['test.cpp', env.RES('test.rc')], LIBS=['user32'])
+
+env.Object('fast', 'foo.cpp')
+env.Object('slow', 'foo.cpp', PCH=0) \ No newline at end of file
diff --git a/test/MSVC/pch_gen/fixture/sconstest.skip b/test/MSVC/pch_gen/fixture/sconstest.skip
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/MSVC/pch_gen/fixture/sconstest.skip
diff --git a/test/MSVC/pch_gen/pch_gen.py b/test/MSVC/pch_gen/pch_gen.py
new file mode 100644
index 0000000..9fea9e2
--- /dev/null
+++ b/test/MSVC/pch_gen/pch_gen.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+#
+# MIT License
+#
+# Copyright The SCons Foundation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+"""
+Template for end-to-end test file.
+Replace this with a description of the test.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.skip_if_not_msvc()
+
+test.dir_fixture('../msvc_fixture')
+
+test.file_fixture('fixture/SConstruct',
+ 'SConstruct')
+
+test.run(arguments='.')
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: