Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
208 views
in Technique[技术] by (71.8m points)

c++ - libzip with Visual Studio 2010

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Edit:

Before starting on the answer provided here, it appears that this may no longer be an issue going by @Thomas Klausner's answer below.


The following should get you a VS10 solution:

  1. If you've not already done so, install CMake

  2. 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.

    • 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()
      

      to the end of C:develzlib-1.2.7CMakeLists.txt

  3. Download and extract libzip to e.g. C:devel

  4. In a VS10 command prompt, cd C:develzlib-1.2.7

  5. mkdir build && cd build

  6. cmake .. -G"Visual Studio 10" -DCMAKE_INSTALL_PREFIX="C:develinstalledzlib" This sets the install path to C:develinstalledzlib rather than the default C:Program Fileszlib. For 64-bit Windows, use "Visual Studio 10 Win64" as the -G parameter.

  7. msbuild /P:Configuration=Debug INSTALL.vcxproj

  8. msbuild /P:Configuration=Release INSTALL.vcxproj

  9. cd C:devellibzip-0.10.1

  10. mkdir build && cd build

  11. cmake .. -G"Visual Studio 10" -DCMAKE_PREFIX_PATH="C:develinstalledzlib" 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.

This should result in C:devellibzip-0.10.1uildlibzip.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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...