summaryrefslogtreecommitdiff
path: root/xmake/core/tool/toolchain.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-08-01 11:17:52 +0800
committerruki <[email protected]>2020-08-01 11:17:52 +0800
commitdb31246f1fa9d00cdc3d4bc5ed82213e46fa0d7d (patch)
tree12251502590f67d95c55ebce4e91b5ad8dd3b00d /xmake/core/tool/toolchain.lua
parent02c25412e57a0719da2d7cd32654bb83d680bbf2 (diff)
fix custom toolchain
Diffstat (limited to 'xmake/core/tool/toolchain.lua')
-rw-r--r--xmake/core/tool/toolchain.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index ee8244819..0ed4bdc19 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -36,12 +36,12 @@ local sandbox = require("sandbox/sandbox")
local sandbox_module = require("sandbox/modules/import/core/sandbox/module")
-- new an instance
-function _instance.new(name, plat, arch, info)
+function _instance.new(name, info, plat, arch)
local instance = table.inherit(_instance)
instance._NAME = name
+ instance._INFO = info
instance._PLAT = plat
instance._ARCH = arch
- instance._INFO = info
return instance
end
@@ -424,14 +424,17 @@ function toolchain.load(name, opt)
end
-- save instance to the cache
- local instance = _instance.new(name, plat, arch, result)
+ local instance = _instance.new(name, result, plat, arch)
toolchain._TOOLCHAINS[cachekey] = instance
return instance
end
-- new toolchain
-function toolchain.new(name, info)
- return _instance.new(name, info)
+function toolchain.new(name, info, opt)
+ opt = opt or {}
+ local plat = opt.plat or config.get("plat") or os.host()
+ local arch = opt.arch or config.get("arch") or os.arch()
+ return _instance.new(name, info, plat, arch)
end
-- return module