summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-04-21 18:36:53 +0800
committerGitHub <[email protected]>2026-04-21 18:36:53 +0800
commit3dfae3707870262645edfe97554b33956c8e7be6 (patch)
tree5b57b40b45e22532009bad7ec75e2e7592b6b798
parent55f8d448564f7cc198edb4db506ec7c18ca8f0f6 (diff)
parentfad66cf085b6d4671baa1e26bfac17a273aff8df (diff)
Merge pull request #7493 from ThzShun/fix-qt-cross
fix qt cross
-rw-r--r--xmake/modules/detect/sdks/find_qt.lua15
-rw-r--r--xmake/rules/qt/load.lua6
2 files changed, 18 insertions, 3 deletions
diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua
index c40491948..43534cf5e 100644
--- a/xmake/modules/detect/sdks/find_qt.lua
+++ b/xmake/modules/detect/sdks/find_qt.lua
@@ -209,7 +209,7 @@ function _get_qtenvs(qmake, sdkdir)
-- 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")}
+ 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
+ local qt_sysroot = qtenvs.QT_SYSROOT or ""
+ if #qt_sysroot > 0 and path.isdir(qt_sysroot) then
+ sdkdir = path.join(qt_sysroot, sdkdir)
+ bindir = path.join(qt_sysroot, bindir)
+ libexecdir = path.join(qt_sysroot, libexecdir)
+ qmldir = path.join(qt_sysroot, qmldir)
+ libdir = path.join(qt_sysroot, libdir)
+ pluginsdir = path.join(qt_sysroot, pluginsdir)
+ includedir = path.join(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)