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 Mar 12, 2018 · 4 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 ..

Configure select timeout

By default, select() timeout is set to NULL (unlimited timeout), meaning that select will sleep indefinitely until a notification is received.

If this behavior is not desirable, you can configure the select() timeout at runtime by using the CMake variable SELECT_TIMEOUT and setting it with a nano-seconds duration.

# Configure select timeout
cmake .. -DSELECT_TIMEOUT=1000000L

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 number of io_service workers

The tcp_client is multithreaded: multiple workers are in charge of executing the read and write callbacks once the data has been written to or read from the underlying socket. All tcp_client share the same default thread pool returned by utils::get_default_thread_pool, except if it has been overridden by tcp_client::set_thread_pool.

You can configure the number of workers assigned to the tcp_client by setting the DEFAULT_THREAD_POOL_SIZE CMake variable.

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

Custom Queue Size

TCP Server is initialized is a maximum queue size of incoming connections.

You can configure this queue size by setting the CONNECTION_QUEUE_SIZE CMake variable.

# Change the queue size (default value: 1024)
cmake .. -DCONNECTION_QUEUE_SIZE=1024

Building tests

cmake .. -DBUILD_TESTS=true

Building examples

cmake .. -DBUILD_EXAMPLES=true
Clone this wiki locally