summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-01-04 23:27:22 +0800
committerruki <[email protected]>2022-01-04 23:27:22 +0800
commit001af5a8122223a2cacc514525f72aa5f853ab82 (patch)
tree7debbec78b05e2a89052de5f0aea53e553374c02
parent77b107604093b5a905df60092f92e20f380f084b (diff)
improve to use qt libexec and bindir
-rw-r--r--xmake/modules/detect/sdks/find_qt.lua27
-rw-r--r--xmake/rules/qt/deploy/android.lua3
-rw-r--r--xmake/rules/qt/moc/xmake.lua3
-rw-r--r--xmake/rules/qt/qrc/xmake.lua3
-rw-r--r--xmake/rules/qt/ui/xmake.lua3
5 files changed, 33 insertions, 6 deletions
diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua
index 9c9cf43f0..202b52d88 100644
--- a/xmake/modules/detect/sdks/find_qt.lua
+++ b/xmake/modules/detect/sdks/find_qt.lua
@@ -35,7 +35,7 @@ function _find_sdkdir(sdkdir, sdkver)
table.insert(subdirs, path.join(sdkver or "*", is_arch("x86_64") and "gcc_64" or "gcc_32", "bin"))
table.insert(subdirs, path.join(sdkver or "*", is_arch("x86_64") and "clang_64" or "clang_32", "bin"))
elseif is_plat("macosx") then
- table.insert(subdirs, path.join(sdkver or "*", "macos", "bin")) -- for Qt 6.x
+ table.insert(subdirs, path.join(sdkver or "*", "macos", "bin")) -- for Qt 6.2
table.insert(subdirs, path.join(sdkver or "*", is_arch("x86_64") and "clang_64" or "clang_32", "bin"))
elseif is_plat("iphoneos") then
table.insert(subdirs, path.join(sdkver or "*", "ios", "bin"))
@@ -123,11 +123,7 @@ end
-- find qmake
function _find_qmake(sdkdir, sdkver)
-
- -- find qt directory
sdkdir = _find_sdkdir(sdkdir, sdkver)
-
- -- get the bin directory
local qmake = find_tool("qmake", {paths = sdkdir and path.join(sdkdir, "bin")})
if qmake then
return qmake.program
@@ -178,7 +174,26 @@ function _find_qt(sdkdir, sdkver)
local pluginsdir = qtenvs.QT_INSTALL_PLUGINS
local includedir = qtenvs.QT_INSTALL_HEADERS
local mkspecsdir = qtenvs.QMAKE_MKSPECS or path.join(qtenvs.QT_INSTALL_ARCHDATA, "mkspecs")
- return {sdkdir = sdkdir, bindir = bindir, libexecdir = libexecdir, libdir = libdir, includedir = includedir, qmldir = qmldir, pluginsdir = pluginsdir, mkspecsdir = mkspecsdir, sdkver = sdkver}
+ -- for 6.2
+ local bindir_host
+ if libexecdir and is_plat("android", "iphoneos") then
+ local rootdir = path.directory(path.directory(bindir))
+ if is_host("macosx") then
+ bindir_host = path.join(rootdir, "macos", "bin")
+ else
+ -- TODO
+ end
+ end
+ local libexecdir_host
+ if libexecdir and is_plat("android", "iphoneos") then
+ local rootdir = path.directory(path.directory(libexecdir))
+ if is_host("macosx") then
+ libexecdir_host = path.join(rootdir, "macos", "libexec")
+ else
+ -- TODO
+ end
+ end
+ return {sdkdir = sdkdir, bindir = bindir, bindir_host = bindir_host, libexecdir = libexecdir, libexecdir_host = libexecdir_host, libdir = libdir, includedir = includedir, qmldir = qmldir, pluginsdir = pluginsdir, mkspecsdir = mkspecsdir, sdkver = sdkver}
end
-- find qt sdk toolchains
diff --git a/xmake/rules/qt/deploy/android.lua b/xmake/rules/qt/deploy/android.lua
index c1cad3b54..8076671e6 100644
--- a/xmake/rules/qt/deploy/android.lua
+++ b/xmake/rules/qt/deploy/android.lua
@@ -71,6 +71,9 @@ function main(target, opt)
-- get androiddeployqt
local androiddeployqt = path.join(qt.bindir, "androiddeployqt" .. (is_host("windows") and ".exe" or ""))
+ if not os.isexec(androiddeployqt) and qt.bindir_host then
+ androiddeployqt = path.join(qt.bindir_host, "androiddeployqt" .. (is_host("windows") and ".exe" or ""))
+ end
assert(os.isexec(androiddeployqt), "androiddeployqt not found!")
-- get working directory
diff --git a/xmake/rules/qt/moc/xmake.lua b/xmake/rules/qt/moc/xmake.lua
index 80ce37174..f12fcf217 100644
--- a/xmake/rules/qt/moc/xmake.lua
+++ b/xmake/rules/qt/moc/xmake.lua
@@ -32,6 +32,9 @@ rule("qt.moc")
if not os.isexec(moc) and qt.libexecdir then
moc = path.join(qt.libexecdir, is_host("windows") and "moc.exe" or "moc")
end
+ if not os.isexec(moc) and qt.libexecdir_host then
+ moc = path.join(qt.libexecdir_host, 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 df416c2a9..64e37d2ab 100644
--- a/xmake/rules/qt/qrc/xmake.lua
+++ b/xmake/rules/qt/qrc/xmake.lua
@@ -29,6 +29,9 @@ rule("qt.qrc")
if not os.isexec(rcc) and qt.libexecdir then
rcc = path.join(qt.libexecdir, is_host("windows") and "rcc.exe" or "rcc")
end
+ if not os.isexec(rcc) and qt.libexecdir_host then
+ rcc = path.join(qt.libexecdir_host, is_host("windows") and "rcc.exe" or "rcc")
+ end
assert(os.isexec(rcc), "rcc not found!")
-- save rcc
diff --git a/xmake/rules/qt/ui/xmake.lua b/xmake/rules/qt/ui/xmake.lua
index dd377563b..2d02a134b 100644
--- a/xmake/rules/qt/ui/xmake.lua
+++ b/xmake/rules/qt/ui/xmake.lua
@@ -29,6 +29,9 @@ rule("qt.ui")
if not os.isexec(uic) and qt.libexecdir then
uic = path.join(qt.libexecdir, is_host("windows") and "uic.exe" or "uic")
end
+ if not os.isexec(uic) and qt.libexecdir_host then
+ uic = path.join(qt.libexecdir_host, 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).