summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-12-15 00:44:32 +0800
committerruki <[email protected]>2020-12-15 00:44:32 +0800
commit99a7d26748e8afa84fa7123344f6aa4d24a1be93 (patch)
treeaeaa96d72eea4170ec46f89f85189f03cb9393d5
parenta6f93e44186006e0ee73450937608ec24fef192e (diff)
fix check vs
-rw-r--r--xmake/core/platform/platform.lua5
-rw-r--r--xmake/core/project/target.lua5
-rw-r--r--xmake/core/tool/toolchain.lua14
-rw-r--r--xmake/toolchains/msvc/check.lua3
4 files changed, 25 insertions, 2 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua
index 0c2565099..dda45956d 100644
--- a/xmake/core/platform/platform.lua
+++ b/xmake/core/platform/platform.lua
@@ -195,7 +195,10 @@ function _instance:tool(toolkind)
for idx, toolchain_inst in ipairs(toolchains) do
program, toolname = toolchain_inst:tool(toolkind)
if program then
- toolchain_info = {name = toolchain_inst:name(), plat = toolchain_inst:plat(), arch = toolchain_inst:arch(), cachekey = toolchain_inst:cachekey()}
+ toolchain_info = {name = toolchain_inst:name(),
+ plat = toolchain_inst:plat(),
+ arch = toolchain_inst:arch(),
+ cachekey = toolchain_inst:cachekey()}
toolinfo[1] = program
toolinfo[2] = toolname
toolinfo[3] = toolchain_info
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index bb6516767..0a5a67ddf 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1773,7 +1773,10 @@ function _instance:tool(toolkind)
for idx, toolchain_inst in ipairs(toolchains) do
program, toolname = toolchain_inst:tool(toolkind)
if program then
- toolchain_info = {name = toolchain_inst:name(), plat = toolchain_inst:plat(), arch = toolchain_inst:arch(), cachekey = toolchain_inst:cachekey()}
+ toolchain_info = {name = toolchain_inst:name(),
+ plat = toolchain_inst:plat(),
+ arch = toolchain_inst:arch(),
+ cachekey = toolchain_inst:cachekey()}
break
end
end
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index adb17c865..327be29ed 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -46,6 +46,15 @@ function _instance.new(name, info, cachekey, configs)
for k, v in pairs(configs) do
instance._CONFIGS[k] = v
end
+ -- is global toolchain for the whole platform?
+ configs.plat = nil
+ configs.arch = nil
+ configs.cachekey = nil
+ local plat = config.get("plat") or os.host()
+ local arch = config.get("arch") or os.arch()
+ if instance:is_plat(plat) and instance:is_arch(arch) and #table.keys(configs) == 0 then
+ instance._CONFIGS.__global = true
+ end
return instance
end
@@ -137,6 +146,11 @@ function _instance:standalone()
return self:kind() == "standalone"
end
+-- global toolchain for whole platform
+function _instance:global()
+ return self:config("__global")
+end
+
-- get the run environments
function _instance:runenvs()
local runenvs = self._RUNENVS
diff --git a/xmake/toolchains/msvc/check.lua b/xmake/toolchains/msvc/check.lua
index f0fd5f2f6..731836f88 100644
--- a/xmake/toolchains/msvc/check.lua
+++ b/xmake/toolchains/msvc/check.lua
@@ -79,6 +79,9 @@ end
function _check_vstudio(toolchain)
local vs = _check_vsenv(toolchain)
if vs then
+ if toolchain:global() then
+ config.set("vs", vs, {force = true, readonly = true})
+ end
toolchain:config_set("vs", vs)
toolchain:configs_save()
cprint("checking for Microsoft Visual Studio (%s) version ... ${color.success}%s", toolchain:arch(), vs)