summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA2va <[email protected]>2023-12-02 19:05:01 +0100
committerA2va <[email protected]>2023-12-02 19:05:01 +0100
commitdeae6419ab7da5071c6072c65bb9dac7ee942035 (patch)
tree8c316fbd091ad373d499556b471c76b6764ba934
parent3dd3d75b28552ba21af15fcabfc7d2a771af68e9 (diff)
Set binaries only if the user configured a toolchain
-rw-r--r--xmake/modules/package/tools/meson.lua20
1 files changed, 17 insertions, 3 deletions
diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua
index 498ef45e0..635ca1a8d 100644
--- a/xmake/modules/package/tools/meson.lua
+++ b/xmake/modules/package/tools/meson.lua
@@ -188,6 +188,15 @@ function _insert_cross_configs(package, file, opt)
end
end
+-- is the toolchain compatible with the host?
+function _is_toolchain_compatible_with_host(package)
+ for _, name in ipairs(package:config("toolchains")) do
+ if toolchain_utils.is_compatible_with_host(name) then
+ return true
+ end
+ end
+end
+
-- get cross file
function _get_configs_file(package, opt)
opt = opt or {}
@@ -270,7 +279,7 @@ function _get_configs_file(package, opt)
file:print("cpp_link_args=['%s']", table.concat(linkflags, "', '"))
end
- if package:is_cross() then
+ if package:is_cross() or opt.cross then
file:print("")
_insert_cross_configs(package, file, opt)
file:print("")
@@ -315,8 +324,13 @@ function _get_configs(package, configs, opt)
-- add cross file
if package:is_cross() then
table.insert(configs, "--cross-file=" .. _get_configs_file(package, opt))
- else
- table.insert(configs, "--native-file=" .. _get_configs_file(package, opt))
+ else if package:config("toolchains") then
+ if _is_toolchain_compatible_with_host(package) then
+ table.insert(configs, "--native-file=" .. _get_configs_file(package, opt))
+ else
+ opt.cross = true
+ table.insert(configs, "--cross-file=" .. _get_configs_file(package, opt))
+ end
end
-- add build directory