summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-12 07:11:40 +0800
committerGitHub <[email protected]>2022-07-12 07:11:40 +0800
commita7a21777f4c6125d9830a264bc508d2f805d9e1b (patch)
treee9bcd0235a6c21b95a26e621379940201f9853f6
parent380591173f252275df68fc33d08404d2ecc7d166 (diff)
parenta0242072d307b331217f0d2d058032fb44829c4a (diff)
Merge pull request #2558 from Arthapz/Fix-qmldir-deployqt
Add user variables to configure deployqt and fix qml plugins files install dir
-rw-r--r--xmake/rules/qt/deploy/android.lua7
-rw-r--r--xmake/rules/qt/deploy/macosx.lua25
-rw-r--r--xmake/rules/qt/install/windows.lua25
-rw-r--r--xmake/rules/qt/qmltyperegistrar/xmake.lua4
4 files changed, 45 insertions, 16 deletions
diff --git a/xmake/rules/qt/deploy/android.lua b/xmake/rules/qt/deploy/android.lua
index c5bc810c4..5e6a641d8 100644
--- a/xmake/rules/qt/deploy/android.lua
+++ b/xmake/rules/qt/deploy/android.lua
@@ -216,6 +216,13 @@ function main(target, opt)
if option.get("verbose") and option.get("diagnosis") then
table.insert(argv, "--verbose")
end
+
+ -- add user flags
+ local user_flags = target:values("qt.deploy.flags") or {}
+ if user_flags then
+ table.join(argv, user_flags)
+ end
+
os.vrunv(androiddeployqt, argv)
-- output apk
diff --git a/xmake/rules/qt/deploy/macosx.lua b/xmake/rules/qt/deploy/macosx.lua
index 26df10b14..e6223a8c7 100644
--- a/xmake/rules/qt/deploy/macosx.lua
+++ b/xmake/rules/qt/deploy/macosx.lua
@@ -103,16 +103,20 @@ function main(target, opt)
_save_info_plist(target, path.join(target_contents, "Info.plist"))
-- find qml directory
- local qmldir = nil
- for _, sourcebatch in pairs(target:sourcebatches()) do
- if sourcebatch.rulename == "qt.qrc" then
- for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
- qmldir = find_path("*.qml", path.directory(sourcefile))
- if qmldir then
- break
+ local qmldir = target:values("qt.deploy.qmldir")
+ if not qmldir then
+ for _, sourcebatch in pairs(target:sourcebatches()) do
+ if sourcebatch.rulename == "qt.qrc" then
+ for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
+ qmldir = find_path("*.qml", path.directory(sourcefile))
+ if qmldir then
+ break
+ end
end
end
end
+ else
+ qmldir = path.join(target:scriptdir(), qmldir)
end
-- do deploy
@@ -132,6 +136,13 @@ function main(target, opt)
-- e.g. "Apple Development: [email protected] (T3NA4MRVPU)"
table.insert(argv, "-codesign=" .. codesign_identity)
end
+
+ -- add user flags
+ local user_flags = target:values("qt.deploy.flags") or {}
+ if user_flags then
+ table.join(argv, user_flags)
+ end
+
os.vrunv(macdeployqt, argv)
-- update files and values to the dependent file
diff --git a/xmake/rules/qt/install/windows.lua b/xmake/rules/qt/install/windows.lua
index 69d4c1c70..26ef5febb 100644
--- a/xmake/rules/qt/install/windows.lua
+++ b/xmake/rules/qt/install/windows.lua
@@ -38,16 +38,20 @@ function main(target, opt)
assert(os.isexec(windeployqt), "windeployqt.exe not found!")
-- find qml directory
- local qmldir = nil
- for _, sourcebatch in pairs(target:sourcebatches()) do
- if sourcebatch.rulename == "qt.qrc" then
- for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
- qmldir = find_path("*.qml", path.directory(sourcefile))
- if qmldir then
- break
+ local qmldir = target:values("qt.deploy.qmldir")
+ if not qmldir then
+ for _, sourcebatch in pairs(target:sourcebatches()) do
+ if sourcebatch.rulename == "qt.qrc" then
+ for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
+ qmldir = find_path("*.qml", path.directory(sourcefile))
+ if qmldir then
+ break
+ end
end
end
end
+ else
+ qmldir = path.join(target:scriptdir(), qmldir)
end
-- find msvc to set VCINSTALLDIR env
@@ -78,6 +82,13 @@ function main(target, opt)
if qmldir then
table.insert(argv, "--qmldir=" .. qmldir)
end
+
+ -- add user flags
+ local user_flags = target:values("qt.deploy.flags") or {}
+ if user_flags then
+ table.join(argv, user_flags)
+ end
+
table.insert(argv, installfile)
os.vrunv(windeployqt, argv, {envs = envs})
diff --git a/xmake/rules/qt/qmltyperegistrar/xmake.lua b/xmake/rules/qt/qmltyperegistrar/xmake.lua
index d0e8b92bf..ae913c9aa 100644
--- a/xmake/rules/qt/qmltyperegistrar/xmake.lua
+++ b/xmake/rules/qt/qmltyperegistrar/xmake.lua
@@ -50,11 +50,11 @@ rule("qt.qmltyperegistrar")
-- add qmldir
local qmldir = target:values("qt.qmlplugin.qmldirfile")
if qmldir then
- target:add("installfiles", qmldir)
+ target:add("installfiles", path.join(target:scriptdir(), qmldir), { prefixdir = path.join("bin", table.unpack(importname:split(".", { plain = true }))) })
end
-- add qmltypes
- target:add("installfiles", target:get("targetdir") .. "/plugin.qmltypes")
+ target:add("installfiles", path.join(target:get("targetdir"), "plugin.qmltypes"), { prefixdir = path.join("bin", table.unpack(importname:split(".", { plain = true }))) })
local sourcefile = path.join(target:autogendir(), "rules", "qt", "qmltyperegistrar", target:name() .. "_qmltyperegistrations.cpp")
local sourcefile_dir = path.directory(sourcefile)