1 下载

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

2 打开工具

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

3 编译zlib

1
2
3
4
5
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

1
2
3
4
5
6
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 命令可能会生成一些警告。

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

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

参考:

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.