Skip to content
Jarle Aase edited this page Jan 7, 2017 · 14 revisions

restc-cpp Documentation

Building

Windows

At the moment, I am only testing with 64 bit builds for Windows. If you really need 32 bit Windows builds, please open an issue. The compiler supported under Windows is Visual Studio 14, Update 3.

Dependencies

For a full build with all the features enabled, you need to provide the following libraries, built for windows.

  • boost libraries
  • zlib
  • openssl

For convenience, I have built these libraries in C:\devel on my machine, and if you use the same directory layout, cmake will pick your libraries automatically. If you use a different structure, you must disable the RESTC_CPP_USE_WIN32_DEFAULTS cmake option and provide the required paths. It may take a little effort, but it will work. Another option if you just want to get started is to disable zlib (RESTC_CPP_WITH_ZLIB) and openssl (RESTC_CPP_WITH_TLS) with the cmake options. Yu still need to provide the boost library.

The directory structure that works 'out of the box' with the projects cmake file is:

C:\devel
  + boost_1_63_0
     + stage
        + x64
           + lib
  + openssl
     + include
       + openssl
     + lib
       + VC
  + zlib-1.2.9
    + build
      + RelWithDebInfo

Microsoft has failed fundamentally in providing a sane environment for 3rd party libraries. As a result, there is no best practice or common way of dealing with this under Windows. While lots and lots of projects depends on boost, zlib and openssl, each developer or team has to download the sources and compile them themselves, and then do the patchwork to make other third party libraries find them. Some projects tries to lessen the burden on developers by embedding their dependencies as git sub-modules or blobs. However, as this may introduce different versions of, say zlib or openssl, in large projects where several libraries does this, I have chosen not to add to the confusion. You have to take responsibility for compiling the latest openssl and zlib (for security reasons), and make sure that restc-cpp finds, uses and links with these libraries. And if you use other libraries in your project that also depends on zlib or openssl, you must make sure that these also use the same zlib and openssl.

Building boost 1.63 on Windows

Download boost
Extract the source code in C:\devel, so that the roor-dir for boost is C:\devel\boost_1_63_0

Open a VS2015 x64 Native Tools Command Prompt.

  cd C:\devel\boost_1_63_0
  bootstrap
  b2 --stagedir=./stage/x64 address-model=64 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=debug
  b2 --stagedir=./stage/x64 address-model=64 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=release

Building restc-cpp and its tests

Open cmake (I use the gui version under Windows), point it to the restc-cpp source code. Tell cmake to use a "dbuild" sub-directory to build the sources. (You can use any sub-directory name you like. However, the scripts I supply for testing, assumes 'dbuild'. Press 'Configure'. Choose 'Visual Studio 14 2015 Win64'. Press 'Finish'. Press 'Generate'. Press on "Open Project", give Visual Studio some time to load the project, and then build the solution. Now you can run the tests that does not require Docker containers.

If you figure out how to run Docker containers under windows, you can run ./create-and-run-containers.sh and then ./tests/run-tests.sh (I run these scripts from the cygwin shell that the windows version of git opens.)

Clone this wiki locally