How to build CppCMS 1.x.x

简介: How to build CppCMS 1.x.x Requirements Mandatory Requirements Recommended Dependencies Suggested Dependencies for Common Linux Distributions ...

How to build CppCMS 1.x.x

Requirements

In order to build CppCMS you need:

Mandatory Requirements

  • Modern C++ Compiler -- GCC, MSVC 9, Intel. See supported compilers and platforms
  • CMake 2.6 and above, 2.8.x is recommended.
  • Zlib library
  • PCRE library.
  • Python >=2.4 (but not 3)

Recommended Dependencies

  • ICU Library 3.6 and above -- support of advanced localization features.
  • gcrypt or OpenSSL library -- for support of encrypted session cookies.

    If both available gcrypt would be used.

Suggested

  • iconv library (if libc does not provide iconv interface)

Dependencies for Common Linux Distributions

Debian Based (Debian, Ubuntu):

Packages: cmake libpcre3-dev zlib1g-dev libgcrypt11-dev libicu-dev python

Getting:

  1. aptitude install cmake libpcre3-dev zlib1g-dev libgcrypt11-dev libicu-dev python  

RPM Based (RadHat, CentOS, Fedora, Suse):

Packages: cmake gcc-c++ gcc make zlib-devel pcre-devel libicu-devel libgcrypt-devel

Getting:

  1. yum install cmake gcc-c++ gcc make zlib-devel pcre-devel libicu-devel libgcrypt-devel  

Notes for Microsoft Visual C++ users

Building cppcms with Visual Studio projects is not supported due to complexity of debug and release mode.

You should use nmake as shown in the example.

Getting The Sources

Download the latest cppcms-1.x.x.tar.bz2 from sourceforge and extract it:

  1. tar -xjf cppcms-1.0.4.tar.bz2  

If you want to get latest version You need git to get the sources:

  1. git clone https://github.com/artyom-beilis/cppcms.git cppcms    

Build Process

Go to the cppcms directory you created and create build directory and go to it:

  1. mkdir build  
  2. cd build  

Now configure the library with CMake

  1. cmake ..  

Or

  1. cmake various_build_options ..  

Then run

  1. make  
  2. make test  
  3. make install  

Build Options

  • -DDISABLE_STATIC=ON -- disable building of static version of cppcms library
  • -DDISABLE_SHARED=ON -- disable building of shared version of cppcms library
  • -DDISABLE_ICONV=ON -- disable usage of iconv (ICU would be used instead)
  • -DDISABLE_GCRYPT=ON -- disable usage of gcrypt library.
  • -DDISABLE_OPENSSL=ON -- disable usage of OpenSSL.
  • -DUSE_WINDOWS6_API=ON -- use Windows Vista, Windows 7 API if possible, allows CppCMS using native Windows Vista/7 conditional variables and other advanced API. By default disabled.
  • -DLIBDIR=lib64 - use alternative name for library directory, for example use lib64 on Red Hat based distributions.

Generic Size Optimization Options for Embedded Builds:

  • -DDISABLE_FCGI=ON -- build without FastCGI Server API.
  • -DDISABLE_SCGI=ON -- build without SCGI Server API.
  • -DDISABLE_HTTP=ON -- build without internal HTTP server.
  • -DDISABLE_ICU_LOCALE=ON -- do not use ICU for localization but rather C++ std::locale, Windows API or POSIX API based localization -- many localization features would not be available, but it may be useful for embedded builds.
  • -DDISABLE_PREFORK_CACHE=ON - disable cache support for preforking modes (process shared cache)
  • -DDISABLE_TCPCACHE=ON - disable distributed cache support (memcached-like solution support)
  • -DDISABLE_CACHE=ON - disable caching system at all.
  • -DDISABLE_GZIP=ON - disable output gzip compression support (eliminates dependency on zlib)

Generic useful CMake options:

  • -DCMAKE_BUILD_TYPE=(Debug|Release|RelWithDebInfo|MinSizeRel) -- release type. RelWithDebInfo is default, unless using MSVC where Debug is default.

  • -DCMAKE_INCLUDE_PATH=/path/to/include -- path to location of libraries headers, provide it in order to find libraries headers installed in non-standard locations. You almost always need to provide it under Windows.

  • -DCMAKE_LIBRARY_PATH=/path/to/lib -- path to location of libraries, provide it in order to find libraries installed in non-standard locations. You almost always need to provide it under Windows.
  • -DCMAKE_INSTALL_PREFIX=/usr/local -- Installation prefix (similar to autoconf --prefix). Defaults to /usr/local

Examples

POSIX Operating Systems

I assume that you are in a terminal in the build directory inside the CppCMS source directory.

Build under Linux, FreeBSD and Cygwin:

  1. cmake ..  
  2. make  
  3. make test   
  4. make install  

Build under OpenSolaris with SunStudio

  1. cmake -DCMAKE_C_COMPILER=/usr/bin/suncc -DCMAKE_CXX_COMPILER=/usr/bin/sunCC ..  
  2. make  
  3. make test   
  4. make install  

