Minimal changes for VS2012 support, from mopey's pull request
This commit is contained in:
parent
1fa3951541
commit
019eb6eb39
@ -93,6 +93,49 @@
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- The Visual Studio 2012 action, with support for the new platforms API
|
||||
--
|
||||
|
||||
newaction {
|
||||
trigger = "vs2012",
|
||||
shortname = "Visual Studio 2012",
|
||||
description = "Experimental Microsoft Visual Studio 2012 project files",
|
||||
os = "windows",
|
||||
|
||||
-- temporary, until I can phase out the legacy implementations
|
||||
isnextgen = true,
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
|
||||
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
|
||||
valid_tools = {
|
||||
cc = { "msc" },
|
||||
dotnet = { "msnet" },
|
||||
},
|
||||
|
||||
onsolution = function(sln)
|
||||
premake.generate(sln, "%%.sln", vstudio.sln2005.generate_ng)
|
||||
end,
|
||||
|
||||
onproject = function(prj)
|
||||
if premake.isdotnetproject(prj) then
|
||||
premake.generate(prj, "%%.csproj", vstudio.cs2005.generate_ng)
|
||||
premake.generate(prj, "%%.csproj.user", vstudio.cs2005.generate_user_ng)
|
||||
else
|
||||
premake.generate(prj, "%%.vcxproj", vstudio.vc2010.generate_ng)
|
||||
premake.generate(prj, "%%.vcxproj.user", vstudio.vc2010.generate_user_ng)
|
||||
premake.generate(prj, "%%.vcxproj.filters", vstudio.vc2010.generate_filters_ng)
|
||||
end
|
||||
end,
|
||||
|
||||
oncleansolution = vstudio.cleansolution,
|
||||
oncleanproject = vstudio.cleanproject,
|
||||
oncleantarget = vstudio.cleantarget
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- Translate the architecture settings for a configuration into a Visual
|
||||
-- Studio compatible identifier.
|
||||
|
@ -137,6 +137,7 @@
|
||||
vs2005 = '',
|
||||
vs2008 = ' ToolsVersion="3.5"',
|
||||
vs2010 = ' ToolsVersion="4.0"',
|
||||
vs2012 = ' ToolsVersion="4.0"',
|
||||
}
|
||||
|
||||
if _ACTION > "vs2008" then
|
||||
@ -155,6 +156,12 @@
|
||||
vs2005 = '8.0.50727',
|
||||
vs2008 = '9.0.21022',
|
||||
vs2010 = '8.0.30703',
|
||||
vs2012 = '8.0.30703',
|
||||
}
|
||||
|
||||
local frameworks = {
|
||||
vs2010 = "4.0",
|
||||
vs2012 = "4.5",
|
||||
}
|
||||
|
||||
_p(' <PropertyGroup>')
|
||||
@ -168,12 +175,12 @@
|
||||
_p(' <RootNamespace>%s</RootNamespace>', prj.buildtarget.basename)
|
||||
_p(' <AssemblyName>%s</AssemblyName>', prj.buildtarget.basename)
|
||||
|
||||
local framework = prj.framework or iif(_ACTION == "vs2010", "4.0", nil)
|
||||
local framework = prj.framework or frameworks[_ACTION]
|
||||
if framework then
|
||||
_p(' <TargetFrameworkVersion>v%s</TargetFrameworkVersion>', framework)
|
||||
end
|
||||
|
||||
if _ACTION == "vs2010" then
|
||||
if _ACTION >= "vs2010" then
|
||||
_p(' <TargetFrameworkProfile>Client</TargetFrameworkProfile>')
|
||||
_p(' <FileAlignment>512</FileAlignment>')
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
--
|
||||
-- vs2005_solution.lua
|
||||
-- Generate a Visual Studio 2005-2010 solution.
|
||||
-- Generate a Visual Studio 2005-2012 solution.
|
||||
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
@ -40,7 +40,12 @@
|
||||
--
|
||||
|
||||
function sln2005.header(sln)
|
||||
local version = { vs2005 = 9, vs2008 = 10, vs2010 = 11 }
|
||||
local version = {
|
||||
vs2005 = 9,
|
||||
vs2008 = 10,
|
||||
vs2010 = 11,
|
||||
vs2012 = 12,
|
||||
}
|
||||
_p('Microsoft Visual Studio Solution File, Format Version %d.00', version[_ACTION])
|
||||
_p('# Visual Studio %s', _ACTION:sub(3))
|
||||
end
|
||||
@ -57,7 +62,9 @@
|
||||
prjpath = path.translate(path.getrelative(slnpath, prjpath))
|
||||
|
||||
_x('Project("{%s}") = "%s", "%s", "{%s}"', vstudio.tool(prj), prj.name, prjpath, prj.uuid)
|
||||
sln2005.projectdependencies_ng(prj)
|
||||
if _ACTION < "vs2012" then
|
||||
sln2005.projectdependencies_ng(prj)
|
||||
end
|
||||
_p('EndProject')
|
||||
end
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--
|
||||
-- vs2010_vcxproj.lua
|
||||
-- Generate a Visual Studio 2010 C/C++ project.
|
||||
-- Generate a Visual Studio 201x C/C++ project.
|
||||
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 2010 C++ project, with support for the new platforms API.
|
||||
-- Generate a Visual Studio 201x C++ project, with support for the new platforms API.
|
||||
--
|
||||
|
||||
function vc2010.generate_ng(prj)
|
||||
@ -126,6 +126,10 @@
|
||||
_p(2,'<Keyword>Win32Proj</Keyword>')
|
||||
end
|
||||
|
||||
if _ACTION == "vs2012" then
|
||||
_p(2,[[<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>]])
|
||||
end
|
||||
|
||||
_p(2,'<RootNamespace>%s</RootNamespace>', prj.name)
|
||||
_p(1,'</PropertyGroup>')
|
||||
end
|
||||
@ -141,6 +145,10 @@
|
||||
_p(2,'<ConfigurationType>%s</ConfigurationType>', vc2010.config_type(cfg))
|
||||
_p(2,'<UseDebugLibraries>%s</UseDebugLibraries>', tostring(premake.config.isdebugbuild(cfg)))
|
||||
|
||||
if _ACTION == "vs2012" then
|
||||
_p(2,'<PlatformToolset>v110</PlatformToolset>')
|
||||
end
|
||||
|
||||
if cfg.flags.MFC then
|
||||
_p(2,'<UseOfMfc>%s</UseOfMfc>', iif(cfg.flags.StaticRuntime, "Static", "Dynamic"))
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
--
|
||||
-- vs2010_vcxproj_filters.lua
|
||||
-- Generate a Visual Studio 2010 C/C++ filters file.
|
||||
-- Generate a Visual Studio 201x C/C++ filters file.
|
||||
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 2010 C++ project, with support for the new platforms API.
|
||||
-- Generate a Visual Studio 201x C++ project, with support for the new platforms API.
|
||||
--
|
||||
|
||||
function vc2010.generate_filters_ng(prj)
|
||||
|
@ -1,6 +1,6 @@
|
||||
--
|
||||
-- vs2019_vcxproj_user.lua
|
||||
-- Generate a Visual Studio 2010 C/C++ project .user file
|
||||
-- Generate a Visual Studio 201x C/C++ project .user file
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 2010 C++ user file, with support for the new platforms API.
|
||||
-- Generate a Visual Studio 201x C++ user file, with support for the new platforms API.
|
||||
--
|
||||
|
||||
function vc2010.generate_user_ng(prj)
|
||||
|
@ -54,3 +54,12 @@
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.On2012()
|
||||
_ACTION = "vs2012"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
@ -92,6 +92,27 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.OnVs2012()
|
||||
_ACTION = "vs2012"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Framework Tests
|
||||
|
44
tests/actions/vstudio/vc2012/test_globals.lua
Normal file
44
tests/actions/vstudio/vc2012/test_globals.lua
Normal file
@ -0,0 +1,44 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2012/test_globals.lua
|
||||
-- Validate generation of the Globals property group.
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.vstudio_vs2012_globals = { }
|
||||
local suite = T.vstudio_vs2012_globals
|
||||
local vc2010 = premake.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln, prj
|
||||
|
||||
function suite.setup()
|
||||
_ACTION = "vs2012"
|
||||
sln = test.createsolution()
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = premake.solution.getproject_ng(sln, 1)
|
||||
vc2010.globals(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure with the default project values.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
@ -150,6 +150,9 @@
|
||||
dofile("actions/vstudio/vc2010/test_prop_sheet.lua")
|
||||
dofile("actions/vstudio/vc2010/test_resource_compile.lua")
|
||||
|
||||
-- Visual Studio 2012 C/C++ projects
|
||||
dofile("actions/vstudio/vc2012/test_globals.lua")
|
||||
|
||||
-- Makefile tests
|
||||
dofile("actions/make/solution/test_default_config.lua")
|
||||
dofile("actions/make/solution/test_help_rule.lua")
|
||||
|
Loading…
Reference in New Issue
Block a user