Add toolset normalization, to stabilize the 'filter'.
This commit is contained in:
parent
4d95798a8e
commit
fd41938832
@ -1149,7 +1149,9 @@
|
||||
value = value:lower()
|
||||
local tool, version = p.tools.canonical(value)
|
||||
if tool then
|
||||
return value
|
||||
return p.tools.normalize(value)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
@ -29,25 +29,33 @@
|
||||
-- returns nil.
|
||||
---
|
||||
|
||||
function p.tools.canonical(identifier)
|
||||
local parts
|
||||
function p.tools.normalize(identifier)
|
||||
if identifier:startswith("v") then -- TODO: this should be deprecated?
|
||||
parts = { "msc", identifier }
|
||||
else
|
||||
parts = identifier:explode("-", true, 1)
|
||||
|
||||
-- couple of little hacks here to fix up version names
|
||||
if parts[2] ~= nil then
|
||||
-- 'msc-100' is accepted, but the code expects 'v100'
|
||||
if parts[1] == "msc" and tonumber(parts[2]:sub(1,3)) ~= nil then
|
||||
parts[2] = "v" .. parts[2]
|
||||
end
|
||||
|
||||
-- perform case-correction of the LLVM toolset
|
||||
if parts[2]:startswith("llvm-vs") then
|
||||
parts[2] = "LLVM-" .. parts[2]:sub(6)
|
||||
end
|
||||
end
|
||||
identifier = 'msc-' .. identifier
|
||||
end
|
||||
|
||||
local parts = identifier:explode("-", true, 1)
|
||||
if parts[2] == nil then
|
||||
return parts[1]
|
||||
end
|
||||
|
||||
-- 'msc-100' is accepted, but the code expects 'v100'
|
||||
if parts[1] == "msc" and tonumber(parts[2]:sub(1,3)) ~= nil then
|
||||
parts[2] = "v" .. parts[2]
|
||||
end
|
||||
|
||||
-- perform case-correction of the LLVM toolset
|
||||
if parts[2]:startswith("llvm-vs") then
|
||||
parts[2] = "LLVM-" .. parts[2]:sub(6)
|
||||
end
|
||||
|
||||
return parts[1] .. '-' .. parts[2]
|
||||
end
|
||||
|
||||
|
||||
function p.tools.canonical(identifier)
|
||||
identifier = p.tools.normalize(identifier)
|
||||
|
||||
local parts = identifier:explode("-", true, 1)
|
||||
return p.tools[parts[1]], parts[2]
|
||||
end
|
||||
|
@ -108,6 +108,15 @@
|
||||
test.isequal({}, cfg.defines)
|
||||
end
|
||||
|
||||
function suite.onFilterToolsetNormalization()
|
||||
toolset "v140"
|
||||
filter { "toolset:msc-v140" }
|
||||
defines { "USE_MSC" }
|
||||
prepare()
|
||||
test.isequal({ "USE_MSC" }, cfg.defines)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test filtering on system.
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user