diff options
| author | ruki <[email protected]> | 2021-10-24 22:12:36 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-10-24 22:12:36 +0800 |
| commit | 8492e2a5133e27794e8fac48212e8540bef9ffd7 (patch) | |
| tree | 7081fb8a0db1d8e05e76e988874c1c1b801c7d57 | |
| parent | 6bac1ec396557471cf0651a3d8dadbb76234299c (diff) | |
improve tools/xmake
| -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 |
