oatpp / oatpp-zlib

Module oatpp-zlib provides functionality for compressing/decompressing content with deflate and gzip. Supports both "Simple" and "Async" oatpp APIs.

Home Page:https://oatpp.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows Install `oatpp-zlib`

lganzzzo opened this issue · comments

By @AlexandreHURDYK

I think I've successfully managed to compile oatpp-zlib for windows. Here's the procedure :

You will need the following files :

  • zlib.h
  • zconf.h
  • zlib.lib
  • oatpp must be compiled and installed on your computer.

Steps :

  • Create a folder containing all your zlib components.

  • Open a console in administrator mode. This is very important, otherwise you won't be able to compile anything.

  • Clone the repo : $ git clone https://github.com/oatpp/oatpp-zlib.git

  • Enter the directory : $ cd oatpp-zlib

  • Create the build directory : $ mkdir build

  • Go inside that directory : $ cd build

  • Execute the following command :

    $ cmake .. -DZLIB_INCLUDE_DIR=PATH\TO\zlib\INCLUDES -DZLIB_LIBRARY=PATH\TO\zlib.lib
    

    Mind the -DZLIB_LIBRARY argument ! You need to literally make it point to your zlib.lib file (ex : C:/path/to/zlib/zlib.lib).
    Otherwise, you will get compilation errors.

    Another compilation error I personally encountered is due to a missing "unistd.h" library. The thing is, unistd.h is a Linux library
    and you're not supposed to be able to use it on windows (though some compilers seem to have a built in version of unistd.h for
    windows). If you get compilation errors related to unistd.h, you may have to edit zconf.h :
    --> Find the following three lines (I've personally found them starting from line 434 in the zconf.h file) :

    #if 1 
    #  define Z_HAVE_UNISTD_H
    #endif

    --> Comment them. This should prevent unistd from being used. I recommend saving your precedent version of zconf.h before
    doing something like this.

  • FINAL STEP : perform the following command depending which kind of application you want to run :
    --> For a debug application : $ cmake --build . --target INSTALL
    --> For a release application : $ cmake --build . --target INSTALL --config Release

If at this point you get mismatch errors, it means your oatpp installation directory doesn't match the compilation mode of your library : you will need to re-compile oatpp with a compilation mode matching the one you chose for the oatpp-zlib module (debug for debug, release for release).
Small reminder about how to compile oatpp :

$ git clone https://github.com/oatpp/oatpp.git
$ cd oatpp\
$ MD build
$ cd build\

$ cmake ..
//For a debug app :
$ cmake --build . --target INSTALL 
//For a release app :
$ cmake --build . --target INSTALL --config Release