Skip to content
Welcome to the new CppUtils documentation!

CppUtils relies on the XMake build system to orchestrate the compilation of its C++26 modules (.mpp), headers, and test suite.

This guide provides ready-to-use recipes to tailor your build to your development needs (development, debugging, unit testing, dynamic analysis) along with a complete reference table for all configuration flags.


By default, CppUtils is configured as a purely modular library (moduleonly), built with strict warning settings (-Wall, -Wextra, -pedantic, -Werror), and maximum optimization (set_optimize("fastest")).

To build the library with its default configuration:

Fenêtre de terminal
# 1. Configure with LLVM toolchain and shared libc++ runtime
xmake f --toolchain=llvm --runtimes="c++_shared"
# 2. Build the library
xmake

To build and execute CppUtils’ unit test suite, enable the --enable_tests=y flag:

Fenêtre de terminal
# Configure with tests enabled
xmake f --toolchain=llvm --runtimes="c++_shared" --enable_tests=y -y
# Build and run unit tests
xmake run CppUtils-UnitTests

To execute a specific test or suite using framework filter options:

Fenêtre de terminal
xmake run CppUtils-UnitTests --test="BidirectionalMap"

If you prefer configuring your build visually without memorizing command-line flags:

Fenêtre de terminal
xmake f --menu

This interactive terminal menu allows you to navigate project categories (Build CppUtils, Sanitizer, etc.), toggle options, and save your configuration.


The project supports standard XMake build modes via the -m or --mode flag:

ModeFlagOptimizationsDebug symbolsTypical use case
Release (default)-m release-O3 (fastest)NoProduction builds, performance benchmarks.
Debug-m debug-O0Yes (-g)Interactive debugging with GDB / LLDB.
Release with Debug-m releasedbg-O3Yes (-g)Performance profiling with symbol visibility.
Profile-m profileModerateYes (-g + profiler)Profiling with perf or gprof.
Coverage-m coverageModerateYes (--coverage)Code coverage metrics for test suites.
Valgrind-m valgrindModerateYes (-g)Deep memory inspection with Valgrind.

Here is the complete reference table of options defined in CppUtils’ xmake.lua:

OptionValuesDefaultDescription
--enable_testsy / nn (false)Includes the tests/ directory and builds the CppUtils-UnitTests binary target.
--sanitize_memoryy / nn (false)Enables ASan, LSan, and UBSan policies (build.sanitizer.address, etc.).
--sanitize_thready / nn (false)Enables TSan policy (build.sanitizer.thread) for data race detection.
--compiler_verbosey / nn (false)Passes -v to the compiler and linker to inspect exact command lines.
--enable_moduleonlyy / ny (true)Configures the target with set_kind("moduleonly") for modular C++26 distribution.
--toolchainllvm / clang / msvcAutoSelects the compiler toolchain (msvc on Windows).
--runtimes"c++_shared"AutoSpecifies the C++ runtime library variant (shared required for Clang modules).
--sdk<path>SystemAbsolute path to the LLVM toolchain root directory.

ActionCommand
Full clean buildxmake -r (or xmake --rebuild)
Clean build artifactsxmake clean
Clean all caches and configsxmake clean -a
Show actual compilation commandsxmake -vD
Show current configurationxmake show
Run tests under LLDB debuggerxmake run -d CppUtils-UnitTests