summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-07-16 22:45:30 +0800
committerruki <[email protected]>2021-07-16 22:45:30 +0800
commit53aee110c161606152f43a48199f9753c558bee2 (patch)
tree35c9f9e200363c76e738a1852ec15c5ad64e80e1
parenta408b0e6fd6f5592a0dbf5451044a2aafa14edfc (diff)
improve to support qt6
-rw-r--r--xmake/modules/detect/sdks/find_qt.lua3
-rw-r--r--xmake/rules/qt/moc/xmake.lua6
-rw-r--r--xmake/rules/qt/qrc/xmake.lua8
-rw-r--r--xmake/rules/qt/ui/xmake.lua6
4 files changed, 18 insertions, 5 deletions
diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua
index 3b71a5640..9dbc7b386 100644
--- a/xmake/modules/detect/sdks/find_qt.lua
+++ b/xmake/modules/detect/sdks/find_qt.lua
@@ -169,12 +169,13 @@ function _find_qt(sdkdir, sdkver)
sdkdir = qtenvs.QT_INSTALL_PREFIX
local sdkver = qtenvs.QT_VERSION
local bindir = qtenvs.QT_INSTALL_BINS
+ local libexecdir = qtenvs.QT_INSTALL_LIBEXECS
local qmldir = qtenvs.QT_INSTALL_QML
local libdir = qtenvs.QT_INSTALL_LIBS
local pluginsdir = qtenvs.QT_INSTALL_PLUGINS
local includedir = qtenvs.QT_INSTALL_HEADERS
local mkspecsdir = path.join(qtenvs.QT_INSTALL_ARCHDATA, "mkspecs")
- return {sdkdir = sdkdir, bindir = bindir, libdir = libdir, includedir = includedir, qmldir = qmldir, pluginsdir = pluginsdir, mkspecsdir = mkspecsdir, sdkver = sdkver}
+ return {sdkdir = sdkdir, bindir = bindir, libexecdir = libexecdir, libdir = libdir, includedir = includedir, qmldir = qmldir, pluginsdir = pluginsdir, mkspecsdir = mkspecsdir, sdkver = sdkver}
end
-- find qt sdk toolchains
diff --git a/xmake/rules/qt/moc/xmake.lua b/xmake/rules/qt/moc/xmake.lua
index 439a0b573..80ce37174 100644
--- a/xmake/rules/qt/moc/xmake.lua
+++ b/xmake/rules/qt/moc/xmake.lua
@@ -27,7 +27,11 @@ rule("qt.moc")
import("core.tool.compiler")
-- get moc
- local moc = path.join(target:data("qt").bindir, is_host("windows") and "moc.exe" or "moc")
+ local qt = assert(target:data("qt"), "qt not found!")
+ local moc = path.join(qt.bindir, is_host("windows") and "moc.exe" or "moc")
+ if not os.isexec(moc) and qt.libexecdir then
+ moc = path.join(qt.libexecdir, is_host("windows") and "moc.exe" or "moc")
+ end
assert(moc and os.isexec(moc), "moc not found!")
-- get c++ source file for moc
diff --git a/xmake/rules/qt/qrc/xmake.lua b/xmake/rules/qt/qrc/xmake.lua
index 2529ef118..df416c2a9 100644
--- a/xmake/rules/qt/qrc/xmake.lua
+++ b/xmake/rules/qt/qrc/xmake.lua
@@ -24,8 +24,12 @@ rule("qt.qrc")
on_load(function (target)
-- get rcc
- local rcc = path.join(target:data("qt").bindir, is_host("windows") and "rcc.exe" or "rcc")
- assert(rcc and os.isexec(rcc), "rcc not found!")
+ local qt = assert(target:data("qt"), "qt not found!")
+ local rcc = path.join(qt.bindir, is_host("windows") and "rcc.exe" or "rcc")
+ if not os.isexec(rcc) and qt.libexecdir then
+ rcc = path.join(qt.libexecdir, is_host("windows") and "rcc.exe" or "rcc")
+ end
+ assert(os.isexec(rcc), "rcc not found!")
-- save rcc
target:data_set("qt.rcc", rcc)
diff --git a/xmake/rules/qt/ui/xmake.lua b/xmake/rules/qt/ui/xmake.lua
index b1ce103e5..dd377563b 100644
--- a/xmake/rules/qt/ui/xmake.lua
+++ b/xmake/rules/qt/ui/xmake.lua
@@ -24,7 +24,11 @@ rule("qt.ui")
on_load(function (target)
-- get uic
- local uic = path.join(target:data("qt").bindir, is_host("windows") and "uic.exe" or "uic")
+ local qt = assert(target:data("qt"), "qt not found!")
+ local uic = path.join(qt.bindir, is_host("windows") and "uic.exe" or "uic")
+ if not os.isexec(uic) and qt.libexecdir then
+ uic = path.join(qt.libexecdir, is_host("windows") and "uic.exe" or "uic")
+ end
assert(uic and os.isexec(uic), "uic not found!")
-- add includedirs, @note we need create this directory first to suppress warning (file not found).