From db31246f1fa9d00cdc3d4bc5ed82213e46fa0d7d Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 1 Aug 2020 11:17:52 +0800 Subject: fix custom toolchain --- CHANGELOG.md | 2 ++ xmake/core/tool/toolchain.lua | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 713557c0c..1049db25d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Bugs fixed * [#903](https://github.com/xmake-io/xmake/issues/903): Fix install vcpkg packages fails +* [#912](https://github.com/xmake-io/xmake/issues/912): Fix the custom toolchain ## v2.3.6 @@ -803,6 +804,7 @@ ### Bugs修复 * [#903](https://github.com/xmake-io/xmake/issues/903): 修复vcpkg包安装失败问题 +* [#912](https://github.com/xmake-io/xmake/issues/912): 修复自定义工具链 ## v2.3.6 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 -- cgit v1.3.1