Fix Visual Studio 2013 tool and framework version numbers

This commit is contained in:
Jason Perkins 2014-12-29 15:18:07 -05:00
parent c922f3a199
commit b9d6ce892b
3 changed files with 46 additions and 8 deletions

View File

@ -60,12 +60,15 @@
-- --
function m.project(target) function m.project(target)
local defaultTargets = "" local default = ""
if target then if target then
defaultTargets = string.format(' DefaultTargets="%s"', target) default = string.format(' DefaultTargets="%s"', target)
end end
p.push('<Project%s ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">', defaultTargets) local action = premake.action.current()
local tools = string.format(' ToolsVersion="%s"', action.vstudio.toolsVersion)
p.push('<Project%s%s xmlns="http://schemas.microsoft.com/developer/msbuild/2003">', default, tools)
end end
@ -108,7 +111,10 @@
-- --
function m.targetFramework(prj) function m.targetFramework(prj)
local framework = prj.framework or "4.0" local action = premake.action.current()
local tools = string.format(' ToolsVersion="%s"', action.vstudio.toolsVersion)
local framework = prj.framework or action.vstudio.targetFramework or "4.0"
_p(2,'<TargetFrameworkVersion>v%s</TargetFrameworkVersion>', framework) _p(2,'<TargetFrameworkVersion>v%s</TargetFrameworkVersion>', framework)
end end

View File

@ -63,7 +63,7 @@
-- Ensure custom target framework version correct for Managed C++ projects. -- Ensure custom target framework version correct for Managed C++ projects.
-- --
function suite.frameworkVersionIsCorrect_onManagedC() function suite.frameworkVersionIsCorrect_onSpecificVersion()
clr "On" clr "On"
framework "4.5" framework "4.5"
prepare() prepare()
@ -77,6 +77,20 @@
]] ]]
end end
function suite.frameworkVersionIsCorrect_on2013()
_ACTION = "vs2013"
clr "On"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>MyProject</RootNamespace>
</PropertyGroup>
]]
end
-- --
-- Omit Keyword and RootNamespace for non-Windows projects. -- Omit Keyword and RootNamespace for non-Windows projects.

View File

@ -4,8 +4,7 @@
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project -- Copyright (c) 2011-2012 Jason Perkins and the Premake project
-- --
T.vstudio_vc2010_header = { } local suite = test.declare("vstudio_vc2010_header")
local suite = T.vstudio_vc2010_header
local vc2010 = premake.vstudio.vc2010 local vc2010 = premake.vstudio.vc2010
@ -14,18 +13,37 @@
-- generated Project element. -- generated Project element.
-- --
function suite.project_onDefaultTarget() function suite.project_on2010()
_ACTION = "vs2010"
vc2010.project("Build") vc2010.project("Build")
test.capture [[ test.capture [[
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
]] ]]
end end
function suite.project_on2011()
_ACTION = "vs2012"
vc2010.project("Build")
test.capture [[
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
]]
end
function suite.project_on2013()
_ACTION = "vs2013"
vc2010.project("Build")
test.capture [[
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
]]
end
-- --
-- If no build target is specified, the entire attribute should be omitted. -- If no build target is specified, the entire attribute should be omitted.
-- --
function suite.project_onNoDefaultTarget() function suite.project_onNoDefaultTarget()
_ACTION = "vs2010"
vc2010.project() vc2010.project()
test.capture [[ test.capture [[
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">