Build under OpenSolaris with GCC, where ICU installed in /opt/icu

  1. cmake -DCMAKE_INCLUDE_PATH=/opt/icu/include -DCMAKE_LIBRARY_PATH=/opt/icu/lib ..  
  2. make  
  3. make test   
  4. make install  

Microsoft Windows

We assume that 3rd part libraries installed in c:\3rd_part and sources are placed ind:\projects\cppcms

Note: You need to setup correct PATH variables in order to let system find all DLLs it needs.

Under cmd.exe:

  1. set PATH=c:\3rd_part\lib;%PATH%  
  2. set PATH=d:\projects\cppcms\build\booster;%PATH%   

Under bash:

  1. export PATH=/c/3rd_part/lib:"$PATH"  
  2. export PATH=/d/projects/cppcms/build/booster:"$PATH"  

MinGW Builds:

For mingw builds you also need to pass a path to the mingw's library directory, otherwise it may not find winsock library correctly. Assuming you have mingw installed in c:\mingw

Open MinGW Shell terminal

  1. cmake -G "MSYS Makefiles" -DCMAKE_INCLUDE_PATH=c:/3rd_part/include -DCMAKE_LIBRARY_PATH="c:/3rd_part/lib;c:/mingw/lib" -DCMAKE_INSTALL_PREFIX=c:/mingw ..  
  2. make  
  3. make test   
  4. make install  

MSVC Builds:

Open MSVC Shell terminal (All Programs > Microsoft Visual Studio 2008 > Visual Studio Tools > Visual Studio 2008 Command Prompt)

  1. cmake -G "NMake Makefiles" -DCMAKE_INCLUDE_PATH=c:/3rd_part/include -DCMAKE_LIBRARY_PATH=c:/3rd_part/lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=c:/cppcms ..  
  2. nmake  
  3. nmake test   
  4. nmake install  

Cross Compiling

The build is just ordinary CMake cross-compilation procedure. For more information readhttp://www.cmake.org/Wiki/CMake_Cross_Compiling

We would provide an example for ARM under Linux, without ICU.

Create ToolChain.cmake

  1. SET(CMAKE_SYSTEM_NAME Linux)  
  2. SET(CMAKE_C_COMPILER  /usr/bin/arm-linux-gnueabi-gcc)  
  3. SET(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabi-g++)  
  4. SET(CMAKE_FIND_ROOT_PATH  /usr/arm-linux-gnueabi)  
  5. SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)  
  6. SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)  
  7. SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)  

Configure

  1. cmake -DCMAKE_TOOLCHAIN_FILE=ToolChain.cmake -DDISABLE_ICU_LOCALIZATION=ON  -DCMAKE_ISTALL_PREFIX=/usr/arm-linux-eabi ..  
  2. make  
  3. make install  
目录
相关文章
|
Java Android开发 程序员
build.gradle中buildTypes和productFlavors详解
用过AS的程序猿都知道build.gradle文件的作用,但我仍坚信还是有很多猿友不知道build.gradle文件中的一些代码的意思到底是什么? 这里来说下buildTypes和productFlavors的作用,顺便会说下其他一些配置。
1619 0
|
6月前
|
缓存 Java API
build.gradle文件介绍,gradle版本对应
build.gradle文件介绍,gradle版本对应
172 0
|
Java Maven
maven install时报错The packaging for this project did not assign a file to the build artifact
maven install时报错The packaging for this project did not assign a file to the build artifact
6729 0
|
前端开发 Java Maven
Gradle build.gradle 文件
Gradle build.gradle 文件
Gradle build.gradle 文件
|
Android开发
Migrate Project to Gradle? This project does not use the Gradle build system
Migrate Project to Gradle? This project does not use the Gradle build system
102 0
|
jenkins 持续交付 开发工具
|
API
Gradle Build Lifecycle
我们之前说过,Gradle 的核心是一种基于依赖性编程的语言。 在 Gradle 术语中,这意味着您可以定义任务和任务之间的依赖关系。 Gradle 保证这些任务按照其依赖项的顺序执行,并且每个任务只执行一次。 这些任务形成了一个有向无环图。 有一些构建工具可以在执行任务时建立这样的依赖关系图。 在执行任何任务之前,Gradle 构建完整的依赖关系图。 这位于 Gradle 的心脏地带,使许多事情成为可能,否则这些事情是不可能实现的。
124 0
|
XML 存储 Java
maven clean/install/build/package命令行详解(上)
maven clean/install/build/package命令行详解(上)
768 0
maven clean/install/build/package命令行详解(上)
|
缓存 IDE Java
maven clean/install/build/package命令行详解(下)
maven clean/install/build/package命令行详解(下)
530 0
maven clean/install/build/package命令行详解(下)
|
XML 存储 Java
maven clean/install/build/package命令行详解(中)
maven clean/install/build/package命令行详解(中)
168 0
maven clean/install/build/package命令行详解(中)