5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 Test that we can generate Visual Studio 8.0 project (.vcproj) and
28 solution (.sln) files that look correct.
35 test
= TestSConsMSVS
.TestSConsMSVS()
37 if sys
.platform
!= 'win32':
38 msg
= "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys
.platform
41 sconscript_dict
= {'PROJECT_GUID': TestSConsMSVS
.PROJECT_GUID
}
43 expected_vcprojfile
= """\
44 <?xml version="1.0" encoding="Windows-1252"?>
46 \tProjectType="Visual C++"
49 \tProjectGUID="<PROJECT_GUID>"
50 \tRootNamespace="Test"
51 \tKeyword="MakeFileProj">
60 \t\t\tName="Release|Win32"
61 \t\t\tConfigurationType="0"
63 \t\t\tATLMinimizesCRunTimeLibraryUsage="false"
66 \t\t\t\tName="VCNMakeTool"
67 \t\t\t\tBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
68 \t\t\t\tReBuildCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct "Test.exe""
69 \t\t\t\tCleanCommandLine="echo Starting SCons && "<PYTHON>" -c "<SCONS_SCRIPT_MAIN_XML>" -C "<WORKPATH>" -f SConstruct -c "Test.exe""
70 \t\t\t\tOutput="runfile.exe"
71 \t\t\t\tPreprocessorDefinitions=""
72 \t\t\t\tIncludeSearchPath=""
73 \t\t\t\tForcedIncludes=""
74 \t\t\t\tAssemblySearchPath=""
75 \t\t\t\tForcedUsingAssemblies=""
76 \t\t\t\tCompileAsManaged=""
84 \t\t\t\tRelativePath="test.cpp">
87 \t\t\tRelativePath="<SCONSCRIPT>">
92 </VisualStudioProject>
95 SConscript_contents
= """\
96 env=Environment(tools=['msvs'], MSVS_VERSION = '8.0')
98 env.MSVSProject(target = 'Test.vcproj',
99 MSVS_PROJECT_GUID = '%(PROJECT_GUID)s',
100 slnguid = '{SLNGUID}',
102 buildtarget = 'Test.exe',
103 runfile = 'runfile.exe',
105 auto_build_solution = 0)
110 test
.write(['work1', 'SConstruct'], SConscript_contents
% sconscript_dict
)
112 test
.run(chdir
='work1', arguments
="Test.vcproj")
114 test
.must_exist(test
.workpath('work1', 'Test.vcproj'))
115 vcproj
= test
.read(['work1', 'Test.vcproj'], 'r')
116 expect
= test
.msvs_substitute(expected_vcprojfile
, '8.0', 'work1', 'SConstruct')
117 # don't compare the pickled data
118 assert vcproj
[:len(expect
)] == expect
, test
.diff_substr(expect
, vcproj
)
124 # indent-tabs-mode:nil
126 # vim: set expandtab tabstop=4 shiftwidth=4: