Implemented new SolutionConfigurationPlatforms handler for VS2008, supporting improved configurations
This commit is contained in:
parent
81ea63c877
commit
5533461428
@ -163,6 +163,19 @@
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Given a project configuration, return a Visual Studio compatible platform name.
|
||||
--
|
||||
|
||||
function vstudio.platform(cfg)
|
||||
local platform = cfg.platform or "Win32"
|
||||
if platform == "x32" then
|
||||
platform = "Win32"
|
||||
end
|
||||
return platform
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Assemble the project file name.
|
||||
--
|
||||
|
@ -9,6 +9,10 @@
|
||||
local sln2005 = premake.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Entry point; creates the solution file.
|
||||
--
|
||||
|
||||
function sln2005.generate(sln)
|
||||
io.eol = '\r\n'
|
||||
|
||||
@ -86,6 +90,19 @@
|
||||
-- lists all of the configuration/platform pairs that exist in the solution.
|
||||
--
|
||||
|
||||
function sln2005.solutionConfigurationPlatforms(sln)
|
||||
-- eachconfig() requires a project object; any one will do
|
||||
local prj = sln.projects[1]
|
||||
|
||||
_p(1,'GlobalSection(SolutionConfigurationPlatforms) = preSolution')
|
||||
for cfg in premake5.project.eachconfig(prj) do
|
||||
local platform = vstudio.platform(cfg)
|
||||
_p(2,'%s|%s = %s|%s', cfg.buildcfg, platform, cfg.buildcfg, platform)
|
||||
end
|
||||
_p(1,'EndGlobalSection')
|
||||
end
|
||||
|
||||
-- TODO: REMOVE THIS, OBSOLETE
|
||||
function sln2005.platforms(sln)
|
||||
_p('\tGlobalSection(SolutionConfigurationPlatforms) = preSolution')
|
||||
for _, cfg in ipairs(sln.vstudio_configs) do
|
||||
|
@ -299,7 +299,6 @@
|
||||
{
|
||||
kind = "list",
|
||||
scope = "solution",
|
||||
allowed = table.keys(premake.platforms),
|
||||
},
|
||||
|
||||
postbuildcommands =
|
||||
|
@ -1,7 +1,7 @@
|
||||
--
|
||||
-- src/project/project.lua
|
||||
-- Premake 5.0 project object API
|
||||
-- Copyright (c) 2011 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
premake5.project = { }
|
||||
|
76
tests/actions/vstudio/sln2005/test_solution_platforms.lua
Executable file
76
tests/actions/vstudio/sln2005/test_solution_platforms.lua
Executable file
@ -0,0 +1,76 @@
|
||||
--
|
||||
-- tests/actions/vstudio/sln2005/test_solution_platforms.lua
|
||||
-- Test the Visual Studio 2005-2010 SolutionConfigurationPlatforms block.
|
||||
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.vstudio_sln2005_solution_platforms = { }
|
||||
local suite = T.vstudio_sln2005_solution_platforms
|
||||
local sln2005 = premake.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln, prj
|
||||
|
||||
function suite.setup()
|
||||
_ACTION = "vs2008"
|
||||
sln, prj = test.createsolution()
|
||||
end
|
||||
|
||||
local function prepare(language)
|
||||
prj.language = language or "C++"
|
||||
sln2005.solutionConfigurationPlatforms(sln)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the basic form of C++ solutions: only the specified build configurations
|
||||
-- should be listed, and the architecture should default to Win32.
|
||||
--
|
||||
|
||||
function suite.buildCfgAndWin32Used_onNoPlatformsSet()
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- When a platform is specified, it should be listed instead of the default Win32.
|
||||
--
|
||||
|
||||
function suite.buildCfgAndPlatformUsed_onPlatformsSet()
|
||||
platforms { "Static" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Static = Debug|Static
|
||||
Release|Static = Release|Static
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- When multiple platforms are provided, the sort order should match Visual Studio.
|
||||
--
|
||||
|
||||
function suite.sortOrderIsCorrect_onMultiplePlatforms()
|
||||
platforms { "Static", "Dynamic" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Static = Debug|Static
|
||||
Debug|Dynamic = Debug|Dynamic
|
||||
Release|Static = Release|Static
|
||||
Release|Dynamic = Release|Dynamic
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
@ -17,7 +17,7 @@
|
||||
|
||||
solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "x32", "ps3" }
|
||||
platforms { "x32", "PS3" }
|
||||
|
||||
defines "SOLUTION"
|
||||
|
||||
|
@ -97,6 +97,7 @@
|
||||
dofile("actions/vstudio/sln2005/platforms.lua")
|
||||
dofile("actions/vstudio/sln2005/projectplatforms.lua")
|
||||
dofile("actions/vstudio/sln2005/projects.lua")
|
||||
dofile("actions/vstudio/sln2005/test_solution_platforms.lua")
|
||||
|
||||
-- Visual Studio 2002-2008 C/C++ projects
|
||||
dofile("actions/vstudio/vc200x/test_compiler_block.lua")
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "native" }
|
||||
platforms { "Native" }
|
||||
|
||||
prj = project "MyProject"
|
||||
language "C++"
|
||||
@ -106,7 +106,7 @@ endif
|
||||
|
||||
|
||||
function T.gmake_cpp.BasicCfgBlockWithPlatformCc()
|
||||
platforms { "ps3" }
|
||||
platforms { "PS3" }
|
||||
prepare()
|
||||
local cfg = premake.getconfig(prj, "Debug", "PS3")
|
||||
premake.gmake_cpp_config(cfg, premake.gcc)
|
||||
@ -172,7 +172,7 @@ endif
|
||||
|
||||
function T.gmake_cpp.UniversalStaticLibBlock()
|
||||
kind "StaticLib"
|
||||
platforms { "universal32" }
|
||||
platforms { "Universal32" }
|
||||
prepare()
|
||||
local cfg = premake.getconfig(prj, "Debug", "Universal32")
|
||||
premake.gmake_cpp_config(cfg, premake.gcc)
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "native" }
|
||||
platforms { "Native" }
|
||||
|
||||
prj = project "MyProject"
|
||||
language "C#"
|
||||
|
Loading…
Reference in New Issue
Block a user