summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorchooyy <[email protected]>2025-04-17 09:05:12 +0800
committerchooyy <[email protected]>2025-04-17 09:05:12 +0800
commit563da2bba9fe70cb4dcdf1c3d081e01a973a4e95 (patch)
tree0363d67d6b966d4c162a7a5d6324eb01581406ae /xmake
parentcd260b41e4f4f2003d46ea40e865fcab73644dec (diff)
do windeployqt for qt.shared deps, fix windeployqt bindir bug
Diffstat (limited to 'xmake')
-rw-r--r--xmake/rules/qt/install/mingw.lua24
-rw-r--r--xmake/rules/qt/install/windows.lua24
2 files changed, 32 insertions, 16 deletions
diff --git a/xmake/rules/qt/install/mingw.lua b/xmake/rules/qt/install/mingw.lua
index 4e3fe6d19..2cd41e5bb 100644
--- a/xmake/rules/qt/install/mingw.lua
+++ b/xmake/rules/qt/install/mingw.lua
@@ -26,18 +26,25 @@ import("lib.detect.find_path")
import("lib.detect.find_file")
import("detect.sdks.find_qt")
--- get install directory
-function _get_installdir(target)
- local installdir = assert(target:installdir(), "please use `xmake install -o installdir` or `set_installdir` to set install directory on windows.")
- return installdir
+-- get bin directory, if set_prefixdir changed bindir, we should use bindir
+function _get_bindir(target)
+ local bindir = assert(target:bindir(), "please use `xmake install -o installdir` or `set_installdir` to set install directory on windows.")
+ return bindir
end
-- install application package for windows
function main(target, opt)
- local targetfile = target:targetfile()
- local installdir = _get_installdir(target)
- local installfile = path.join(installdir, "bin", path.filename(targetfile))
+ local bindir = _get_bindir(target)
+ local targetfile = path.join(bindir, path.filename(target:targetfile()))
+ local installfiles = {}
+ table.insert(installfiles, targetfile)
+ for _, t in ipairs(target:orderdeps()) do
+ if t:rules()["qt.shared"] then -- qt.shared deps
+ local installfile = path.join(bindir, path.filename(t:targetfile()))
+ table.insert(installfiles, installfile)
+ end
+ end
-- get qt sdk
local qt = assert(find_qt(), "Qt SDK not found!")
@@ -104,7 +111,8 @@ function main(target, opt)
argv = table.join(argv, user_flags)
end
- table.insert(argv, installfile)
+ -- windeployqt for both target and its deps
+ table.join2(argv, installfiles)
os.vrunv(windeployqt, argv, {envs = envs})
end
diff --git a/xmake/rules/qt/install/windows.lua b/xmake/rules/qt/install/windows.lua
index 0eca909e9..1c44b8afc 100644
--- a/xmake/rules/qt/install/windows.lua
+++ b/xmake/rules/qt/install/windows.lua
@@ -26,18 +26,25 @@ import("lib.detect.find_file")
import("lib.detect.find_path")
import("detect.sdks.find_qt")
--- get install directory
-function _get_installdir(target)
- local installdir = assert(target:installdir(), "please use `xmake install -o installdir` or `set_installdir` to set install directory on windows.")
- return installdir
+-- get bin directory, if set_prefixdir changed bindir, we should use bindir
+function _get_bindir(target)
+ local bindir = assert(target:bindir(), "please use `xmake install -o installdir` or `set_installdir` to set install directory on windows.")
+ return bindir
end
-- install application package for windows
function main(target, opt)
- local targetfile = target:targetfile()
- local installdir = _get_installdir(target)
- local installfile = path.join(installdir, "bin", path.filename(targetfile))
+ local bindir = _get_bindir(target)
+ local targetfile = path.join(bindir, path.filename(target:targetfile()))
+ local installfiles = {}
+ table.insert(installfiles, targetfile)
+ for _, t in ipairs(target:orderdeps()) do
+ if t:rules()["qt.shared"] then -- qt.shared deps
+ local installfile = path.join(bindir, path.filename(t:targetfile()))
+ table.insert(installfiles, installfile)
+ end
+ end
-- get qt sdk
local qt = assert(find_qt(), "Qt SDK not found!")
@@ -120,7 +127,8 @@ function main(target, opt)
argv = table.join(argv, user_flags)
end
- table.insert(argv, installfile)
+ -- windeployqt for both target and its deps
+ table.join2(argv, installfiles)
os.vrunv(windeployqt, argv, {envs = envs})
end