From b9d6ce892bc2270637f843a16dd8c6d6989ff3b0 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Mon, 29 Dec 2014 15:18:07 -0500 Subject: [PATCH] Fix Visual Studio 2013 tool and framework version numbers --- src/actions/vstudio/vs2010_vcxproj.lua | 14 +++++++---- tests/actions/vstudio/vc2010/test_globals.lua | 16 ++++++++++++- tests/actions/vstudio/vc2010/test_header.lua | 24 ++++++++++++++++--- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index 5f03b2b1..46b2e6a5 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -60,12 +60,15 @@ -- function m.project(target) - local defaultTargets = "" + local default = "" if target then - defaultTargets = string.format(' DefaultTargets="%s"', target) + default = string.format(' DefaultTargets="%s"', target) end - p.push('', defaultTargets) + local action = premake.action.current() + local tools = string.format(' ToolsVersion="%s"', action.vstudio.toolsVersion) + + p.push('', default, tools) end @@ -108,7 +111,10 @@ -- 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,'v%s', framework) end diff --git a/tests/actions/vstudio/vc2010/test_globals.lua b/tests/actions/vstudio/vc2010/test_globals.lua index aa775173..2f811e86 100755 --- a/tests/actions/vstudio/vc2010/test_globals.lua +++ b/tests/actions/vstudio/vc2010/test_globals.lua @@ -63,7 +63,7 @@ -- Ensure custom target framework version correct for Managed C++ projects. -- - function suite.frameworkVersionIsCorrect_onManagedC() + function suite.frameworkVersionIsCorrect_onSpecificVersion() clr "On" framework "4.5" prepare() @@ -77,6 +77,20 @@ ]] end + function suite.frameworkVersionIsCorrect_on2013() + _ACTION = "vs2013" + clr "On" + prepare() + test.capture [[ + + {42B5DBC6-AE1F-903D-F75D-41E363076E92} + true + v4.5 + ManagedCProj + MyProject + + ]] + end -- -- Omit Keyword and RootNamespace for non-Windows projects. diff --git a/tests/actions/vstudio/vc2010/test_header.lua b/tests/actions/vstudio/vc2010/test_header.lua index ebea610b..6eed4c9a 100644 --- a/tests/actions/vstudio/vc2010/test_header.lua +++ b/tests/actions/vstudio/vc2010/test_header.lua @@ -4,8 +4,7 @@ -- Copyright (c) 2011-2012 Jason Perkins and the Premake project -- - T.vstudio_vc2010_header = { } - local suite = T.vstudio_vc2010_header + local suite = test.declare("vstudio_vc2010_header") local vc2010 = premake.vstudio.vc2010 @@ -14,18 +13,37 @@ -- generated Project element. -- - function suite.project_onDefaultTarget() + function suite.project_on2010() + _ACTION = "vs2010" vc2010.project("Build") test.capture [[ ]] end + function suite.project_on2011() + _ACTION = "vs2012" + vc2010.project("Build") + test.capture [[ + + ]] + end + + function suite.project_on2013() + _ACTION = "vs2013" + vc2010.project("Build") + test.capture [[ + + ]] + end + + -- -- If no build target is specified, the entire attribute should be omitted. -- function suite.project_onNoDefaultTarget() + _ACTION = "vs2010" vc2010.project() test.capture [[