Set IncludeSearchPath and PreprocessorDefinitions in the generation
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 22 Feb 2009 08:17:49 +0000 (08:17 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 22 Feb 2009 08:17:49 +0000 (08:17 +0000)
project files for Visual Studio 8.0.  (Allan Erskine)

git-svn-id: http://scons.tigris.org/svn/scons/trunk@4036 fdb21ef1-2011-0410-befe-b5e4ea1792b1

QMTest/TestSConsMSVS.py
src/CHANGES.txt
src/engine/SCons/Tool/msvs.py
test/Fortran/link-with-cxx.py
test/MSVS/vs-8.0-clean.py
test/Program/no-source.py [new file with mode: 0644]

index 8a85b3fb49312faa0c6022474a50879aa06c2645..f26510ba66a15165a3af15a22a1342b994a79c6a 100644 (file)
@@ -478,8 +478,8 @@ expected_vcprojfile_8_0 = """\
 \t\t\t\tReBuildCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C &quot;<WORKPATH>&quot; -f SConstruct &quot;Test.exe&quot;"
 \t\t\t\tCleanCommandLine="echo Starting SCons &amp;&amp; &quot;<PYTHON>&quot; -c &quot;<SCONS_SCRIPT_MAIN_XML>&quot; -C &quot;<WORKPATH>&quot; -f SConstruct -c &quot;Test.exe&quot;"
 \t\t\t\tOutput="Test.exe"
-\t\t\t\tPreprocessorDefinitions=""
-\t\t\t\tIncludeSearchPath=""
+\t\t\t\tPreprocessorDefinitions="DEF1;DEF2"
+\t\t\t\tIncludeSearchPath="inc1;inc2"
 \t\t\t\tForcedIncludes=""
 \t\t\t\tAssemblySearchPath=""
 \t\t\t\tForcedUsingAssemblies=""
@@ -538,7 +538,9 @@ expected_vcprojfile_8_0 = """\
 """
 
 SConscript_contents_8_0 = """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='8.0')
+env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='8.0',
+                CPPDEFINES=['DEF1', 'DEF2'],
+                CPPPATH=['inc1', 'inc2'])
 
 testsrc = ['test1.cpp', 'test2.cpp']
 testincs = ['sdk.h']
index cb7fe8c60540763adbadb0c2aea45ffca84558ec..de5cce8c37825da53c2ae8941402a9daab7ecbbc 100644 (file)
@@ -27,6 +27,11 @@ RELEASE X.X.X - XXX
 
     - Fix generation of Visual Studio 8 project files on x64 platforms.
 
+  From Allan Erskine:
+
+    - Set IncludeSearchPath and PreprocessorDefinitions in generated
+      Visual Studio 8 project files, to help IntelliSense work.
+
   From Steven Knight:
 
     - Fix the error message when use of a non-existent drive on Windows
index 4d40d8c53751ce1d4326ffc5e4d97f1ca1cd89ab..e0f31dd377e3497937f69f03f462793f50605352 100644 (file)
@@ -595,8 +595,8 @@ V8DSPConfiguration = """\
 \t\t\t\tReBuildCommandLine="%(rebuildcmd)s"
 \t\t\t\tCleanCommandLine="%(cleancmd)s"
 \t\t\t\tOutput="%(runfile)s"
-\t\t\t\tPreprocessorDefinitions=""
-\t\t\t\tIncludeSearchPath=""
+\t\t\t\tPreprocessorDefinitions="%(preprocdefs)s"
+\t\t\t\tIncludeSearchPath="%(includepath)s"
 \t\t\t\tForcedIncludes=""
 \t\t\t\tAssemblySearchPath=""
 \t\t\t\tForcedUsingAssemblies=""
@@ -686,6 +686,9 @@ class _GenerateV7DSP(_DSPGenerator):
             rebuildcmd  = xmlify(starting + self.env.subst('$MSVSREBUILDCOM', 1) + cmdargs)
             cleancmd    = xmlify(starting + self.env.subst('$MSVSCLEANCOM', 1) + cmdargs)
 
+            preprocdefs = xmlify(';'.join(self.env.get('CPPDEFINES', [])))
+            includepath = xmlify(';'.join(self.env.get('CPPPATH', [])))
+
             if not env_has_buildtarget:
                 del self.env['MSVSBUILDTARGET']
 
index a29558e5e6c557359821e0293c5ef6465c0be97b..8d05c5ca06ac7ae40020a0a71060aa612fa12414 100644 (file)
@@ -70,7 +70,8 @@ def copier(target, source, env):
     s = str(source[0])
     t = str(target[0])
     open(t, 'wb').write(open(s, 'rb').read())
-env = Environment(CXX = r'%(_python_)s test_linker.py',
+env = Environment(tools = ['gcc', 'gnulink', 'fortran'],
+                  CXX = r'%(_python_)s test_linker.py',
                   CXXCOM = Action(copier),
                   SMARTLINK = SCons.Tool.link.smart_link,
                   LINK = r'$SMARTLINK',
index d8a1d6f2757dc8dc7140eb7c29181ecf5108e332..f17c60511629a1f7824d3e85ef34e606ab705535 100644 (file)
@@ -44,7 +44,9 @@ expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_8_0
 
 
 test.write('SConstruct', """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='8.0')
+env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='8.0',
+                CPPDEFINES=['DEF1', 'DEF2'],
+                CPPPATH=['inc1', 'inc2'])
 
 testsrc = ['test1.cpp', 'test2.cpp']
 testincs = ['sdk.h']
diff --git a/test/Program/no-source.py b/test/Program/no-source.py
new file mode 100644 (file)
index 0000000..cf12403
--- /dev/null
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# 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.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+XXX Put a description of the test here.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment()
+env.Library('main', 'main.c')
+env.Library('one', 'one.c')
+env.Library('two', 'two.c')
+env.Program('prog', [], LIBS=['main', 'one', 'two'], LIBPATH=['.'])
+""")
+
+test.write('main.c', """\
+#include <stdio.h>
+#include <stdlib.h>
+extern void one(void);
+extern void two(void);
+int
+main(int argc, char *argv[])
+{
+    printf("main.c\\n");
+    one();
+    two();
+    exit (0);
+}
+""")
+
+test.write('one.c', """\
+#include <stdio.h>
+#include <stdlib.h>
+void
+one(void)
+{
+    printf("one.c\\n");
+}
+""")
+
+test.write('two.c', """\
+#include <stdio.h>
+#include <stdlib.h>
+void
+two(void)
+{
+    printf("two.c\\n");
+}
+""")
+
+test.run(arguments = '.')
+
+test.run(program=test.workpath('prog'), stdout="main.c\none.c\ntwo.c\n")
+
+test.pass_test()