1.创建.bat文件,方便后续使用
@echo off
rem qtPath为windeployqt.exe路径,需根据安装版本平台修改 5.14 vs2017 64默认路径:C:\Qt\Qt5.14.0\5.14.0\msvc2017_64\bin
set qtPath=F:\Qt\Qt5.14.0\5.14.0\msvc2017_64\bin\
echo windeployqt.exe path:%qtPath%
rem BinPath为打包路径
set BinPath=F:\Qt\Qt_SendOut\Release\
echo pack path:%BinPath%
rem ExeName打包的exe名称
set ExeName=LabelMe_mtgh.exe
echo ExeName:%ExeName%
rem oldExePath为qt编译后的路径
set oldExePath=F:\Qt\GitHub\LabelMe_mtgh\trunk\build-LabelMe_mtgh-Desktop_Qt_5_14_0_MSVC2017_64bit-Release\release\
echo oldExe path:%oldExePath%
rem QmlPath为程序qml文件路径(windeployqt.exe 会根据qml的import打包所需的qml文件)
set QmlPath=F:\Qt\GitHub\LabelMe_mtgh\trunk\src
echo qml file path:%QmlPath%
rem 删除之前打包文件
if exist %BinPath% rd /s/q %BinPath%
md %BinPath%
rem 拷贝新exe至打包路径
set oldExe=%oldExePath%%ExeName%
echo %oldExe%
set newExe=%BinPath%%ExeName%
echo %newExe%
copy %oldExe% %newExe%
rem 切换盘符
%qtPath:~0,2%
cd %qtPath%
rem 打包
windeployqt.exe %newExe% --qmldir %QmlPath%
pause
Qt_pack.bat下载
2.运行bat文件,完成打包,测试
测试