Merge pull request #169 from TurkeyMan/llvm_toolset

Support LLVM platform toolset for MSC; Clang in Visual Studio.
This commit is contained in:
starkos 2015-09-09 15:06:53 -04:00
commit b5ee3ac021
4 changed files with 45 additions and 9 deletions

View File

@ -1079,13 +1079,15 @@
function m.debugInformationFormat(cfg)
local value
local tool, toolVersion = p.config.toolset(cfg)
if cfg.flags.Symbols then
if cfg.debugformat == "c7" then
value = "OldStyle"
elseif cfg.architecture == "x86_64" or
cfg.clr ~= p.OFF or
config.isOptimizedBuild(cfg) or
cfg.editandcontinue == p.OFF
cfg.editandcontinue == p.OFF or
(toolVersion and toolVersion:startswith("LLVM-vs"))
then
value = "ProgramDatabase"
else
@ -1548,9 +1550,7 @@
function m.platformToolset(cfg)
local tool, version = p.config.toolset(cfg)
if version then
version = "v" .. version
else
if not version then
local action = p.action.current()
version = action.vstudio.platformToolset
end
@ -1723,7 +1723,8 @@
end
function m.bufferSecurityCheck(cfg)
if cfg.flags.NoBufferSecurityCheck then
local tool, toolVersion = p.config.toolset(cfg)
if cfg.flags.NoBufferSecurityCheck or (toolVersion and toolVersion:startswith("LLVM-vs")) then
m.element("BufferSecurityCheck", nil, "false")
end
end

View File

@ -29,13 +29,19 @@
-- formed by splitting on boundaries formed by `pattern`.
--
function string.explode(s, pattern, plain)
function string.explode(s, pattern, plain, maxTokens)
if (pattern == '') then return false end
local pos = 0
local arr = { }
for st,sp in function() return s:find(pattern, pos, plain) end do
table.insert(arr, s:sub(pos, st-1))
pos = sp + 1
if maxTokens ~= nil and maxTokens > 0 then
maxTokens = maxTokens - 1
if maxTokens == 0 then
break
end
end
end
table.insert(arr, s:sub(pos))
return arr

View File

@ -31,10 +31,23 @@
function p.tools.canonical(identifier)
local parts
if identifier:startswith("v") then
parts = { "msc", identifier:sub(2) }
if identifier:startswith("v") then -- TODO: this should be deprecated?
parts = { "msc", identifier }
else
parts = identifier:explode("-")
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
end
return p.tools[parts[1]], parts[2]
end

View File

@ -86,3 +86,19 @@
<PlatformToolset>v100</PlatformToolset>
]]
end
function suite.canOverrideFromScript_withXP()
toolset "v120_xp"
prepare()
test.capture [[
<PlatformToolset>v120_xp</PlatformToolset>
]]
end
function suite.canOverrideFromScript_withLLVM()
toolset "msc-llvm-vs2014_xp"
prepare()
test.capture [[
<PlatformToolset>LLVM-vs2014_xp</PlatformToolset>
]]
end