Headers move, CMake targets merge, C++ namespaces stay unchanged: - Core: Scope, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant - Functional: Pipeline, Either, Result, Retry - Containers: Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval - Math: +Matrix, Numeric, Random, Histogram - Text: Str, Format, Tokenizer, Diff, Encoding, Semver - Data: Json, Csv, Ini - Async: Coro, Concurrency, EventBus, Observable - Time: +Bench - Log: Log facade + Logging framework (facade now header-only, breaking the Stacktrace<->Log link cycle the merge would have created) - System: FileSystem + Process - Configuration: +Argparse - Unchanged: Stacktrace, Plugin, StateMachine, Testing, TestingMock, Detail Module system fixes: - OPTIONAL_DEPS resolution deferred to void_finalize_modules() so it no longer depends on the alphabetical discovery order of src/ subdirs (Testing -> Text would have been silently dropped). - Every header-only module now has a tracked module.cmake; previously the empty src/<Name> marker dirs were untracked, so a fresh clone would have silently skipped those modules. - VOID_HAS_LOGGING/CONCURRENCY/STR consumers renamed to LOG/ASYNC/TEXT. Tests move to tests/standalone/<Umbrella>/<Feature>.cpp (Result suite files prefixed: ResultBasic etc.). Test count verified identical (831) before and after. README/CLAUDE.md module tables updated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
100 lines
5.2 KiB
Markdown
100 lines
5.2 KiB
Markdown
# VoidLibrary
|
|
|
|
A modular C++26 shared library. Each module is an independently installable
|
|
CMake target under the `Void::` namespace; the build system auto-discovers
|
|
modules under `src/` and links them together.
|
|
|
|
## Build
|
|
|
|
Requires CMake 4.0+ and a C++26 compiler. GCC 16+ is the default — it ships
|
|
experimental P2996 reflection (`-freflection`, `<meta>` header) that several
|
|
modules opt into.
|
|
|
|
```bash
|
|
# Configure (g++, Ninja, Debug)
|
|
cmake -B build -S . -G Ninja -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Debug
|
|
|
|
# Build
|
|
cmake --build build
|
|
|
|
# Run all tests
|
|
ctest --test-dir build
|
|
|
|
# Or run the test binary directly (per-suite filtering, parallel mode, ...)
|
|
./build/tests/VoidTests --filter "Json*"
|
|
```
|
|
|
|
### Optional build flags
|
|
|
|
| Flag | Default | Effect |
|
|
|----------------------------|---------|------------------------------------------------------------------------|
|
|
| `VOID_ENABLE_TESTING` | `ON` | Build the test suite under `tests/`. |
|
|
| `VOID_WARNINGS_AS_ERRORS` | `OFF` | Adds `-Wall -Wextra -Wpedantic -Werror` (GCC/Clang) or `/W4 /WX` (MSVC). |
|
|
| `VOID_ENABLE_ASAN` | `OFF` | Adds `-fsanitize=address` to compile and link. |
|
|
| `VOID_ENABLE_UBSAN` | `OFF` | Adds `-fsanitize=undefined` to compile and link. |
|
|
| `VOID_ENABLE_COVERAGE` | `OFF` | Adds `--coverage` (GCC) or `-fprofile-instr-generate -fcoverage-mapping` (Clang). After `ctest`, run `gcovr -r . build` for a report. |
|
|
|
|
```bash
|
|
cmake -B build-asan -S . -G Ninja -DCMAKE_CXX_COMPILER=g++ \
|
|
-DVOID_ENABLE_ASAN=ON -DVOID_ENABLE_UBSAN=ON \
|
|
-DVOID_WARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=Debug
|
|
cmake --build build-asan
|
|
ctest --test-dir build-asan
|
|
```
|
|
|
|
Format code with `clang-format -i <file>`.
|
|
|
|
## Modules
|
|
|
|
Functionality is grouped into umbrella modules (one CMake target each).
|
|
The C++ namespaces of the absorbed components are unchanged — e.g.
|
|
`Void::Ring` lives in `Void::Containers`' headers.
|
|
|
|
| Module | Type | Contents (namespaces) |
|
|
|-----------------|-----------|-----------------------------------------------------------------------------|
|
|
| `Core` | INTERFACE | Scope guards, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant helpers. |
|
|
| `Functional` | INTERFACE | Pipeline (+Curry, +Memo), Either (+Opt), Result (`std::expected` + Error cause chains, reflection `repr`), Retry. |
|
|
| `Containers` | INTERFACE | Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval. |
|
|
| `Math` | INTERFACE | Vec/Mat, Matrix, Numeric, Random, Histogram. |
|
|
| `Text` | INTERFACE | Str, Format, Tokenizer, Diff, Encoding (Base64/Hex), Semver. |
|
|
| `Data` | INTERFACE | Json, Csv, Ini. |
|
|
| `Async` | INTERFACE | Coro (Task, Generator), Concurrency (ThreadPool, MPMC Channel, parallel_for), EventBus, Observable. |
|
|
| `Time` | INTERFACE | Stopwatch (+ScopedTimer), duration/ISO-8601 formatting, Bench. |
|
|
| `Log` | SHARED | `Void::Log` header-only facade (global sink, used by all modules) + `Void::Logging` framework (`Logger` ABC, ConsoleLogger, FileLogger). |
|
|
| `System` | SHARED | FileSystem path utilities (`Result`-based, RAII TempDir) + Process. |
|
|
| `Configuration` | SHARED | Layered key-value Config, Env + Argparse. |
|
|
| `Stacktrace` | SHARED | Stack capture + source snippets via Boost.Stacktrace; ANSI color helpers. |
|
|
| `Plugin` | SHARED | dlopen-based plugin loader with C ABI, hot reload, state transfer. |
|
|
| `StateMachine` | INTERFACE | Compile-time variant-based FSM. |
|
|
| `Testing` | STATIC | Self-registering test framework with fixtures, tags, JUnit/console reporters, crash capture. |
|
|
| `TestingMock` | INTERFACE | Mock framework: `MockFunction`, `Mock<Derived>`, matchers, move-only actions. |
|
|
|
|
## Adding a module
|
|
|
|
Create `src/<ModuleName>/` and populate it with sources/headers — the build
|
|
picks it up automatically. Public headers go in
|
|
`include/Void/<ModuleName>/*.hpp`. For special dependency wiring drop a
|
|
`module.cmake` in the source directory; see `cmake/module.cmake.template`
|
|
for the shape and `cmake/Module.cmake` for the full `void_add_module`
|
|
contract (`INTERNAL_DEPS`, `EXTERNAL_DEPS`, `OPTIONAL_DEPS`,
|
|
`DEPS_WIN32`/`DEPS_UNIX`, `OPTIONS_WIN32`/`OPTIONS_UNIX`).
|
|
|
|
## Using as a dependency
|
|
|
|
```cmake
|
|
find_package(Void REQUIRED)
|
|
target_link_libraries(myapp PRIVATE Void::Logging Void::Stacktrace)
|
|
```
|
|
|
|
`find_package(Void)` exposes every installed module under the `Void::`
|
|
namespace and auto-loads the test scanner so downstream projects can use
|
|
`void_add_tests()` for free.
|
|
|
|
## Writing tests
|
|
|
|
Tests are free functions or methods on a `Void::Testing::Fixture` subclass
|
|
returning `Void::Testing::Test` (or `Void::Testing::DisabledTest`).
|
|
Registration is automatic — the CMake test scanner parses each `.cpp` at
|
|
configure time and generates the registration shim. See `CLAUDE.md` for the
|
|
comment-metadata syntax (`// @tag`, `// @skip`).
|