visual studio 2019编译quazip-1.3

1.编译zlib-1.2.11

zlib-1.2.11下载地址:zlib.net,编译过程如下。

参考仅简单记录编译zlib-1.2.12_LeeDunyann的博客-CSDN博客

2.下载quazip-1.3

下载地址:Releases · stachenov/quazip · GitHub

3.编译quzzip-1.3

编译环境:visual studio 2019 community

qt环境:qt-5.15

1 使用visual studio 2019的命令行工具生成vs工程

打开vs2019的命令行工具:x86 Native Tools Command Prompt for VS 2019,使用其他几个应该也行,没有尝试。

2.切换到quazip-1.3的根目录,根目录内容如下,其中build目录为自己创建的。

 3.vs工程生成

在命令行输入如下命令:

>cmake -S . -B ./build     -D QUAZIP_QT_MAJOR_VERSION=5 -D QUAZIP_USE_QT_ZLIB=ON -A Win32 -D Qt5_DIR=D:\Qt\5.15.2\msvc2019\lib\cmake\Qt5

其中-S:指定源目录  -B:指定构建目录  -D:定义使用的参数:其中Qt5_DIR指定qt5相关的.cmake配置文件;-A:指定架构,这里使用Win32

参考QuaZip: QuaZip - Qt/C++ wrapper for Minizip

uilding, testing and installing

QuaZip uses CMake since 1.0. If you used qmake to build it, you'll have to switch to CMake now, and it's a good thing because two build systems made everything confusing and inconsistent. CMake may be confusing, badly designed and lack good tutorials, but it's the build system at the time of the writing. Some Linux distros are shipped with incredibly outdated CMake versions, but the good news is, there are official self-contained binary distributions, so just grab the newest version, unpack it somewhere, set up PATH (or symlinks) and you're all set. CMake minimum version 3.15 is required to build QuaZip 1.0.

Note

Instructions given in this section assume that you are using some UNIX dialect, but the build process should be very similar on MinGW x32 too. On other platforms it's essentially the same process, maybe with some CMake adjustments not specific to QuaZip itself.

To build the library, run:

$ cd /wherever/quazip/source/is/quazip-x.y.z
$ cmake -S . -B wherever/you/want/your/build/to/be -D QUAZIP_QT_MAJOR_VERSION=4, 5 or 6
$ cmake --build wherever/you/want/your/build/to/be

QUAZIP_QT_MAJOR_VERSION is just one number, and it defaults to 5, so if building with Qt 5, it is optional.

On Windows, it may be required to use -G "MinGW Makefiles" or something like that to convince CMake that you really want to use, say, MinGW and not Visual Studio, for example.

It can be a pain to install zlib on Windows, so there's a possible workaround using zlib bundled into Qt itself. Note that this zlib is Qt's internal implementation detail, so it's more like a dirty hack, but it can be convenient. To enable this feature, configure QuaZip with

-D QUAZIP_USE_QT_ZLIB=ON

命令成功执行后,在build目录生成vs工程

 4.打开vs工程,生成quazip1-qt5.dll及。lib

vs工程设置注意:1.附加库目录添加zlibwapi.lib的所在位置

2.在附加依赖项中增加zlibwapi.lib

3.在预处理器定义中增加ZLIB_WINAPI

到此,即可顺利完成quazip的动态链接库生成。生成库位置:build\quazip\Release

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值