summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-16 23:50:37 +0800
committerruki <[email protected]>2021-02-16 23:50:37 +0800
commit8a8236146108e80b0e1402b3d158d7298bd5b730 (patch)
tree9cd66f749d315d534add2f421502286c06a23e08 /xmake/modules/package/tools/xmake.lua
parent3fd2197be60b009f4ed16ec64a35f60c9ac0782b (diff)
fix tools/xmake
Diffstat (limited to 'xmake/modules/package/tools/xmake.lua')
-rw-r--r--xmake/modules/package/tools/xmake.lua35
1 files changed, 30 insertions, 5 deletions
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
index d034d19e7..e3df396de 100644
--- a/xmake/modules/package/tools/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -25,6 +25,16 @@ import("core.project.project")
import("core.package.repository")
import("private.action.require.impl.package", {alias = "require_package"})
+-- get config from toolchains
+function _get_config_from_toolchains(package, name)
+ for _, toolchain_inst in ipairs(package:toolchains()) do
+ local value = toolchain_inst:config(name)
+ if value ~= nil then
+ return value
+ end
+ end
+end
+
-- get configs
function _get_configs(package, configs)
local configs = configs or {}
@@ -42,11 +52,26 @@ function _get_configs(package, configs)
table.insert(configs, "--vs_runtime=" .. vs_runtime)
end
end
- local names = {"ndk", "ndk_sdkver", "vs", "mingw", "sdk", "bin", "cross", "ld", "sh", "ar", "cc", "cxx", "mm", "mxx"}
- for _, name in ipairs(names) do
- local value = get_config(name)
- if value ~= nil then
- table.insert(configs, "--" .. name .. "=" .. tostring(value))
+ if package:is_plat("cross") then
+ local cross = _get_config_from_toolchains(package, "cross") or get_config("cross")
+ if cross then
+ table.insert(configs, "--cross=" .. cross)
+ end
+ local bindir = _get_config_from_toolchains(package, "bindir") or get_config("bin")
+ if cross then
+ table.insert(configs, "--bin=" .. bindir)
+ end
+ local sdkdir = _get_config_from_toolchains(package, "sdkdir") or get_config("sdk")
+ if cross then
+ table.insert(configs, "--sdk=" .. sdkdir)
+ end
+ else
+ local names = {"ndk", "ndk_sdkver", "vs", "mingw", "ld", "sh", "ar", "cc", "cxx", "mm", "mxx"}
+ for _, name in ipairs(names) do
+ local value = get_config(name)
+ if value ~= nil then
+ table.insert(configs, "--" .. name .. "=" .. tostring(value))
+ end
end
end
if cflags then