使用RedisDesktopManager环境
安装Microsoft Visual C++ 2015-2019 x64
软件安装
先看官方编译步骤: https://docs.resp.app/en/latest/install/注意Qt和Python的需要版本
Visual Studio安装
Visual Studio下载地址:https://visualstudio.microsoft.com/zh-hans/downloads/
勾选c++开发即可,使用默认安装选项,其中包含了CMake和win10 SDK
QT安装
QT下载地址:https://www.qt.io/download-qt-installer
勾选: MSVC 2019 64-bit 和 Qt Charts,安装目录:C:\Qt
安装Python 3.9
Python 3.9下载地址:https://www.python.org/downloads/
Python3运行库:https://www.python.org/downloads/windows/ 下载选择embeddable zip, 发给别人运行时需要该运行库
勾选: Add Python 3.9 to PATH 和 Download debug bnaries (requires Vs 2017 or later) 安装目录:C:\Python39-x64
安装Git
Git下载地址:https://git-scm.com/downloads
下载Nuget
Nuget下载地址:https://www.nuget.org/downloads
源码编译
- 下载源码
git clone --recursive https://github.com/uglide/RedisDesktopManager.git
- 进入RedisDesktopManager根目录打开cmd窗口,进入3rdparty,复制nuget到3rdparty,查看lz4、pyotherside、qredisclient下是否有项目文件,没有执行git拉取
cd 3rdparty
nuget install zlib-msvc14-x64 -Version 1.2.11.7795
git clone --recursive https://github.com/lz4/lz4.git
git clone --recursive https://github.com/uglide/pyotherside.git
git clone --recursive https://github.com/uglide/qredisclient.git
- 进入3rdparty/qredisclient/3rdparty目录
cd qredisclient/3rdparty
git clone --recursive https://github.com/benlau/asyncfuture.git
git clone --recursive https://github.com/redis/hiredis.git
- 进入3rdparty/qredisclient/3rdparty/hiredis目录,应用补丁来修复编译
cd hiredis
git apply ../hiredis-win.patch
- 进入RedisDesktopManager/3rdparty/lz4/build/cmake目录打开cmd窗口,构建lz4 lib
C:\Qt\Tools\CMake_64\bin\cmake -DLZ4_BUNDLED_MODE=ON .
- 用Visual Studio 2019打开LZ4.sln,选择Release并编译
- 进入RedisDesktopManager根目录打开cmd窗口执行
pip3 install -r src/py/requirements.txt
-
使用Qt Creator 打开 ./src/rdm.pro,选择 Desktop Qt 5.15.x MSVC2019 64bit > Release build profile.
-
修改pyotherside.pri中python路径为本地python路径
-
可以在src/rdm.pro文件中修改项目版本号
-
编译之前先更新翻译(lupdate)->发布翻译(lrelease), 如果只用英文界面的话这步可忽略
-
点Qt界面左下角图标是锤子的按钮进行构建, 右下角就会弹出构建的进度, 显示绿色为构建完成,可以忽略其中的4个错误
-
点击绿色的运行小箭头,此时会开始编译项目,等待片刻,会弹出如下界面,即表示编译成功
-
编译好后进入RedisDesktopManager/bin/windows/release目录将 rdm.exe 文件复制到RedisDesktopManager/build/windows/installer/resources目录中,在RedisDesktopManager/build/windows/installer/resources目录中编写 并执行start.bat 脚本文件, 内容
# 执行依赖库引入
# 注意: 命令中的windeployqt是一个exe程序, 该程序的目录需要按实际Qt的安装位置修改, \src\qml目录也是按源码解压时所在位置的绝对路径修改
C:\Qt\5.15.0\msvc2019_64\bin\windeployqt --no-angle --no-opengl-sw --no-compiler-runtime --no-translations --release --force --qmldir C:\RedisDesktopManager\src\qml rdm.exe
# 删除一些不必要的文件
rmdir /S /Q .\qmltooling
rmdir /S /Q .\QtGraphicalEffects
del /Q .\imageformats\qtiff.dll
del /Q .\imageformats\qwebp.dll
- 至此双击打开 rdm.exe 程序应该是可以看到界面的了, 但发给别人就会出现缺少python39.dll, 因为自己安装python39环境而别人没有, 所以还需要用到下载好的 python-3.9.x-embed-amd64.zip 包将里边的 python39.dll 和 python39.zip 复制到RedisDesktopManager/build/windows/installer/resources目录中
参考资料
Visual C++ Redistributable for Visual Studio各版本的官方链接