qt打包发布

时间:2021-10-11 00:58:17

需要用到qt自带工具windeployqt.exe

安装

以qt 5.8.0为例

安装qt-opensource-windows-x86-mingw530-5.8.0.exe即可

构建Release版本

qt打包发布

使用qt提供的dos窗口

qt打包发布

或者:添加环境变量 C:\Qt\Qt5.8.0\5.8\mingw53_32\bin

找到.exe

将hello.exe放在一个单独的文件夹下

> cd F:\QT\work\build-hello-Desktop_Qt_5_8_0_MinGW_32bit-Release\pack
> windeployqt hello.exe
F:\QT\work\build-hello-Desktop_Qt_5_8_0_MinGW_32bit-Release\pack\hello.exe 32 bit, release executable
Adding Qt5Svg for qsvgicon.dll
Skipping plugin qtvirtualkeyboardplugin.dll due to disabled dependencies.
Direct dependencies: Qt5Core Qt5Widgets
All dependencies : Qt5Core Qt5Gui Qt5Widgets
To be deployed : Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Warning: Cannot find GCC installation directory. g++.exe must be in the path.
Updating Qt5Core.dll.
Updating Qt5Gui.dll.
Updating Qt5Svg.dll.
Updating Qt5Widgets.dll.
Updating libGLESV2.dll.
Updating libEGL.dll.
Updating D3Dcompiler_43.dll.
Updating opengl32sw.dll.
Patching Qt5Core.dll...
Creating directory F:/QT/work/build-hello-Desktop_Qt_5_8_0_MinGW_32bit-Release/pack/iconengines.
Updating qsvgicon.dll.
Creating directory F:/QT/work/build-hello-Desktop_Qt_5_8_0_MinGW_32bit-Release/pack/imageformats.
Updating qgif.dll.
Updating qicns.dll.
Updating qico.dll.
Updating qjpeg.dll.
Updating qsvg.dll.
Updating qtga.dll.
Updating qtiff.dll.
Updating qwbmp.dll.

依赖关系自动解决