Added systemversion API. Fixes #315

This commit is contained in:
Sam Surtees 2016-03-17 22:56:23 +10:00
parent 870d21f382
commit 5059099a5b
4 changed files with 87 additions and 0 deletions

View File

@ -966,6 +966,12 @@
},
}
api.register {
name = "systemversion",
scope = "project",
kind = "string",
}
api.register {
name = "targetdir",
scope = "config",

View File

@ -127,6 +127,7 @@
m.ignoreWarnDuplicateFilename,
m.keyword,
m.projectName,
m.targetPlatformVersion,
}
end
@ -1924,6 +1925,14 @@
end
function m.targetPlatformVersion(prj)
local min = project.systemversion(prj)
if min ~= nil and _ACTION >= "vs2015" then
m.element("WindowsTargetPlatformVersion", nil, min)
end
end
function m.treatLinkerWarningAsErrors(cfg)
if cfg.flags.FatalLinkWarnings then
local el = iif(cfg.kind == p.STATICLIB, "Lib", "Linker")

View File

@ -506,3 +506,14 @@
return pairing
end
--
-- Given a project, returns requested min and max system versions.
--
function project.systemversion(prj)
if prj.systemversion ~= nil then
local values = string.explode(prj.systemversion, ":", true)
return values[1], values[2]
end
end

View File

@ -191,3 +191,64 @@
</PropertyGroup>
]]
end
--
-- VS 2015 adds the <WindowsTargetPlatformVersion> to allow developers
-- to target different versions of the Windows SDK.
--
function suite.windowsTargetPlatformVersionMissing_on2013Default()
_ACTION = "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()
_ACTION = "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()
_ACTION = "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()
_ACTION = "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