最近我需要为我的Qt-QML应用程序创建一个部署包。这个过程相当繁琐,因为你需要手动查找和复制依赖项。如(官方?)Qt Wiki中所述:
Copy the following into C:\Deployment\
- The release version of MyApp.exe
- All the .dll files from C:\Qt\5.2.1\mingw48_32\bin\
- All the folders from C:\Qt\5.2.1\mingw48_32\plugins\ (If you used QML)
- All the folders from C:\Qt\5.2.1\mingw48_32\qml\
Do the deletion steps below in C:\Deployment\ and all of its subdirectories.
After each deletion, launch C:\Deployment\MyApp.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开发人员是否计划对此做些什么?
2条答案
按热度按时间3ks5zfa01#
对于windeployqt,有一个选项
--qmldir
。所以它也检查导入并获取qmldll文件。
所有这些都在linked article中进行了描述
jqjz2hbq2#
@Vova Shevchyk @RvdK的答案是正确的,应该可以工作。https://stackoverflow.com/a/39717117/15701702
“--qmldir f:\myApp\sources“,此处您应放置的路径是您开发应用程序的路径,即您在QtCreator中的项目路径。app.exe应来自发布版本。您可以将app.exe放置在所需的任何目录中并指定路径。部署将在该目录中添加所有必要的文件和dll。