Merge pull request #950 from LORgames/ssurtees/gmakeDefaultPlatform
Added defaultplatform support to gmake and gmake2 actions
This commit is contained in:
commit
1279e6baf6
@ -25,13 +25,27 @@
|
||||
function make.defaultconfig(target)
|
||||
-- find the right configuration iterator function for this object
|
||||
local eachconfig = iif(target.project, project.eachconfig, p.workspace.eachconfig)
|
||||
local iter = eachconfig(target)
|
||||
local defaultconfig = nil
|
||||
|
||||
-- find the right default configuration platform, grab first configuration that matches
|
||||
if target.defaultplatform then
|
||||
for cfg in eachconfig(target) do
|
||||
if cfg.platform == target.defaultplatform then
|
||||
defaultconfig = cfg
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- grab the first configuration and write the block
|
||||
local cfg = iter()
|
||||
if cfg then
|
||||
if not defaultconfig then
|
||||
local iter = eachconfig(target)
|
||||
defaultconfig = iter()
|
||||
end
|
||||
|
||||
if defaultconfig then
|
||||
_p('ifndef config')
|
||||
_x(' config=%s', cfg.shortname)
|
||||
_x(' config=%s', defaultconfig.shortname)
|
||||
_p('endif')
|
||||
_p('')
|
||||
end
|
||||
|
@ -69,3 +69,19 @@ ifndef config
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify handling of defaultplatform
|
||||
--
|
||||
|
||||
function suite.defaultsToSpecifiedPlatform()
|
||||
platforms { "Win32", "Win64" }
|
||||
defaultplatform "Win64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
ifndef config
|
||||
config=debug_win64
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
@ -20,13 +20,27 @@
|
||||
function gmake2.defaultconfig(target)
|
||||
-- find the right configuration iterator function for this object
|
||||
local eachconfig = iif(target.project, project.eachconfig, p.workspace.eachconfig)
|
||||
local iter = eachconfig(target)
|
||||
local defaultconfig = nil
|
||||
|
||||
-- find the right default configuration platform, grab first configuration that matches
|
||||
if target.defaultplatform then
|
||||
for cfg in eachconfig(target) do
|
||||
if cfg.platform == target.defaultplatform then
|
||||
defaultconfig = cfg
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- grab the first configuration and write the block
|
||||
local cfg = iter()
|
||||
if cfg then
|
||||
if not defaultconfig then
|
||||
local iter = eachconfig(target)
|
||||
defaultconfig = iter()
|
||||
end
|
||||
|
||||
if defaultconfig then
|
||||
_p('ifndef config')
|
||||
_x(' config=%s', cfg.shortname)
|
||||
_x(' config=%s', defaultconfig.shortname)
|
||||
_p('endif')
|
||||
_p('')
|
||||
end
|
||||
|
Reference in New Issue
Block a user