summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2023-05-26 22:33:23 +0800
committerruki <[email protected]>2023-05-26 22:33:23 +0800
commitd0c5ff95b69965b3ef51d5f54544bd6d81e0d5f8 (patch)
treed8d40c34fd258d4e9987b16a7b50322f71f2a02e /xmake/modules
parent3bc1882be93ab58f774322b74d19d2fe92bd09e5 (diff)
improve to pass toolchain in tools.xmake #3774
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/package/tools/xmake.lua19
1 files changed, 12 insertions, 7 deletions
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
index 0018128ef..e4a501b30 100644
--- a/xmake/modules/package/tools/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -241,14 +241,19 @@ function _get_package_toolchains_envs(package, opt)
-- pass custom toolchains definition in project
for _, toolchain_inst in ipairs(toolchains_custom) do
- local toolchains_file = os.tmpfile()
- dprint("passing toolchain(%s) to %s", toolchain_inst:name(), toolchains_file)
- local ok, errors = toolchain_inst:savefile(toolchains_file)
- if not ok then
- raise("save toolchain failed, %s", errors or "unknown")
+ -- we must load it first
+ -- @see https://github.com/xmake-io/xmake/issues/3774
+ if toolchain_inst:check() then
+ toolchain_inst:load()
+ local toolchains_file = os.tmpfile()
+ dprint("passing toolchain(%s) to %s", toolchain_inst:name(), toolchains_file)
+ local ok, errors = toolchain_inst:savefile(toolchains_file)
+ if not ok then
+ raise("save toolchain failed, %s", errors or "unknown")
+ end
+ envs.XMAKE_TOOLCHAIN_DATAFILES = envs.XMAKE_TOOLCHAIN_DATAFILES or {}
+ table.insert(envs.XMAKE_TOOLCHAIN_DATAFILES, toolchains_file)
end
- envs.XMAKE_TOOLCHAIN_DATAFILES = envs.XMAKE_TOOLCHAIN_DATAFILES or {}
- table.insert(envs.XMAKE_TOOLCHAIN_DATAFILES, toolchains_file)
end
end
return envs