Merge pull request #774 from Blizzard/default-toolset

Assure a default toolset is always set.
This commit is contained in:
Tom van Dijck 2017-06-20 11:34:26 -07:00 committed by GitHub
commit 0ce15ca188
15 changed files with 55 additions and 27 deletions

View File

@ -18,6 +18,7 @@
trigger = "codelite",
shortname = "CodeLite",
description = "Generate CodeLite project files",
toolset = "clang",
-- The capabilities of this action

View File

@ -15,6 +15,7 @@
trigger = "gmake",
shortname = "GNU Make",
description = "Generate GNU makefiles for POSIX, MinGW, and Cygwin",
toolset = "gcc",
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Utility", "Makefile" },
valid_languages = { "C", "C++", "C#" },

View File

@ -38,6 +38,7 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
]]
end
@ -270,6 +271,7 @@
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
]]
end
@ -286,6 +288,7 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v100</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
]]
end

View File

@ -35,7 +35,9 @@
function suite.correctDefault_onVS2010()
p.action.set("vs2010")
prepare()
test.isemptycapture()
test.capture [[
<PlatformToolset>v100</PlatformToolset>
]]
end

View File

@ -134,6 +134,7 @@
-- Visual Studio always uses Windows path and naming conventions
targetos = "windows",
toolset = "msc-v100",
-- The capabilities of this action

View File

@ -1929,8 +1929,8 @@
function m.platformToolset(cfg)
local tool, version = p.config.toolset(cfg)
if not version then
local action = p.action.current()
version = action.vstudio.platformToolset
local value = p.action.current().toolset
tool, version = p.tools.canonical(value)
end
if version then
if cfg.kind == p.NONE or cfg.kind == p.MAKEFILE then

View File

@ -21,6 +21,7 @@
-- Visual Studio always uses Windows path and naming conventions
targetos = "windows",
toolset = "msc-v110",
-- The capabilities of this action
@ -62,6 +63,5 @@
versionName = "2012",
targetFramework = "4.5",
toolsVersion = "4.0",
platformToolset = "v110"
}
}

View File

@ -21,6 +21,7 @@
-- Visual Studio always uses Windows path and naming conventions
targetos = "windows",
toolset = "msc-v120",
-- The capabilities of this action
@ -63,6 +64,5 @@
targetFramework = "4.5",
toolsVersion = "12.0",
filterToolsVersion = "4.0",
platformToolset = "v120"
}
}

View File

@ -21,6 +21,7 @@
-- Visual Studio always uses Windows path and naming conventions
targetos = "windows",
toolset = "msc-v140",
-- The capabilities of this action
@ -63,6 +64,5 @@
targetFramework = "4.5",
toolsVersion = "14.0",
filterToolsVersion = "4.0",
platformToolset = "v140"
}
}

View File

@ -21,6 +21,7 @@
-- Visual Studio always uses Windows path and naming conventions
targetos = "windows",
toolset = "msc-v141",
-- The capabilities of this action
@ -63,6 +64,5 @@
targetFramework = "4.5.2",
toolsVersion = "15.0",
filterToolsVersion = "4.0",
platformToolset = "v141"
}
}

View File

@ -36,6 +36,7 @@
-- Xcode always uses Mac OS X path and naming conventions
targetos = "macosx",
toolset = "clang",
-- The capabilities of this action

View File

@ -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,
}

View File

@ -531,7 +531,7 @@
local system = p.action.current().targetos or os.target()
local architecture = nil
local toolset = nil
local toolset = p.action.current().toolset
if platform then
system = p.api.checkValue(p.fields.system, platform) or system

View File

@ -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

View File

@ -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.
--