summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwzshun <[email protected]>2026-04-20 14:22:53 +0800
committerwzshun <[email protected]>2026-04-20 14:22:53 +0800
commit0b1f29fd246e26b128eb6c7d7ffe9aa087e0a29d (patch)
treef595e51340d1fe6050c48c6449d84f58ec5db5e0
parent3a1b4e1719ba50b259afa27b450f06c39548003d (diff)
fix qt cross
-rw-r--r--xmake/modules/detect/sdks/find_qt.lua17
-rw-r--r--xmake/rules/qt/load.lua6
2 files changed, 19 insertions, 4 deletions
diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua
index c40491948..14a3de32b 100644
--- a/xmake/modules/detect/sdks/find_qt.lua
+++ b/xmake/modules/detect/sdks/find_qt.lua
@@ -208,8 +208,8 @@ function _get_qtenvs(qmake, sdkdir)
local results
-- Try with -qtconf first if sdkdir is provided
- if sdkdir then
- local conf_paths = {path.join(sdkdir, "bin", "target_qt.conf"), path.join(sdkdir, "bin", "qt.conf")}
+ if sdkdir then
+ local conf_paths = {path.join(sdkdir, "bin", "target_qt.conf"), path.join(sdkdir, "bin", "qt.conf"), path.join(sdkdir, "qt.conf")}
for _, conf_path in ipairs(conf_paths) do
if os.isfile(conf_path) then
results = try {function () return os.iorunv(qmake, {"-query", "-qtconf", conf_path}) end}
@@ -288,6 +288,19 @@ function _find_qt(sdkdir, sdkver, sdkdir_host)
local includedir = qtenvs.QT_INSTALL_HEADERS
local mkspecsdir = qtenvs.QMAKE_MKSPECS or path.join(qtenvs.QT_HOST_DATA, "mkspecs")
local mkspec = qtenvs.QMAKE_XSPEC or qtenvs.QMAKE_SPEC
+
+ -- handle qt sysroot
+ if qtenvs.QT_SYSROOT and qtenvs.QT_SYSROOT ~= "" then
+ local qt_sysroot = qtenvs.QT_SYSROOT
+ sdkdir = qt_sysroot .. sdkdir
+ bindir = qt_sysroot .. bindir
+ libexecdir = qt_sysroot .. libexecdir
+ qmldir = qt_sysroot .. qmldir
+ libdir = qt_sysroot .. libdir
+ pluginsdir = qt_sysroot .. pluginsdir
+ includedir = qt_sysroot .. includedir
+ end
+
-- for 6.2
local bindir_host = qtenvs.QT_HOST_BINS
if not bindir_host and libexecdir and is_plat("android", "iphoneos") then
diff --git a/xmake/rules/qt/load.lua b/xmake/rules/qt/load.lua
index 6b362e306..29dad499d 100644
--- a/xmake/rules/qt/load.lua
+++ b/xmake/rules/qt/load.lua
@@ -37,7 +37,7 @@ function _link(target, linkdirs, framework, qt_sdkver, infix)
else
debug_suffix = "d"
end
- elseif target:is_plat("android") or target:is_plat("linux") then
+ elseif target:is_plat("android") or target:is_plat("linux") or target:is_plat("cross") then
debug_suffix = ""
end
if qt_sdkver:ge("5.0") then
@@ -67,7 +67,7 @@ function _find_static_links_3rd(target, linkdirs, qt_sdkver, libpattern)
debug_suffix = "d"
elseif target:is_plat("mingw") then
debug_suffix = "d"
- elseif target:is_plat("android") or target:is_plat("linux") then
+ elseif target:is_plat("android") or target:is_plat("linux") or target:is_plat("cross") then
debug_suffix = ""
end
for _, linkdir in ipairs(linkdirs) do
@@ -459,6 +459,8 @@ function main(target, opt)
fallbackmkspec = "linux-g++"
target:add("rpathdirs", qt.libdir)
target:add("linkdirs", qt.libdir)
+ elseif target:is_plat("cross") then
+ _add_includedirs(target, qt.includedir)
elseif target:is_plat("windows") then
target:set("frameworks", nil)
_add_includedirs(target, qt.includedir)