Windows10+QT5.15+VS2019编译并打包RedisDesktopManager

使用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

源码编译

  1. 下载源码
git clone --recursive https://github.com/uglide/RedisDesktopManager.git
  1. 进入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
  1. 进入3rdparty/qredisclient/3rdparty目录
cd qredisclient/3rdparty
git clone --recursive https://github.com/benlau/asyncfuture.git
git clone --recursive https://github.com/redis/hiredis.git
  1. 进入3rdparty/qredisclient/3rdparty/hiredis目录,应用补丁来修复编译
cd hiredis
git apply ../hiredis-win.patch
  1. 进入RedisDesktopManager/3rdparty/lz4/build/cmake目录打开cmd窗口,构建lz4 lib
C:\Qt\Tools\CMake_64\bin\cmake -DLZ4_BUNDLED_MODE=ON  .
  1. 用Visual Studio 2019打开LZ4.sln,选择Release并编译 在这里插入图片描述
  2. 进入RedisDesktopManager根目录打开cmd窗口执行
pip3 install -r src/py/requirements.txt
  1. 使用Qt Creator 打开 ./src/rdm.pro,选择 Desktop Qt 5.15.x MSVC2019 64bit > Release build profile.
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

  2. 修改pyotherside.pri中python路径为本地python路径
    在这里插入图片描述

  3. 可以在src/rdm.pro文件中修改项目版本号在这里插入图片描述

  4. 编译之前先更新翻译(lupdate)->发布翻译(lrelease), 如果只用英文界面的话这步可忽略
    在这里插入图片描述

  5. 点Qt界面左下角图标是锤子的按钮进行构建, 右下角就会弹出构建的进度, 显示绿色为构建完成,可以忽略其中的4个错误
    在这里插入图片描述

  6. 点击绿色的运行小箭头,此时会开始编译项目,等待片刻,会弹出如下界面,即表示编译成功
    在这里插入图片描述
    在这里插入图片描述

  7. 编译好后进入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
  1. 至此双击打开 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各版本的官方链接

Windows10+QT5.9+VS2017编译并打包RedisDesktopManager

源码编译Redis Desktop Manager参考

Redis Desktop Manager 2020.2 Windows 源码编译

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

趙妏斌

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值