summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorAdam Gross <grossag@vmware.com>2019-07-18 19:20:08 (GMT)
committerAdam Gross <grossag@vmware.com>2019-07-18 20:35:54 (GMT)
commitb3dcc756c51b86220685acf88d4f5dea49af307f (patch)
treea03eb62e354eb286ca57b753145ccef02a3133ab /testing
parenta50f82ba0673e6922504e74dad3bb259e9edc0d3 (diff)
downloadSCons-b3dcc756c51b86220685acf88d4f5dea49af307f.zip
SCons-b3dcc756c51b86220685acf88d4f5dea49af307f.tar.gz
SCons-b3dcc756c51b86220685acf88d4f5dea49af307f.tar.bz2
Fix msvs tests
Diffstat (limited to 'testing')
-rw-r--r--testing/framework/TestSConsMSVS.py645
1 files changed, 135 insertions, 510 deletions
diff --git a/testing/framework/TestSConsMSVS.py b/testing/framework/TestSConsMSVS.py
index 348d7ed..9e6e069 100644
--- a/testing/framework/TestSConsMSVS.py
+++ b/testing/framework/TestSConsMSVS.py
@@ -23,6 +23,7 @@ import platform
import traceback
from xml.etree import ElementTree
+import SCons.Errors
from TestSCons import *
from TestSCons import __all__
@@ -435,31 +436,10 @@ env.MSVSProject(target = 'Test.vcproj',
"""
-
-expected_slnfile_8_0 = """\
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test.vcproj", "<PROJECT_GUID>"
-EndProject
-Global
-<SCC_SLN_INFO>
-\tGlobalSection(SolutionConfigurationPlatforms) = preSolution
-\t\tRelease|Win32 = Release|Win32
-\tEndGlobalSection
-\tGlobalSection(ProjectConfigurationPlatforms) = postSolution
-\t\t<PROJECT_GUID>.Release|Win32.ActiveCfg = Release|Win32
-\t\t<PROJECT_GUID>.Release|Win32.Build.0 = Release|Win32
-\tEndGlobalSection
-\tGlobalSection(SolutionProperties) = preSolution
-\t\tHideSolutionNode = FALSE
-\tEndGlobalSection
-EndGlobal
-"""
-
-expected_slnfile_9_0 = """\
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test.vcproj", "<PROJECT_GUID>"
+expected_slnfile_fmt = """\
+Microsoft Visual Studio Solution File, Format Version %(FORMAT_VERSION)s
+# Visual Studio %(VS_NUMBER)s
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "%(PROJECT_NAME)s", "%(PROJECT_FILE)s", "<PROJECT_GUID>"
EndProject
Global
<SCC_SLN_INFO>
@@ -476,91 +456,11 @@ Global
EndGlobal
"""
-expected_slnfile_10_0 = """\
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test.vcxproj", "Test.vcxproj", "{39A97E1F-1A52-8954-A0B1-A10A8487545E}"
-EndProject
-Global
-<SCC_SLN_INFO>
-\tGlobalSection(SolutionConfigurationPlatforms) = preSolution
-\t\tRelease|Win32 = Release|Win32
-\tEndGlobalSection
-\tGlobalSection(ProjectConfigurationPlatforms) = postSolution
-\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E}.Release|Win32.ActiveCfg = Release|Win32
-\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E}.Release|Win32.Build.0 = Release|Win32
-\tEndGlobalSection
-\tGlobalSection(SolutionProperties) = preSolution
-\t\tHideSolutionNode = FALSE
-\tEndGlobalSection
-EndGlobal
-"""
-
-expected_slnfile_11_0 = """\
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 11
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test.vcxproj", "Test.vcxproj", "{39A97E1F-1A52-8954-A0B1-A10A8487545E}"
-EndProject
-Global
-<SCC_SLN_INFO>
-\tGlobalSection(SolutionConfigurationPlatforms) = preSolution
-\t\tRelease|Win32 = Release|Win32
-\tEndGlobalSection
-\tGlobalSection(ProjectConfigurationPlatforms) = postSolution
-\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E}.Release|Win32.ActiveCfg = Release|Win32
-\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E}.Release|Win32.Build.0 = Release|Win32
-\tEndGlobalSection
-\tGlobalSection(SolutionProperties) = preSolution
-\t\tHideSolutionNode = FALSE
-\tEndGlobalSection
-EndGlobal
-"""
-
-expected_slnfile_14_0 = """\
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test.vcxproj", "Test.vcxproj", "{39A97E1F-1A52-8954-A0B1-A10A8487545E}"
-EndProject
-Global
-<SCC_SLN_INFO>
-\tGlobalSection(SolutionConfigurationPlatforms) = preSolution
-\t\tRelease|Win32 = Release|Win32
-\tEndGlobalSection
-\tGlobalSection(ProjectConfigurationPlatforms) = postSolution
-\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E}.Release|Win32.ActiveCfg = Release|Win32
-\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E}.Release|Win32.Build.0 = Release|Win32
-\tEndGlobalSection
-\tGlobalSection(SolutionProperties) = preSolution
-\t\tHideSolutionNode = FALSE
-\tEndGlobalSection
-EndGlobal
-"""
-
-expected_slnfile_14_1 = """\
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test.vcxproj", "Test.vcxproj", "{39A97E1F-1A52-8954-A0B1-A10A8487545E}"
-EndProject
-Global
-<SCC_SLN_INFO>
-\tGlobalSection(SolutionConfigurationPlatforms) = preSolution
-\t\tRelease|Win32 = Release|Win32
-\tEndGlobalSection
-\tGlobalSection(ProjectConfigurationPlatforms) = postSolution
-\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E}.Release|Win32.ActiveCfg = Release|Win32
-\t\t{39A97E1F-1A52-8954-A0B1-A10A8487545E}.Release|Win32.Build.0 = Release|Win32
-\tEndGlobalSection
-\tGlobalSection(SolutionProperties) = preSolution
-\t\tHideSolutionNode = FALSE
-\tEndGlobalSection
-EndGlobal
-"""
-
-expected_vcprojfile_8_0 = """\
+expected_vcprojfile_fmt = """\
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
\tProjectType="Visual C++"
-\tVersion="8.00"
+\tVersion="%(TOOLS_VERSION)s"
\tName="Test"
\tProjectGUID="<PROJECT_GUID>"
\tRootNamespace="Test"
@@ -586,7 +486,7 @@ expected_vcprojfile_8_0 = """\
\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="DEF1;DEF2;DEF3=1234"
-\t\t\t\tIncludeSearchPath="inc1;inc2"
+\t\t\t\tIncludeSearchPath="%(INCLUDE_DIRS)s"
\t\t\t\tForcedIncludes=""
\t\t\t\tAssemblySearchPath=""
\t\t\t\tForcedUsingAssemblies=""
@@ -601,7 +501,7 @@ expected_vcprojfile_8_0 = """\
\t\t\tName="Header Files"
\t\t\tFilter="h;hpp;hxx;hm;inl">
\t\t\t<File
-\t\t\t\tRelativePath="sdk.h">
+\t\t\t\tRelativePath="sdk_dir\\sdk.h">
\t\t\t</File>
\t\t</Filter>
\t\t<Filter
@@ -644,97 +544,9 @@ expected_vcprojfile_8_0 = """\
</VisualStudioProject>
"""
-expected_vcprojfile_9_0 = """\
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-\tProjectType="Visual C++"
-\tVersion="9.00"
-\tName="Test"
-\tProjectGUID="<PROJECT_GUID>"
-\tRootNamespace="Test"
-<SCC_VCPROJ_INFO>
-\tKeyword="MakeFileProj">
-\t<Platforms>
-\t\t<Platform
-\t\t\tName="Win32"/>
-\t</Platforms>
-\t<ToolFiles>
-\t</ToolFiles>
-\t<Configurations>
-\t\t<Configuration
-\t\t\tName="Release|Win32"
-\t\t\tConfigurationType="0"
-\t\t\tUseOfMFC="0"
-\t\t\tATLMinimizesCRunTimeLibraryUsage="false"
-\t\t\t>
-\t\t\t<Tool
-\t\t\t\tName="VCNMakeTool"
-\t\t\t\tBuildCommandLine="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\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="DEF1;DEF2;DEF3=1234"
-\t\t\t\tIncludeSearchPath="inc1;inc2"
-\t\t\t\tForcedIncludes=""
-\t\t\t\tAssemblySearchPath=""
-\t\t\t\tForcedUsingAssemblies=""
-\t\t\t\tCompileAsManaged=""
-\t\t\t/>
-\t\t</Configuration>
-\t</Configurations>
-\t<References>
-\t</References>
-\t<Files>
-\t\t<Filter
-\t\t\tName="Header Files"
-\t\t\tFilter="h;hpp;hxx;hm;inl">
-\t\t\t<File
-\t\t\t\tRelativePath="sdk.h">
-\t\t\t</File>
-\t\t</Filter>
-\t\t<Filter
-\t\t\tName="Local Headers"
-\t\t\tFilter="h;hpp;hxx;hm;inl">
-\t\t\t<File
-\t\t\t\tRelativePath="test.h">
-\t\t\t</File>
-\t\t</Filter>
-\t\t<Filter
-\t\t\tName="Other Files"
-\t\t\tFilter="">
-\t\t\t<File
-\t\t\t\tRelativePath="readme.txt">
-\t\t\t</File>
-\t\t</Filter>
-\t\t<Filter
-\t\t\tName="Resource Files"
-\t\t\tFilter="r;rc;ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe">
-\t\t\t<File
-\t\t\t\tRelativePath="test.rc">
-\t\t\t</File>
-\t\t</Filter>
-\t\t<Filter
-\t\t\tName="Source Files"
-\t\t\tFilter="cpp;c;cxx;l;y;def;odl;idl;hpj;bat">
-\t\t\t<File
-\t\t\t\tRelativePath="test1.cpp">
-\t\t\t</File>
-\t\t\t<File
-\t\t\t\tRelativePath="test2.cpp">
-\t\t\t</File>
-\t\t</Filter>
-\t\t<File
-\t\t\tRelativePath="<SCONSCRIPT>">
-\t\t</File>
-\t</Files>
-\t<Globals>
-\t</Globals>
-</VisualStudioProject>
-"""
-
-expected_vcprojfile_10_0 = """\
+expected_vcxprojfile_fmt = """\
<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="%(TOOLS_VERSION)s" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
\t<ItemGroup Label="ProjectConfigurations">
\t\t<ProjectConfiguration Include="Release|Win32">
\t\t\t<Configuration>Release</Configuration>
@@ -746,6 +558,7 @@ expected_vcprojfile_10_0 = """\
<SCC_VCPROJ_INFO>
\t\t<RootNamespace>Test</RootNamespace>
\t\t<Keyword>MakeFileProj</Keyword>
+\t\t<VCProjectUpgraderObjectName>NoUpgrade</VCProjectUpgraderObjectName>
\t</PropertyGroup>
\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
\t<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
@@ -767,7 +580,7 @@ expected_vcprojfile_10_0 = """\
\t\t<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">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;</NMakeCleanCommandLine>
\t\t<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Test.exe</NMakeOutput>
\t\t<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">DEF1;DEF2;DEF3=1234</NMakePreprocessorDefinitions>
-\t\t<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">inc1;inc2</NMakeIncludeSearchPath>
+\t\t<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(INCLUDE_DIRS)s</NMakeIncludeSearchPath>
\t\t<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
\t\t<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
\t\t<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
@@ -797,249 +610,8 @@ expected_vcprojfile_10_0 = """\
</Project>
"""
-expected_vcprojfile_11_0 = """\
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-\t<ItemGroup Label="ProjectConfigurations">
-\t\t<ProjectConfiguration Include="Release|Win32">
-\t\t\t<Configuration>Release</Configuration>
-\t\t\t<Platform>Win32</Platform>
-\t\t</ProjectConfiguration>
-\t</ItemGroup>
-\t<PropertyGroup Label="Globals">
-\t\t<ProjectGuid>{39A97E1F-1A52-8954-A0B1-A10A8487545E}</ProjectGuid>
-<SCC_VCPROJ_INFO>
-\t\t<RootNamespace>Test</RootNamespace>
-\t\t<Keyword>MakeFileProj</Keyword>
-\t</PropertyGroup>
-\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
-\t<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-\t\t<ConfigurationType>Makefile</ConfigurationType>
-\t\t<UseOfMfc>false</UseOfMfc>
-\t\t<PlatformToolset>v110</PlatformToolset>
-\t</PropertyGroup>
-\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />
-\t<ImportGroup Label="ExtensionSettings">
-\t</ImportGroup>
-\t<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-\t\t<Import Project="$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-\t</ImportGroup>
-\t<PropertyGroup Label="UserMacros" />
-\t<PropertyGroup>
-\t<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
-\t\t<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">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;</NMakeBuildCommandLine>
-\t\t<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">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;</NMakeReBuildCommandLine>
-\t\t<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">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;</NMakeCleanCommandLine>
-\t\t<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Test.exe</NMakeOutput>
-\t\t<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">DEF1;DEF2;DEF3=1234</NMakePreprocessorDefinitions>
-\t\t<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">inc1;inc2</NMakeIncludeSearchPath>
-\t\t<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
-\t\t<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
-\t\t<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
-\t</PropertyGroup>
-\t<ItemGroup>
-\t\t<ClInclude Include="sdk_dir\\sdk.h" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<ClInclude Include="test.h" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<None Include="readme.txt" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<None Include="test.rc" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<ClCompile Include="test1.cpp" />
-\t\t<ClCompile Include="test2.cpp" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<None Include="SConstruct" />
-\t</ItemGroup>
-\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />
-\t<ImportGroup Label="ExtensionTargets">
-\t</ImportGroup>
-</Project>
-"""
-
-expected_vcprojfile_14_0 = """\
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-\t<ItemGroup Label="ProjectConfigurations">
-\t\t<ProjectConfiguration Include="Release|Win32">
-\t\t\t<Configuration>Release</Configuration>
-\t\t\t<Platform>Win32</Platform>
-\t\t</ProjectConfiguration>
-\t</ItemGroup>
-\t<PropertyGroup Label="Globals">
-\t\t<ProjectGuid>{39A97E1F-1A52-8954-A0B1-A10A8487545E}</ProjectGuid>
-<SCC_VCPROJ_INFO>
-\t\t<RootNamespace>Test</RootNamespace>
-\t\t<Keyword>MakeFileProj</Keyword>
-\t</PropertyGroup>
-\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
-\t<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-\t\t<ConfigurationType>Makefile</ConfigurationType>
-\t\t<UseOfMfc>false</UseOfMfc>
-\t\t<PlatformToolset>v140</PlatformToolset>
-\t</PropertyGroup>
-\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />
-\t<ImportGroup Label="ExtensionSettings">
-\t</ImportGroup>
-\t<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-\t\t<Import Project="$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-\t</ImportGroup>
-\t<PropertyGroup Label="UserMacros" />
-\t<PropertyGroup>
-\t<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
-\t\t<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">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;</NMakeBuildCommandLine>
-\t\t<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">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;</NMakeReBuildCommandLine>
-\t\t<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">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;</NMakeCleanCommandLine>
-\t\t<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Test.exe</NMakeOutput>
-\t\t<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">DEF1;DEF2;DEF3=1234</NMakePreprocessorDefinitions>
-\t\t<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">inc1;inc2</NMakeIncludeSearchPath>
-\t\t<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
-\t\t<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
-\t\t<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
-\t</PropertyGroup>
-\t<ItemGroup>
-\t\t<ClInclude Include="sdk_dir\\sdk.h" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<ClInclude Include="test.h" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<None Include="readme.txt" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<None Include="test.rc" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<ClCompile Include="test1.cpp" />
-\t\t<ClCompile Include="test2.cpp" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<None Include="SConstruct" />
-\t</ItemGroup>
-\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />
-\t<ImportGroup Label="ExtensionTargets">
-\t</ImportGroup>
-</Project>
-"""
-
-expected_vcprojfile_14_1 = """\
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-\t<ItemGroup Label="ProjectConfigurations">
-\t\t<ProjectConfiguration Include="Release|Win32">
-\t\t\t<Configuration>Release</Configuration>
-\t\t\t<Platform>Win32</Platform>
-\t\t</ProjectConfiguration>
-\t</ItemGroup>
-\t<PropertyGroup Label="Globals">
-\t\t<ProjectGuid>{39A97E1F-1A52-8954-A0B1-A10A8487545E}</ProjectGuid>
-<SCC_VCPROJ_INFO>
-\t\t<RootNamespace>Test</RootNamespace>
-\t\t<Keyword>MakeFileProj</Keyword>
-\t</PropertyGroup>
-\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
-\t<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-\t\t<ConfigurationType>Makefile</ConfigurationType>
-\t\t<UseOfMfc>false</UseOfMfc>
-\t\t<PlatformToolset>v141</PlatformToolset>
-\t</PropertyGroup>
-\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />
-\t<ImportGroup Label="ExtensionSettings">
-\t</ImportGroup>
-\t<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-\t\t<Import Project="$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-\t</ImportGroup>
-\t<PropertyGroup Label="UserMacros" />
-\t<PropertyGroup>
-\t<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
-\t\t<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">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;</NMakeBuildCommandLine>
-\t\t<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">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;</NMakeReBuildCommandLine>
-\t\t<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">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;</NMakeCleanCommandLine>
-\t\t<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Test.exe</NMakeOutput>
-\t\t<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">DEF1;DEF2;DEF3=1234</NMakePreprocessorDefinitions>
-\t\t<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">inc1;inc2</NMakeIncludeSearchPath>
-\t\t<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
-\t\t<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
-\t\t<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
-\t</PropertyGroup>
-\t<ItemGroup>
-\t\t<ClInclude Include="sdk_dir\\sdk.h" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<ClInclude Include="test.h" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<None Include="readme.txt" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<None Include="test.rc" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<ClCompile Include="test1.cpp" />
-\t\t<ClCompile Include="test2.cpp" />
-\t</ItemGroup>
-\t<ItemGroup>
-\t\t<None Include="SConstruct" />
-\t</ItemGroup>
-\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />
-\t<ImportGroup Label="ExtensionTargets">
-\t</ImportGroup>
-</Project>
-"""
-
-SConscript_contents_8_0 = """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='8.0',
- CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')],
- CPPPATH=['inc1', 'inc2'],
- HOST_ARCH='%(HOST_ARCH)s')
-
-testsrc = ['test1.cpp', 'test2.cpp']
-testincs = ['sdk.h']
-testlocalincs = ['test.h']
-testresources = ['test.rc']
-testmisc = ['readme.txt']
-
-env.MSVSProject(target = 'Test.vcproj',
- slnguid = '{SLNGUID}',
- srcs = testsrc,
- incs = testincs,
- localincs = testlocalincs,
- resources = testresources,
- misc = testmisc,
- buildtarget = 'Test.exe',
- variant = 'Release')
-"""
-
-SConscript_contents_9_0 = """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='9.0',
- CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')],
- CPPPATH=['inc1', 'inc2'],
- HOST_ARCH='%(HOST_ARCH)s')
-
-testsrc = ['test1.cpp', 'test2.cpp']
-testincs = ['sdk.h']
-testlocalincs = ['test.h']
-testresources = ['test.rc']
-testmisc = ['readme.txt']
-
-env.MSVSProject(target = 'Test.vcproj',
- slnguid = '{SLNGUID}',
- srcs = testsrc,
- incs = testincs,
- localincs = testlocalincs,
- resources = testresources,
- misc = testmisc,
- buildtarget = 'Test.exe',
- variant = 'Release')
-"""
-
-SConscript_contents_10_0 = """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='10.0',
+SConscript_contents_fmt = """\
+env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='%(MSVS_VERSION)s',
CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')],
CPPPATH=['inc1', 'inc2'],
HOST_ARCH='%(HOST_ARCH)s')
@@ -1050,7 +622,7 @@ testlocalincs = ['test.h']
testresources = ['test.rc']
testmisc = ['readme.txt']
-env.MSVSProject(target = 'Test.vcxproj',
+env.MSVSProject(target = '%(PROJECT_FILE)s',
slnguid = '{SLNGUID}',
srcs = testsrc,
incs = testincs,
@@ -1061,74 +633,14 @@ env.MSVSProject(target = 'Test.vcxproj',
variant = 'Release')
"""
-SConscript_contents_11_0 = """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='11.0',
- CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')],
- CPPPATH=['inc1', 'inc2'],
- HOST_ARCH='%(HOST_ARCH)s')
-testsrc = ['test1.cpp', 'test2.cpp']
-testincs = [r'sdk_dir\\sdk.h']
-testlocalincs = ['test.h']
-testresources = ['test.rc']
-testmisc = ['readme.txt']
+def get_tested_proj_file_vc_versions():
+ """
+ Returns all MSVC versions that we want to test project file creation for.
+ """
+ #return ['8.0', '9.0', '10.0', '11.0', '12.0', '14.0', '14.1', '14.2']
+ return ['9.0']
-env.MSVSProject(target = 'Test.vcxproj',
- slnguid = '{SLNGUID}',
- srcs = testsrc,
- incs = testincs,
- localincs = testlocalincs,
- resources = testresources,
- misc = testmisc,
- buildtarget = 'Test.exe',
- variant = 'Release')
-"""
-
-SConscript_contents_14_0 = """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='14.0',
- CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')],
- CPPPATH=['inc1', 'inc2'],
- HOST_ARCH='%(HOST_ARCH)s')
-
-testsrc = ['test1.cpp', 'test2.cpp']
-testincs = [r'sdk_dir\\sdk.h']
-testlocalincs = ['test.h']
-testresources = ['test.rc']
-testmisc = ['readme.txt']
-
-env.MSVSProject(target = 'Test.vcxproj',
- slnguid = '{SLNGUID}',
- srcs = testsrc,
- incs = testincs,
- localincs = testlocalincs,
- resources = testresources,
- misc = testmisc,
- buildtarget = 'Test.exe',
- variant = 'Release')
-"""
-
-SConscript_contents_14_1 = """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='14.1',
- CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')],
- CPPPATH=['inc1', 'inc2'],
- HOST_ARCH='%(HOST_ARCH)s')
-
-testsrc = ['test1.cpp', 'test2.cpp']
-testincs = [r'sdk_dir\\sdk.h']
-testlocalincs = ['test.h']
-testresources = ['test.rc']
-testmisc = ['readme.txt']
-
-env.MSVSProject(target = 'Test.vcxproj',
- slnguid = '{SLNGUID}',
- srcs = testsrc,
- incs = testincs,
- localincs = testlocalincs,
- resources = testresources,
- misc = testmisc,
- buildtarget = 'Test.exe',
- variant = 'Release')
-"""
class TestSConsMSVS(TestSCons):
"""Subclass for testing MSVS-specific portions of SCons."""
@@ -1276,6 +788,119 @@ print("self._msvs_versions =%%s"%%str(SCons.Tool.MSCommon.query_versions()))
print("--------------------------------------------------------------")
print("--------------------------------------------------------------")
self.fail_test()
+
+ def parse_vc_version(self, vc_version):
+ """
+ Parses the string vc_version to determine the major and minor version
+ included.
+ """
+ components = vc_version.split('.')
+ major = int(components[0])
+ minor = 0 if len(components) < 2 else int(components[1])
+ return major, minor
+
+ def _get_solution_file_format_version(self, vc_version):
+ """
+ Returns the Visual Studio format version expected in the .sln file.
+ """
+ major, _ = self.parse_vc_version(vc_version)
+ if major == 8:
+ return '9.00'
+ elif major == 9:
+ return '10.00'
+ elif major == 10:
+ return '11.00'
+ elif major > 10:
+ return '12.00'
+ else:
+ raise SCons.Errors.UserError('Received unexpected VC version %s' % vc_version)
+
+ def _get_solution_file_vs_number(self, vc_version):
+ """
+ Returns the Visual Studio number expected in the .sln file.
+ """
+ major, minor = self.parse_vc_version(vc_version)
+ if major == 8:
+ return '2005'
+ elif major == 9:
+ return '2008'
+ if major == 10:
+ return '2010'
+ elif major == 11:
+ return '11'
+ elif major == 12:
+ return '14'
+ elif major == 14 and (minor == 0 or minor == 1):
+ # Visual Studio 2015 and 2017 both use 15 in this entry.
+ return '15'
+ elif major == 14 and minor == 2:
+ return '16'
+ else:
+ raise SCons.Errors.UserError('Received unexpected VC version %s' % vc_version)
+
+ def _get_vcxproj_file_tools_version(self, vc_version):
+ """
+ Returns the version entry expected in the project file.
+ For .vcxproj files, this goes is ToolsVersion.
+ For .vcproj files, this goes in Version.
+ """
+ major, minor = self.parse_vc_version(vc_version)
+ if major == 8:
+ # Version="8.00"
+ return '8.00'
+ elif major == 9:
+ # Version="9.00"
+ return '9.00'
+ elif major < 14:
+ # ToolsVersion='4.0'
+ return '4.0'
+ elif major == 14 and minor == 0:
+ # ToolsVersion='14.0'
+ return '14.0'
+ elif major == 14 and minor == 1:
+ # ToolsVersion='15.0'
+ return '15.0'
+ elif vc_version == '14.2':
+ # ToolsVersion='16'
+ return '16.0'
+ else:
+ raise SCons.Errors.UserError('Received unexpected VC version %s' % vc_version)
+
+ def _get_vcxproj_file_cpp_path(self, dirs):
+ """Returns the include paths expected in the .vcxproj file"""
+ return ';'.join([self.workpath(dir) for dir in dirs])
+
+ def get_expected_sln_file_contents(self, vc_version, project_file):
+ """
+ Returns the expected .sln file contents.
+ Currently this function only supports the newer VC versions that use
+ the .vcxproj file format.
+ """
+ return expected_slnfile_fmt % {
+ 'FORMAT_VERSION': self._get_solution_file_format_version(vc_version),
+ 'VS_NUMBER': self._get_solution_file_vs_number(vc_version),
+ 'PROJECT_NAME': project_file.split('.')[0],
+ 'PROJECT_FILE': project_file,
+ }
+
+ def get_expected_proj_file_contents(self, vc_version, dirs, project_file):
+ """Returns the expected .vcxproj file contents"""
+ if project_file.endswith('.vcxproj'):
+ fmt = expected_vcxprojfile_fmt
+ else:
+ fmt = expected_vcprojfile_fmt
+ return fmt % {
+ 'TOOLS_VERSION': self._get_vcxproj_file_tools_version(vc_version),
+ 'INCLUDE_DIRS': self._get_vcxproj_file_cpp_path(dirs),
+ }
+
+ def get_expected_sconscript_file_contents(self, vc_version, project_file):
+ return SConscript_contents_fmt % {
+ 'HOST_ARCH': self.get_vs_host_arch(),
+ 'MSVS_VERSION': vc_version,
+ 'PROJECT_FILE': project_file,
+ }
+
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil