This document describes the local development workflow for fw, including build setup, test execution, coverage, and packaging.
| Tool | Version | Required |
|---|---|---|
| CMake | 3.20+ | Always |
| C++ compiler | C++23 capable | Always |
| GoogleTest | fetched via CMake | Test builds |
| Conan | 2.x | Packaging only |
| Clang/LLVM | any | Coverage only |
GoogleTest is fetched automatically by CMake when tests are enabled. No manual installation is required.
.
├── CMakeLists.txt # project definition, install rules
├── CMakePresets.json # preset definitions
├── conanfile.py # Conan recipe
├── fwConfig.cmake.in # CMake package config template
├── include/
│ └── fw/
│ ├── function_wrapper.hpp # primary public header
│ ├── exceptions.hpp # public exception types
│ └── detail/ # internal implementation (do not include directly)
├── tests/ # GoogleTest-based test suite
└── docs/ # documentation
The project exposes two presets:
| Preset | Purpose | Tests enabled |
|---|---|---|
debug |
Local development | Yes |
release |
Packaging and install validation | No |
cmake --preset debug
cmake --build --preset debugctest --preset debugTests are organized into focused executables. CTest discovers and runs them all.
cmake --preset release
cmake --build --preset releaseThe test suite is split into focused executables. Each can be run directly from the IDE or from the command line.
| Target | Covers |
|---|---|
fw_concepts_tests |
Concept constraints and type trait correctness |
fw_exceptions_tests |
Exception message stability and throw behavior |
fw_function_ref_tests |
Non-owning callable view construction, borrowing, member adapters |
fw_function_wrapper_tests |
Core wrapper construction, copy/move, call dispatch |
fw_move_only_function_wrapper_tests |
Move-only wrapper construction, ownership transfer, call dispatch |
fw_signature_interface_tests |
Signature selection and dispatch ranking policy |
fw_vtable_tests |
Vtable construction and lifecycle |
There is also an aggregate build target:
cmake --build --preset debug --target fw_checkfw_check builds all test targets in one step. It does not run them — use ctest for execution.
After building:
./cmake-build-debug/tests/fw_function_wrapper_tests
./cmake-build-debug/tests/fw_signature_interface_tests --gtest_filter="*Dispatch*"GoogleTest filter syntax applies. Use --gtest_list_tests to enumerate all test names.
All tests use Given/When/Then naming:
GivenEmptyWrapper_WhenCalled_ThrowsBadCall
GivenIntFloatSignatures_WhenCalledWithFloat_DispatchesToFloat
This keeps CTest and IDE test runner output readable without additional annotation.
- Open the repository root in CLion.
- Import the project using the shipped CMake presets (CLion detects
CMakePresets.jsonautomatically). - Select the
debugprofile for normal development. - Run individual test targets from the Run/Debug configurations panel.
The split test targets keep the IDE run surface clear. Prefer running the most relevant focused target during active feature work and fw_check before committing.
Coverage is optional and requires a Clang/LLVM toolchain.
Enable at configure time:
cmake --preset debug -DFW_ENABLE_COVERAGE=ONBuild the coverage report:
cmake --build --preset debug --target fw_wrapper_coverageThe HTML report is generated in cmake-build-debug/coverage/.
Coverage is not required for contributions but is useful when investigating untested paths.
cmake --preset release
cmake --build --preset release
cmake --install cmake-build-release --prefix /tmp/fw-installVerify the installed layout:
/tmp/fw-install/
├── include/fw/
│ ├── function_wrapper.hpp
│ ├── exceptions.hpp
│ └── detail/
└── lib/cmake/fw/
├── fwConfig.cmake
├── fwConfigVersion.cmake
└── fwTargets.cmake
conan create . --build=missingTest the consumer integration by pointing a test project at the installed package or local Conan cache.
The repository ships a .clang-format file. Format all changed files before committing:
clang-format -i include/fw/function_wrapper.hpp
clang-format -i tests/test_function_wrapper.cppKey conventions:
- 4-space indentation, no tabs.
- Opening braces on the line following the declaration (Allman style).
[[nodiscard]]on all query methods.- No
using namespacein headers. - Internal implementation lives under
fw/detail/and is never part of the public API.
Before releasing a new version:
- All test targets pass under
ctest --preset debug. -
cmake --preset release && cmake --build --preset releasesucceeds cleanly. -
cmake --installproduces the expected layout. -
conan create . --build=missingsucceeds. - Public API changes are reflected in
README.md,docs/api.md, anddocs/examples.md. - The exported CMake target name
fw::wrapperhas not changed. - No machine-specific toolchain policy has been added to project CMake files.