diff options
| -rw-r--r-- | xmake/modules/package/tools/xmake.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua index e782eb834..abcd7fc1e 100644 --- a/xmake/modules/package/tools/xmake.lua +++ b/xmake/modules/package/tools/xmake.lua @@ -66,6 +66,14 @@ function _get_configs(package, configs) if sdkdir then table.insert(configs, "--sdk=" .. sdkdir) end + -- we can only modify toolchain for cross-compilation + -- + -- e.g. xrepo install -p cross --toolchain=muslcc meson, + -- we cannot pass muslcc toolchain to it's deps(zlib, ..), because meson is always host binary and zlib is host library. + local toolchain_name = get_config("toolchain") + if toolchain_name then + table.insert(configs, "--toolchain=" .. toolchain_name) + end else local names = {"ndk", "ndk_sdkver", "vs", "mingw", "ld", "sh", "ar", "cc", "cxx", "mm", "mxx"} for _, name in ipairs(names) do @@ -75,13 +83,6 @@ function _get_configs(package, configs) end end end - -- we can only modify toolchain for linux or cross-compilation - if package:is_plat("linux", "cross") then - local toolchain_name = get_config("toolchain") - if toolchain_name then - table.insert(configs, "--toolchain=" .. toolchain_name) - end - end if not package:is_plat("windows", "mingw") and package:config("pic") ~= false then table.insert(cxflags, "-fPIC") end |
