在Windows上部署QML应用程序的正确方法

Proper way to deploy QML applications on Windows

本文关键字:方法 应用程序 QML Windows 部署      更新时间:2023-10-16

最近我需要为我的Qt-QML应用程序创建一个部署包。此过程非常繁琐,因为您需要手动查找和复制依赖项。如(官方?Qt维基:

Copy the following into C:Deployment
 - The release version of MyApp.exe
 - All the .dll files from C:Qt5.2.1mingw48_32bin
 - All the folders from C:Qt5.2.1mingw48_32plugins (If you used QML)
 - All the folders from C:Qt5.2.1mingw48_32qml
Do the deletion steps below in C:Deployment and all of its subdirectories.
After each deletion, launch C:DeploymentMyApp.exe and test it.
If it stops working, restore the files you just deleted.
 - Launch MyApp.exe. While it is running, try to delete all DLLs.
   The DLLs that aren't used will go to the recycle bin,
   leaving behind only the DLLs that you need.
   (This trick doesn't work for .qml and qmldir files, however).
 - (If you used QML) Delete a few .qml files and try relaunching MyApp.exe.
   Repeat until you try all .qml files.
 - (If you used QML) Delete qmldir files from the folders that have no more DLLs or .qml files

对于任何现代工具,这样的程序看起来都是完全荒谬的。是的,我知道windeployqt.exe,但它没有找到所有.dll依赖项,并且对.qml依赖项根本没有帮助。

有没有人知道这个问题的更实用的方法,人们如何在大型项目中处理这个问题?有什么工具可以提供帮助吗?

Qt开发人员是否打算对此做点什么?

对于 windeployqt,可以选择--qmldir

windeployqt --qmldir f:myAppsources f:build-myAppmyApp.exe

因此,它还检查导入并获取qml dll。

所有这些都在链接的文章中进行了描述

相关文章: