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

How to build CppCMS 1.x.x的更多相关文章

  1. CppCMS1.0.3 Build by VS2012

    1.CppCMS简介 CppCMS是一个C++的Web开发框架(不是一个CMS).它不同于大多数其他Web开发框架,如巨蟒Django , Java的Servlets ,或C++ Wt因为它在设计和调 ...

  2. CPPCMS库在Windows下的使用

    标题:CPPCMS库在Windows下的使用时间:2012-7作者:Kagula 环境:[1]WinXP SP3[2]VisualStudio2008 SP1[3]ZLib 1.2.7[4]PCRE ...

  3. 解决 Springboot Unable to build Hibernate SessionFactory @Column命名不起作用

    问题: Springboot启动报错: Caused by: org.springframework.beans.factory.BeanCreationException: Error creati ...

  4. [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform

    eclipse maven clean install 报错 1. 修改properties-->resource-->utf-8仍然报错 2.修改项目pom.xml文件,增加: < ...

  5. 解决 Could not find com.android.tools.build:gradle 问题

    今天拉同事最新的代码,编译时老是报如下错误: Error:Could not find com.android.tools.build:gradle:2.2.0.Searched in the fol ...

  6. 搭建TFS 2015 Build Agent环境(一)

    Download the build agent Downloading the build agent is really simple. Navigate to your TFS control ...

  7. Go build constraints

    Go语言有一个不(奇)错(葩)的设计,就是build constraints(构建约束).可以在源码中通过注释的方式指定编译选项,比如只允许在linux下,或者在386的平台上编译啊之类的:还可以通过 ...

  8. [异常解决] How to build a gcc toolchain for nRF51 on linux (very detailed!!!)

    1.Install gcc-arm-none-eabi https://devzone.nordicsemi.com/tutorials/7/This link shows that developm ...

  9. Microsoft Build 2016 Day 2 记录(多图慎入)

    Microsoft Build 2016 Day 1 记录 Microsoft Build 2016 进行到了第二天,我觉得这一天的内容非常精彩,因为主要和开发者相关

随机推荐

  1. JS——鼠标在盒子中的坐标

    核心思想: 1.复杂版本:鼠标pageX.pageY的值减去盒子距离顶端的offsetLeft.offsetTop值就是鼠标在盒子中的坐标 2.简单版本:offsetX.offsetY就可获取鼠标相对 ...

  2. python调用java API

    JPype documentation JPype is an effort to allow python programs full access to java class libraries. ...

  3. Java_Web三大框架之Hibernate+HQL语言基础

    12.1 HQL语言基础Hibernate查询语言为HQL(Hibernate Query Language),可以直接使用实体类名及属性.HQL语法类似于SQL,有SQL的关键词如select.fr ...

  4. id拼接保存到单个字段后作为表连接的查询条件

    SELECT q.id, concat(q. NAME) qname, d.id did, d. NAME FROM question_po q LEFT JOIN data_configuratio ...

  5. PHP 之simple_html_dom实现网页数据采集

    <?php set_time_limit(0); include './simple_html_dom.php'; $url = 'https://price.pcauto.com.cn/pri ...

  6. mstsc windows7/10远程桌面身份验证错误 要求的函数不受支持

    之前好好的能远程桌面连接到服务器,但是今天来就不能连接上了,并提示:身份验证错误.要求的函数不受支持. 猜想可能是Windows又更新了什么鬼,后面查询资料知道是由于CredSSP加密Oracle修正 ...

  7. Python 模块的导入 day5

    一.模块 1.标准模块 python自带的 2.第三方模块 需要自己安装的模块 3.自己写的python文件 一个python文件,就是一个模块 (1)导入模块的实质 就是把你导入的模块运行了一遍 ( ...

  8. LeetCode--寻找数组中心索引

    给定一个整数类型的数组 nums,请编写一个能够返回数组“中心索引”的方法. 我们是这样定义数组中心索引的:数组中心索引的左侧所有元素相加的和等于右侧所有元素相加的和. 如果数组不存在中心索引,那么我 ...

  9. 七牛直播云-m3u8格式直播

    直播架构 业务服务器:负责协调直播类应用的业务逻辑 创建直播房间 返回直播房间播放地址列表 关闭直播房间 LiveNet 实时流网络:负责流媒体的分发.直播流的创建.查询等相关操作 采集端:负责采集和 ...

  10. 实验十二 团队作业8:软件测试与Alpha冲刺 第三天

    项目 内容 这个作业属于哪个课程 老师链接 这个作业的要求在哪里 作业链接地址 团队名称 always run 作业学习目标 (1)掌握软件测试基础技术.(2)学习迭代式增量软件开发过程(Scrum) ...