Skip to content
This repository has been archived by the owner on Apr 6, 2019. It is now read-only.

Compilation and installation options

Simon Ninon edited this page Oct 15, 2016 · 11 revisions

Custom installation directory

By default, the make install command will install the library globally in your system (/usr/lib for example).

You can change that location by using a dedicated cmake option:

cmake -DCMAKE_INSTALL_PREFIX=/destination/path ..

Enable logging

By default, all lines of code related to logging are suppressed at the preprocessing step.

This is done to provide higher performance by avoiding the execution of unnecessary lines of code related to logging even though no logger has been configured.

If you wish to enable logging, you have to disable that default behavior by setting the CMake variable LOGGING_ENABLED.

# Enable logging
cmake .. -DLOGGING_ENABLED=1

Custom socket read size

# Change the read size used to read data from sockets (default value: 4096)
cmake .. -DREAD_SIZE=4096

Custom maximum number of polled FDs

This option is ignored on Windows.

On Linux & Mac, cpp_redis handles IO by using the poll syscall.

poll receives an array of FDs as a parameter. cpp_redis uses a fixed-size array of FD.

This fixed-size can be configured by setting the MAX_NB_FDS CMake variable.

# Change the maximum number of polled FDs (default value: 1024)
cmake .. -DMAX_NB_FDS=1024

Custom the default number of io_service workers

This option is ignored on Linux and Mac environments.

On Windows, the io_service is multithreaded: multiple workers are in charged of IO operations and call the underlying read and write callbacks.

You can configure the default number of workers assigned to the io_service by setting the DEFAULT_NB_IO_SERVICE_WORKERS CMake variable.

# Change the default number of io_service workers (default value: 16)
cmake .. -DDEFAULT_NB_IO_SERVICE_WORKERS=16

To learn more about cpp_redis io_service, please refer to the dedicated wiki page.

Building tests

cmake .. -DBUILD_TESTS=true

You will also need to install some dependencies required to build the tests (GoogleTest).

This can be done by executing the install_deps.sh script, located in the root of the repository. This script installs the dependencies locally: no dependency is installed globally in your system.

Building examples

cmake .. -DBUILD_EXAMPLES=true