## Introduction
|
|
In general build on Windows using Microsoft Visual Studio is quite complex due to several factors:
|
|
1. Lack of easily accessible already build libraries in both debug and release variants for your MSVC version
|
2. Need of strict debug/release separation
|
|
|
So in order to make your life while building CppCMS simpler I suggest following rules:
|
|
1. Keep strict separation of debug and release installations and 32/64 bit architectures, for example
|
|
c:\cppcms_deps\x64\Debug
|
c:\cppcms_deps\x64\Release
|
c:\cppcms_deps\x86\Debug
|
c:\cppcms_deps\x86\Release
|
|
Note: pcre, icu and zlib support debug/release mangling of the libraries/dlls for debug/release flavor, but OpenSSL does not. So I strongly recommend to use separate trees to ensure safety.
|
|
2. When building with CMake always use "NMake Makefiles" generator to prevent collisions of debug/release methods
|
3. Start from basic dependencies zlib and pcre that can be built using CMake than go with more complex ones like OpenSSL and ICU if needed.
|
|
## Basic Dependencies:
|
|
1. Install CMake, make sure it is in global path
|
2. Install Python 2.x version, make sure it is in global path
|
3. Optionally install git if you want to build upstream branches.
|
|
|
### Building PCRE
|
|
PCRE comes with CMake build system, however building it correctly may be somewhat tricky.
|
|
Download the latest version of PCRE 8.x. Do not use PCRE2, it isn't supported.
|
|
Important options to note:
|
|
1. Build Shared version of PCRE (i.e. dll) `-DBUILD_SHARED_LIBS=ON`
|
2. Make sure you put `-DPCRE_SUPPORT_UNICODE_PROPERTIES=ON` option on to enable utf-8 support
|
|
Step by step:
|
|
Open Visual studio command prompt, for example `x64 Native Tools Command Prompt for VS 2017` or `x86 Native Tools Command Prompt for VS 2017` and change directory to location of PCRE sources. Create build directory and run the commands:
|
|
For example for x64 release build
|
|
mkdir msvc-release-x64
|
cd msvc-release-x64
|
cmake -DBUILD_SHARED_LIBS=ON -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=c:\cppcms_deps\x64\Release ..
|
nmake
|
nmake install
|
cd ..
|
|
Debug
|
|
mkdir msvc-debug-x64
|
cd msvc-debug-x64
|
cmake -DBUILD_SHARED_LIBS=ON -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=c:\cppcms_deps\x64\Debug ..
|
nmake
|
nmake install
|
cd ..
|
|
|