summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-11-01 22:47:16 +0800
committerruki <[email protected]>2020-11-01 22:47:16 +0800
commit2e2399119652e64b2e6f7c9447af0ec6aa7c2efc (patch)
tree11c355be01d6af84ffc0970d509b26ef56dd3324
parent932e9164587c462e750c387999103a822ef4408a (diff)
add builtin toolchain
-rw-r--r--xmake/core/tool/toolchain.lua14
-rw-r--r--xmake/toolchains/musl/xmake.lua11
2 files changed, 13 insertions, 12 deletions
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index e2e31f558..5730b238a 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -208,11 +208,21 @@ function _instance:check()
return checkok
end
+-- check cross toolchain
+function _instance:check_cross_toolchain()
+ return sandbox_module.import("toolchains.cross.check", {rootdir = os.programdir(), anonymous = true})(self)
+end
+
+-- load cross toolchain
+function _instance:load_cross_toolchain()
+ return sandbox_module.import("toolchains.cross.load", {rootdir = os.programdir(), anonymous = true})(self)
+end
+
-- on check (builtin)
function _instance:_on_check()
local on_check = self:info():get("check")
if not on_check and (self:cross() or self:sdkdir()) then
- on_check = sandbox_module.import("toolchains.cross.check", {rootdir = os.programdir(), anonymous = true})
+ on_check = self.check_cross_toolchain
end
return on_check
end
@@ -221,7 +231,7 @@ end
function _instance:_on_load()
local on_load = self:info():get("load")
if not on_load and (self:cross() or self:sdkdir()) then
- on_load = sandbox_module.import("toolchains.cross.load", {rootdir = os.programdir(), anonymous = true})
+ on_load = self.load_cross_toolchain
end
return on_load
end
diff --git a/xmake/toolchains/musl/xmake.lua b/xmake/toolchains/musl/xmake.lua
index f7da3f4c8..3db674688 100644
--- a/xmake/toolchains/musl/xmake.lua
+++ b/xmake/toolchains/musl/xmake.lua
@@ -28,20 +28,11 @@ toolchain("musl")
-- mark as standalone toolchain
set_kind("standalone")
- -- check toolchain
- on_check(function (toolchain)
- return import("toolchains.cross.check", {rootdir = os.programdir()})(toolchain)
- end)
-
-- on load
on_load(function (toolchain)
- -- imports
- import("core.project.config")
- import("toolchains.cross.load", {rootdir = os.programdir()})
-
-- load basic configuration of cross toolchain
- load(toolchain)
+ toolchain:load_cross_toolchain()
-- add flags for arch
if toolchain:is_arch("arm") then