From 53dc46224c8288b422335e1db0c3ae941c504f54 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Mon, 11 Jul 2022 22:35:32 +0200 Subject: Add user flag and qmldir variable for deployqt script --- xmake/rules/qt/deploy/android.lua | 7 +++++++ xmake/rules/qt/deploy/macosx.lua | 25 ++++++++++++++++++------- xmake/rules/qt/install/windows.lua | 25 ++++++++++++++++++------- 3 files changed, 43 insertions(+), 14 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..65a246a90 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") or nil + 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: waruqi@gmail.com (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..bcd01cc35 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") or nil + 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}) -- cgit v1.3.1 From 395a0846ab74bfb9ad41240e7893b8c897e5b344 Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Mon, 11 Jul 2022 22:35:48 +0200 Subject: Install qmldir and plugin.qmltypes to the right directory --- xmake/rules/qt/qmltyperegistrar/xmake.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) -- cgit v1.3.1 From b4762f0046b0b11e4dac93a227f13372ee2f51b0 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 12 Jul 2022 07:10:52 +0800 Subject: Update macosx.lua --- xmake/rules/qt/deploy/macosx.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/rules/qt/deploy/macosx.lua b/xmake/rules/qt/deploy/macosx.lua index 65a246a90..e6223a8c7 100644 --- a/xmake/rules/qt/deploy/macosx.lua +++ b/xmake/rules/qt/deploy/macosx.lua @@ -103,7 +103,7 @@ function main(target, opt) _save_info_plist(target, path.join(target_contents, "Info.plist")) -- find qml directory - local qmldir = target:values("qt.deploy.qmldir") or nil + local qmldir = target:values("qt.deploy.qmldir") if not qmldir then for _, sourcebatch in pairs(target:sourcebatches()) do if sourcebatch.rulename == "qt.qrc" then -- cgit v1.3.1 From a0242072d307b331217f0d2d058032fb44829c4a Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 12 Jul 2022 07:11:15 +0800 Subject: Update windows.lua --- xmake/rules/qt/install/windows.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/rules/qt/install/windows.lua b/xmake/rules/qt/install/windows.lua index bcd01cc35..26ef5febb 100644 --- a/xmake/rules/qt/install/windows.lua +++ b/xmake/rules/qt/install/windows.lua @@ -38,7 +38,7 @@ function main(target, opt) assert(os.isexec(windeployqt), "windeployqt.exe not found!") -- find qml directory - local qmldir = target:values("qt.deploy.qmldir") or nil + local qmldir = target:values("qt.deploy.qmldir") if not qmldir then for _, sourcebatch in pairs(target:sourcebatches()) do if sourcebatch.rulename == "qt.qrc" then -- cgit v1.3.1