<!--toc-->
|
|
## Introduction
|
|
There are several important differences between Windows and POSIX operating systems that may effect the way you work.
|
|
1. Using DLL instead of ELF shared objects
|
2. Debug and Release versions for MSVC
|
|
## Using DLLs
|
|
First of all I strongly recommend using CppCMS as DLL instead of static libraries:
|
|
1. It allows you to use dynamic loadable views
|
2. It allows you to switch CppCMS's dll version without recompiling the application, for example due to security update.
|
3. It makes it easier to handle dependencies as for example you should not link manually with zlib, pcre and optional openssl or ICU.
|
|
|
## Compilation
|
|
When you compile your program to use DLL you must add `DLL_EXPORT` define at your project level. Such that the
|
code would be compiled with this define.
|
|
It should be defined for _all_ source files _including_
|
dynamically loadable views.
|
|
When you are using Visual C++ compiler make sure
|
you are using have "Enable C++ Exceptions" set `/EHsc`
|
command line argument.
|
|
cl /EHsc -DDLL_EXPORT app.cpp cppcms.lib booster.lib
|
|
|
## Libraries naming convention
|
|
By default, both static libraries and DLL's with import
|
libraries are built, they have following naming
|
conversion:
|
|
GCC/MinGW:
|
|
- `libcppcms.dll` and `libbooster.dll` - the DLLs
|
- `libcppcms.dll.a` and `libbooster.dll.a` - import library for the DLs.
|
- `libcppcms.a` and `libbooster.a` - static libraries
|
|
MSVC:
|
|
- Release versions
|
|
- `cppcms.dll` and `booster.dll` - the DLLs
|
- `cppcms.lib` and `booster.lib` - import library for the DLLs.
|
- `libcppcms.lib` and `libbooster.lib` - static libraries
|
|
- Debug versions
|
|
- `cppcms-d.dll` and `booster-d.dll` - the DLLs
|
- `cppcms-d.lib` and `booster-d.lib` - import library for the DLs.
|
- `libcppcms-d.lib` and `libbooster-d.lib` - static libraries
|
|
Cygwin:
|
|
- `cygcppcms-1.dll` and `cygbooster-0.dll` - the DLLs
|
- `libcppcms.dll.a` and `libbooster.dll.a` - import library for the DLLs.
|
- `libcppcms.a` and `libbooster.a` - static libraries
|
|
Make sure you:
|
|
- Do not mix static and import libraries
|
- Do not mix debug and release libraries when using Visual C++ compiler.
|
|
## Building and using CppCMS under Visual Studio
|
|
Visual Studio is the only existing compiler that has
|
incompatible debug and release runtime libraries and
|
require separate compilation and linking of them.
|
|
So in order to build CppCMS correctly make sure
|
|
- You use nmake files CMake generator and do not use Visual Studio Projects
|
- You have all dependent libraries (icu, zlib, pcre, openssl) built with appropriate debug or release version.
|
- Run two independent compilations one for debug and one for release.
|
|
My personal recommendation is to create a set of debug
|
and a set of release libraries in some location, let's
|
say:
|
|
c:\apps\debug
|
c:\apps\debug\include
|
c:\apps\debug\lib
|
c:\apps\debug\bin
|
|
With all debug versions of libraries like pcre, zlib and so on, for example `c:\apps\debug\bin\pcred.dll`
|
|
And the same for release:
|
|
c:\apps\release
|
c:\apps\release\include
|
c:\apps\release\lib
|
c:\apps\release\bin
|
|
|
Such that the pcre.dll goes to `c:\apps\release\bin\pcre.dll`
|
|
And then run two separate builds:
|
|
For debug, open terminal and run:
|
|
cd z:\mybuilds\cppcms-1.0.1\
|
mkdir Debug
|
cd Debug
|
set PATH=c:\apps\debug\bin;%PATH%
|
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug
|
-DCMAKE_INCLUDE_PATH=c:/apps/debug/include
|
-DCMAKE_LIBRARY_PATH=c:/apps/debug/lib
|
-DCMAKE_INSTALL_PREFIX=c:/apps/debug
|
..
|
nmake
|
nmake test
|
nmake install
|
|
Then do the same for release, open **separate** terminal
|
and run:
|
|
cd z:\mybuilds\cppcms-1.0.1\
|
mkdir Release
|
cd Release
|
set PATH=c:\apps\release\bin;%PATH%
|
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release
|
-DCMAKE_INCLUDE_PATH=c:/apps/release/include
|
-DCMAKE_LIBRARY_PATH=c:/apps/release/lib
|
-DCMAKE_INSTALL_PREFIX=c:/apps/release
|
..
|
nmake
|
nmake test
|
nmake install
|
|
This would make the life much simpler for you. |
This would make the life much simpler for you.
|
|
---
|
|
← [Troubleshooting][prev]
|
| [Top](#maincontent)
|
| [Hello World][next] →
|
|
[prev]: /wikipp/en/page/ccppcms_1x_build_troubleshooting
|
[next]: /wikipp/en/page/cppcms_1x_tut_hello |