UTL

Collection of self-contained header-only libraries for C++17

View on GitHub

Building tests & examples

<- back to README.md

This project uses CMake build system.

Unit testing for modules is implemented using doctest together with CMake testing facilities (see CTest). All tests can be found in tests/ split by per-module basis.

Benchmarks are implemented using the nanobench functionality and can be found in benchmarks/ split by per-module basis.

All tests and benchmarks compile with -Wall -Wextra -Wpedantic -Werror flags.

Building with a script

Clone the repo:

git clone https://github.com/DmitriBogdanov/UTL.git &&
cd "UTL/"

Configure & build the project:

bash actions.sh clear config build

Run all tests:

bash actions.sh test

Run benchmark:

./build/benchmarks/<benchmark_name>

Configuring build

Compiler and CTest flags can be selected in actions.sh script configuration. To do so, edit following lines at the top of the script:

compiler="g++"
test_flags="--rerun-failed --output-on-failure --timeout 60"

Compilation flags can be changed in tests/CMakeLists.txt and benchmarks/CMakeLists.txt, find following lines and enter appropriate values if necessary:

target_compile_features(${filename} PRIVATE cxx_std_17)
target_compile_options(${filename} PRIVATE -O2 -Wall -Wextra -Wpedantic -Werror)

Building manually

Clone the repo:

git clone https://github.com/DmitriBogdanov/UTL.git &&
cd "UTL/"

Configure CMake:

cmake -D CMAKE_CXX_COMPILER=g++ -B "build/" -S .

Build the project:

bash "scripts/create_single_header.sh"
cmake --build "build/"

Run tests:

cd "build/tests/" &&
ctest --rerun-failed --output-on-failure --timeout 60 &&
cd ..

Run benchmark:

./build/benchmarks/<benchmark_name>