windows编译libzip vs2017

7 篇文章 0 订阅

原创文章禁止转载 同步发布http://www.alom.com.cn/

1 下载

libzip-1.8.0
zlib-1.2.11
解压到H:\devel(自定义)

2 打开工具

打开vs 2017的开发人员命令提示符
在这里插入图片描述

3 编译zlib

cd devel\zlib-1.2.11
mkdir build
cd build
cmake .. -G"Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX="h:\include\zlib-vs17"
msbuild /P:Configuration=Release INSTALL.vcxproj

注意:正常情况下不会出错。如果之前使用了别的方法编译。应当删除整个目录,重新解压代码。

4 编译libzip

cd devel\liblzma-4.27.1
mkdir build
cd build
cmake .. -G"Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX="h:\include\zlib-vs17"
msbuild libzip.sln /t:zip /P:Configuration=Release
cmake -DBUILD_TYPE=Release -P cmake_install.cmake

上面的 MSBuild 命令可能会生成一些警告。

CMake Error at src/cmake_install.cmake:34 (file):
  file INSTALL cannot find "C:/libzip/build/src/Release/zipcmp.exe".

可忽略 - 所有必需的二进制文件应该已经在h:\include\zlib-vs17

链接

http://alom.com.cn/20220315/deploy/2022-03-15-windows%E7%BC%96%E8%AF%91libzip%20vs2017/

参考:

https://docs.microsoft.com/en-us/cognitive-toolkit/archive/setup-buildzlib-vs15#:~:text=There%20are%20two%20ways%20to%20build%20the%20lib%2Flibzip,three%20parameters%20to%20build%20the%20CNTK%20Protobuf%20library.

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
zlib是提供数据压缩用的函式库,由Jean-loup Gailly与Mark Adler所开发,初版0.9版在1995年5月1日发表。zlib使用DEFLATE算法,最初是为libpng函式库所写的,后来普遍为许多软件所使用。此函式库为自由软件,使用zlib授权。截至2007年3月,zlib是包含在Coverity的美国国土安全部赞助者选择继续审查的开源项目。 qlibzip 是基于zlib的一个实用程序库,使用Qt和Windows一些底层API实现,它主要用于将文件夹压缩到一个zip文件,或将一个zip文件解压缩到文件夹。 //------------------------------------------------------------------------------ // Description: Compress files to a ZIP file. // Parameter: sourceFiles Source files, supporting wildcards. // Parameter: destFile The ZIP file path. // Return Value: true/false. //------------------------------------------------------------------------------ extern "C" bool ZipCompress(const QString &sourceFiles, const QString &destFile); //------------------------------------------------------------------------------ // Description: Extract files from a ZIP file. // Parameter: sourceFile Source ZIP file. // Parameter: destFolder The folder to output files. The parent of the // specified folder MUST exist. // Return Value: true/false. //------------------------------------------------------------------------------ extern "C" bool ZipExtract(const QString &sourceFile, const QString &destFolder); //------------------------------------------------------------------------------ // Description: Extract special file from a ZIP file into memory block. // Parameter: sourceFile Source ZIP file. // Parameter: entryName Special entry name in ZIP file. // Return Value: Extracted memory block. //------------------------------------------------------------------------------ extern "C" QByteArray ZipExtractItem(const QString &sourceFile, const QString &entryName); 具体实例请看demo文件夹。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值