libzip与Visual Studio 2010 [英] libzip with Visual Studio 2010
问题描述
有没有为Visual Studio 2010编译libzip的文档?我从libzip网站和Google看到的一切都没有返回任何结果。
Is there anyway documentation for compiling libzip for Visual Studio 2010? Everything I have seen from the libzip website and Google has returned no results.
推荐答案
编辑:
在开始这里提供的答案之前,似乎这可能不再是@Thomas Klausner的
Before starting on the answer provided here, it appears that this may no longer be an issue going by @Thomas Klausner's answer below.
以下内容应提供VS10解决方案:
The following should get you a VS10 solution:
-
如果您尚未安装,请安装 CMake
下载并解压缩 zlib 到例如 C:\devel
。下载链接大约在首页的中间。目前提供zlib版本1.2.7。
Download and extract zlib to e.g. C:\devel
. The download links are about halfway down the homepage. Currently this provides zlib version 1.2.7.
-
要解决此CMake错误仅影响64位Windows,添加
To work around this CMake bug which affects 64-bit Windows only, add
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND MSVC)
set_target_properties(zlibstatic PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
endif()
到C:\devel\zlib-1.2.7\CMakeLists.txt的结尾
to the end of C:\devel\zlib-1.2.7\CMakeLists.txt
下载并解压缩 libzip 至例如 C:\devel
在 VS10命令提示符 code> cd C:\devel\zlib-1.2.7
In a VS10 command prompt, cd C:\devel\zlib-1.2.7
mkdir建设&& cd build
mkdir build && cd build
cmake .. -GVisual Studio 10-DCMAKE_INSTALL_PREFIX =C: \\devel\installed\zlib
这会将安装路径设置为 C:\devel\installed\zlib
,而不是默认 C:\Program Files\zlib
。对于64位Windows,使用Visual Studio 10 Win64
作为 -G
参数。
cmake .. -G"Visual Studio 10" -DCMAKE_INSTALL_PREFIX="C:\devel\installed\zlib"
This sets the install path to C:\devel\installed\zlib
rather than the default C:\Program Files\zlib
. For 64-bit Windows, use "Visual Studio 10 Win64"
as the -G
parameter.
msbuild / P:Configuration = Debug INSTALL.vcxproj
msbuild / P:Configuration = Release INSTALL.vcxproj
cd C:\devel\libzip-0.10.1
cd C:\devel\libzip-0.10.1
mkdir build&&& ; cd build
mkdir build && cd build
cmake .. -GVisual Studio 10-DCMAKE_PREFIX_PATH =C: \\devel\installed\zlib
将路径设置为您安装zlib的位置,以便CMake可以找到zlib的include文件和lib。同样,对于64位Windows,使用Visual Studio 10 Win64
作为 -G
参数。 >
cmake .. -G"Visual Studio 10" -DCMAKE_PREFIX_PATH="C:\devel\installed\zlib"
Set the path to wherever you installed zlib so that CMake can find zlib's include files and libs. Again, for 64-bit Windows, use "Visual Studio 10 Win64"
as the -G
parameter.
这将导致 C:\devel\libzip-0.10.1\build\\ \\ libzip.sln
。它看起来像在代码中有一些POSIX特定的问题,但他们应该希望是相当容易解决(例如在zipconf.h #include< inttypes.h>
需要替换为 #include< stdint.h>
;有一些 snprintf
c $ c> _snprintf )。
This should result in C:\devel\libzip-0.10.1\build\libzip.sln
. It looks like there are a few POSIX-specific problems in the code, but they should hopefully be fairly easy to resolve (e.g. in zipconf.h #include <inttypes.h>
needs replaced with #include <stdint.h>
; there are some snprintf
calls needing replaced e.g. with _snprintf
).
这篇关于libzip与Visual Studio 2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!