ipaddress 1.1.0
Loading...
Searching...
No Matches
Build Guide

Here's how to build the library locally. Technically, this is a header-only library and does not need to be compiled, but for development you will have to collect unit tests and documentation.

To work you will need:

  • A compatible operating system (e.g. Linux, macOS, Windows);
  • Compatible C++ compiler supporting C++11 or later (if you cannot test on all versions of the standard, then it’s okay, this project runs tests for all versions of the C++ standard and various versions of compilers);
  • CMake and a compatible build tool for building the project;
  • (optional) clang-tidy 14+ for static analysis during build.

Set up a project

git clone https://github.com/VladimirShaleev/ipaddress.git
cd ipaddress

Once the repository is clone, you can configure it using CMake.

cmake -B build -S . \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=Debug \
-DIPADDRESS_ENABLE_CLANG_TIDY=OFF \
-DIPADDRESS_BUILD_TESTS=ON

Where:

  • CMAKE_CXX_STANDARD — The selected standard with which unit tests will be collected. If not specified, the default one in the current build tools will be used.

Once configured, you can build tests.

cmake --build build --config Debug --target ipaddress-tests -j4

Running unit tests.

cd build
ctest --output-on-failure

Below is a list of all parameters supported by the configuration:

  • IPADDRESS_ENABLE_CLANG_TIDY — Enable clang-tidy checks (ON by default).
  • IPADDRESS_BUILD_TESTS — Build unit tests (ON by default).
  • IPADDRESS_BUILD_BENCHMARK — Build benchmark (OFF by default).
  • IPADDRESS_BUILD_DOC — Build doc (ON by default).
  • IPADDRESS_BUILD_PACKAGES — Create targets for building packages deb, rpm, etc. (ON by default).
  • IPADDRESS_BUILD_MODULE — Build cpp module (OFF by default).
  • IPADDRESS_TEST_MODULE — Will use the C++ module to build tests if available (OFF by default).
  • IPADDRESS_NO_EXCEPTIONS — Disable exceptions throwing (OFF by default).
  • IPADDRESS_NO_IPV6_SCOPE — Disable scope id for ipv6 (OFF by default).
  • IPADDRESS_IPV6_SCOPE_MAX_LENGTH — scope id max length (16 by default).

Build a Documentation

To assemble the documentation, you need to install the following tools on the system:

  • Doxygen version 1.10.0 for documentation assembly;
  • graphviz for creating charts.

After which you can enable the documentation build in the configuration and run build.

cmake -B build -S . -DIPADDRESS_BUILD_DOC=ON
cmake --build build --target doc

Build a Benchmark

To build the benchmark, follow these steps:

cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DIPADDRESS_BUILD_BENCHMARK=ON
cmake --build build --config Release --target ipaddress-benchmark