一、环境依赖
1.Git
2.Visual Studio Community 2019
3.Qt 5.x
4.Python 3.9
5.CMake
6.Windows Openssl
7.NSIS
8.Nuget
二、源码下载
1.clone源码
git clone https://github.com/uglide/RedisDesktopManager.git
2.进入RedisDesktopManager目录,切换到发布tag
git checkout -b 2022.1_release 2022.1
3.下载依赖仓库代码
git submodule update --init --recursive
4.适配windows
#进入3rdparty/qredisclient/3rdparty/hiredis目录
git apply ../hiredis-win.patch
5.下载nuget依赖
#在3rdparty/目录下
nuget install zlib-msvc14-x64 -Version 1.2.11.7795
三、修改代码
1.修改源代码版本号
#源文件src\resp.pro
!defined(VERSION, var) {
VERSION=2022.1.0
}
2.修改发布包版本号
#源文件build\windows\installer\installer.nsi
#在头部增加
!define VERSION "2022.1.0"
3.修改openssl依赖
#源文件3rdparty\3rdparty.pri的18行
OPENSSL_LIB_PATH = {{OpenSsl安装目录}}\lib\VC
4.修改python依赖
#源文件3rdparty\pyotherside.pri的3~9行
PY_VERSION="39"
PY_WIN_VERSION="3.9.x" //根据实际子版本号修改
PY_LIB_SUFFIX="3.9"
QMAKE_LIBS += -L{{Python安装目录}}\Python$${PY_WIN_VERSION}\libs -lpython$${PY_VERSION}
INCLUDEPATH += {{Python安装目录}}\Python$${PY_WIN_VERSION}\include\
四、编译源代码
1.编译brotli模块
#3rdparty\brotli目录下
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed .
cmake --build . --config Release
2.编译snappy模块
#3rdparty\snappy目录下
cmake .
cmake --build . --config Release
3.编译lz4模块
#3rdparty\lz4\build\cmake目录下
cmake -DLZ4_BUNDLED_MODE=ON .
cmake --build . --config Release
4.编译zstd模块
#3rdparty\zstd\build\cmake目录下
cmake -DCMAKE_BUILD_TYPE=Release .
cmake --build . --config Release
5.Qt编译
使用QtCreator打开src/resp.pro
配置项目为Release、去除debug信息
Ctrl+B构建项目
成功后在bin\windows\release生成resp.exe文件
五、打包发布
1.拷贝编译exe
将bin\windows\release\resp.exe拷贝到build\windows\installer\resources目录下
2.处理Qt依赖
在build\windows\installer\resources目录下执行windeployqt命令
"{{Qt安装目录}}\{{Qt版本号}}\msvc2019_64\bin\windeployqt.exe" --no-angle --no-opengl-sw --no-compiler-runtime --no-translations --release --force --qmldir {{RESP源代码目录}}\src\qml resp.exe
3.处理python依赖
拷贝python-3.9.x-embed-amd64发行包中的python39.dll、python39.zip到build\windows\installer\resources目录
4.使用NSIS打包
使用NSIS打开build\windows\installer\installer.nsi生成安装包
最后在build\windows\installer目录生成resp-2022.1.0.exe文件
感谢
感谢您的阅读,最后附上打包好的共享链接:
链接:https://download.youkuaiyun.com/download/w949413/89280893