Move the systemversion back to globals, and create additional global entries based on configuration
This commit is contained in:
parent
aa41dad734
commit
e4c2318de8
@ -293,105 +293,3 @@
|
|||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
--
|
|
||||||
-- VS 2015 adds the <WindowsTargetPlatformVersion> to allow developers
|
|
||||||
-- to target different versions of the Windows SDK.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.windowsTargetPlatformVersionMissing_on2013Default()
|
|
||||||
p.action.set("vs2013")
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
function suite.windowsTargetPlatformVersionMissing_on2013()
|
|
||||||
p.action.set("vs2013")
|
|
||||||
systemversion "10.0.10240.0"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
<PlatformToolset>v120</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
function suite.windowsTargetPlatformVersionMissing_on2015Default()
|
|
||||||
p.action.set("vs2015")
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
function suite.windowsTargetPlatformVersion_on2015()
|
|
||||||
p.action.set("vs2015")
|
|
||||||
systemversion "10.0.10240.0"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Check that the "latest" systemversion works.
|
|
||||||
-- note: we override the os.getWindowsRegistry method for reliable tests.
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.windowsTargetPlatformVersionLatest_on2017()
|
|
||||||
p.action.set("vs2017")
|
|
||||||
systemversion "latest"
|
|
||||||
local oldRegistry = os["getWindowsRegistry"]
|
|
||||||
os["getWindowsRegistry"] = function (key) return "10.0.11111" end
|
|
||||||
prepare()
|
|
||||||
os["getWindowsRegistry"] = oldRegistry
|
|
||||||
test.capture [[
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
<WindowsTargetPlatformVersion>10.0.11111.0</WindowsTargetPlatformVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Check that the "latest" systemversion will not add <WindowsTargetPlatformVersion>
|
|
||||||
-- when the action is less than 2017
|
|
||||||
--
|
|
||||||
|
|
||||||
function suite.windowsTargetPlatformVersionLatest_on2015()
|
|
||||||
p.action.set("vs2015")
|
|
||||||
systemversion "latest"
|
|
||||||
prepare()
|
|
||||||
test.capture [[
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
]]
|
|
||||||
end
|
|
@ -192,3 +192,125 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- VS 2015 adds the <WindowsTargetPlatformVersion> to allow developers
|
||||||
|
-- to target different versions of the Windows SDK.
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.windowsTargetPlatformVersionMissing_on2013Default()
|
||||||
|
p.action.set("vs2013")
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||||
|
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>MyProject</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.windowsTargetPlatformVersionMissing_on2013()
|
||||||
|
p.action.set("vs2013")
|
||||||
|
systemversion "10.0.10240.0"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||||
|
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>MyProject</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.windowsTargetPlatformVersionMissing_on2015Default()
|
||||||
|
p.action.set("vs2015")
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||||
|
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>MyProject</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.windowsTargetPlatformVersion_on2015()
|
||||||
|
p.action.set("vs2015")
|
||||||
|
systemversion "10.0.10240.0"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||||
|
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>MyProject</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Check that the "latest" systemversion works.
|
||||||
|
-- note: we override the os.getWindowsRegistry method for reliable tests.
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.windowsTargetPlatformVersionLatest_on2017()
|
||||||
|
p.action.set("vs2017")
|
||||||
|
systemversion "latest"
|
||||||
|
local oldRegistry = os["getWindowsRegistry"]
|
||||||
|
os["getWindowsRegistry"] = function (key) return "10.0.11111" end
|
||||||
|
prepare()
|
||||||
|
os["getWindowsRegistry"] = oldRegistry
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||||
|
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>MyProject</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.11111.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Check that the "latest" systemversion will not add <WindowsTargetPlatformVersion>
|
||||||
|
-- when the action is less than 2017
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.windowsTargetPlatformVersionLatest_on2015()
|
||||||
|
p.action.set("vs2015")
|
||||||
|
systemversion "latest"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||||
|
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>MyProject</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.windowsTargetPlatformVersionConditional_on2015Default()
|
||||||
|
p.action.set("vs2015")
|
||||||
|
filter "Debug"
|
||||||
|
systemversion "10.0.10240.0"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||||
|
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>MyProject</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Globals">
|
||||||
|
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
@ -126,14 +126,31 @@
|
|||||||
m.ignoreWarnDuplicateFilename,
|
m.ignoreWarnDuplicateFilename,
|
||||||
m.keyword,
|
m.keyword,
|
||||||
m.projectName,
|
m.projectName,
|
||||||
m.preferredToolArchitecture
|
m.preferredToolArchitecture,
|
||||||
|
m.targetPlatformVersionGlobal,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
m.elements.globalsCondition = function(prj, cfg)
|
||||||
|
return {
|
||||||
|
m.targetPlatformVersionCondition,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function m.globals(prj)
|
function m.globals(prj)
|
||||||
|
|
||||||
|
-- Write out the project-level globals
|
||||||
m.propertyGroup(nil, "Globals")
|
m.propertyGroup(nil, "Globals")
|
||||||
p.callArray(m.elements.globals, prj)
|
p.callArray(m.elements.globals, prj)
|
||||||
p.pop('</PropertyGroup>')
|
p.pop('</PropertyGroup>')
|
||||||
|
|
||||||
|
-- Write out the configurable globals
|
||||||
|
for cfg in project.eachconfig(prj) do
|
||||||
|
m.propertyGroup(cfg, "Globals")
|
||||||
|
p.callArray(m.elements.globalsCondition, prj, cfg)
|
||||||
|
p.pop('</PropertyGroup>')
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -160,7 +177,6 @@
|
|||||||
m.wholeProgramOptimization,
|
m.wholeProgramOptimization,
|
||||||
m.nmakeOutDirs,
|
m.nmakeOutDirs,
|
||||||
m.windowsSDKDesktopARMSupport,
|
m.windowsSDKDesktopARMSupport,
|
||||||
m.targetPlatformVersion,
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2453,18 +2469,38 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function m.targetPlatformVersion(prj)
|
function m.targetPlatformVersion(cfgOrPrj)
|
||||||
|
|
||||||
if _ACTION >= "vs2015" then
|
if _ACTION >= "vs2015" then
|
||||||
local min = project.systemversion(prj)
|
local min = project.systemversion(cfgOrPrj)
|
||||||
-- handle special "latest" version
|
-- handle special "latest" version
|
||||||
if min == "latest" then
|
if min == "latest" then
|
||||||
-- vs2015 and lower can't build against SDK 10
|
-- vs2015 and lower can't build against SDK 10
|
||||||
min = iif(_ACTION >= "vs2017", m.latestSDK10Version(), nil)
|
min = iif(_ACTION >= "vs2017", m.latestSDK10Version(), nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return min
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function m.targetPlatformVersionGlobal(prj)
|
||||||
|
local min = m.targetPlatformVersion(prj)
|
||||||
if min ~= nil then
|
if min ~= nil then
|
||||||
m.element("WindowsTargetPlatformVersion", nil, min)
|
m.element("WindowsTargetPlatformVersion", nil, min)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function m.targetPlatformVersionCondition(prj, cfg)
|
||||||
|
|
||||||
|
local cfgPlatformVersion = m.targetPlatformVersion(cfg)
|
||||||
|
local prjPlatformVersion = m.targetPlatformVersion(prj)
|
||||||
|
|
||||||
|
if cfgPlatformVersion ~= nil and cfgPlatformVersion ~= prjPlatformVersion then
|
||||||
|
m.element("WindowsTargetPlatformVersion", nil, cfgPlatformVersion)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user