flip default to clang and deal with platformToolset better.
-- Note: this function is already patched in by vs2012...
premake.override(vc2010, "platformToolset", function(oldfn, cfg)
- if cfg.system == premake.ANDROID then
+ if cfg.system ~= premake.ANDROID then
+ return oldfn(cfg)
+ end
+
if _ACTION >= "vs2015" then
- if cfg.toolchainversion ~= nil then
- _p(2,'<PlatformToolset>%s_%s</PlatformToolset>', iif(cfg.toolset == "clang", "Clang", "GCC"), string.gsub(cfg.toolchainversion, "%.", "_"))
+ local gcc_map = {
+ ["_"] = "GCC_4_9", -- default
+ ["4.6"] = "GCC_4_6",
+ ["4.8"] = "GCC_4_8",
+ ["4.9"] = "GCC_4_9",
+ }
+ local clang_map = {
+ ["_"] = "Clang_3_8", -- default
+ ["3.4"] = "Clang_3_4",
+ ["3.5"] = "Clang_3_5",
+ ["3.6"] = "Clang_3_6",
+ ["3.8"] = "Clang_3_8",
+ }
+
+ local map = iif(cfg.toolset == "gcc", gcc_map, clang_map)
+ local ts = map[cfg.toolchainversion or "_"]
+ if ts == nil then
+ p.error('Invalid toolchainversion for the selected toolset (%s).', cfg.toolset or "clang")
end
+
+ _p(2, "<PlatformToolset>%s</PlatformToolset>", ts)
else
local archMap = {
arm = "armv5te", -- should arm5 be default? vs-android thinks so...
_p(2,'<AndroidArch>%s</AndroidArch>', archMap[arch])
end
end
- else
- oldfn(cfg)
- end
end)
