Merge pull request #491 from g012/ToolsetFilter
Add ability to filter configurations by toolset
This commit is contained in:
commit
ea5cb0961e
@ -32,6 +32,7 @@
|
||||
options = true,
|
||||
platforms = true,
|
||||
system = true,
|
||||
toolset = true,
|
||||
}
|
||||
|
||||
|
||||
|
@ -440,10 +440,12 @@
|
||||
|
||||
local system = p.action.current().os or os.get()
|
||||
local architecture = nil
|
||||
local toolset = nil
|
||||
|
||||
if platform then
|
||||
system = p.api.checkValue(p.fields.system, platform) or system
|
||||
architecture = p.api.checkValue(p.fields.architecture, platform) or architecture
|
||||
toolset = p.api.checkValue(p.fields.toolset, platform) or toolset
|
||||
end
|
||||
|
||||
-- Wrap the projects's configuration set (which contains all of the information
|
||||
@ -494,6 +496,10 @@
|
||||
ctx.architecture = ctx.architecture or architecture
|
||||
context.addFilter(ctx, "architecture", ctx.architecture)
|
||||
|
||||
-- allow the project script to override the default toolset
|
||||
ctx.toolset = ctx.toolset or toolset
|
||||
context.addFilter(ctx, "toolset", ctx.toolset)
|
||||
|
||||
-- if a kind is set, allow that to influence the configuration
|
||||
context.addFilter(ctx, "kind", ctx.kind)
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
local wks, prj, cfg
|
||||
|
||||
function suite.setup()
|
||||
wks = test.createWorkspace()
|
||||
@ -20,6 +20,7 @@
|
||||
local function prepare()
|
||||
wks = test.getWorkspace(wks)
|
||||
prj = test.getproject(wks, 1)
|
||||
cfg = test.getconfig(prj, "Debug")
|
||||
end
|
||||
|
||||
|
||||
@ -85,3 +86,23 @@
|
||||
prepare()
|
||||
test.isequal({ }, prj.defines)
|
||||
end
|
||||
|
||||
--
|
||||
-- Test filtering by the selected toolset.
|
||||
--
|
||||
|
||||
function suite.onFilterToolset()
|
||||
toolset "msc"
|
||||
filter { "toolset:msc" }
|
||||
defines { "USE_MSC" }
|
||||
prepare()
|
||||
test.isequal({ "USE_MSC" }, cfg.defines)
|
||||
end
|
||||
|
||||
function suite.onFilterToolsetMismatch()
|
||||
toolset "clang"
|
||||
filter { "toolset:msc" }
|
||||
defines { "USE_MSC" }
|
||||
prepare()
|
||||
test.isequal({}, cfg.defines)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user