The simplest way of configuring and building the project is to use CMake
Presets. Appropriate
presets for major compilers have been included by default. You can use cmake --list-presets=workflow to see all available presets.
Here is an example of invoking the gcc-debug preset:
cmake --workflow --preset gcc-debugGenerally, there are two kinds of presets, debug and release.
The debug presets are designed to aid development, so they have debuginfo and sanitizers
enabled.
Note
The sanitizers that are enabled vary from compiler to compiler. See the toolchain files
under (infra/cmake) to determine the exact configuration used for each
preset.
The release presets are designed for production use, and
consequently have the highest optimization turned on (e.g. O3).
If the presets are not suitable for your use case, a traditional CMake invocation will provide more configurability.
To configure, build and test the project manually, you can run this set of commands. Note that this requires GoogleTest to be installed.
cmake \
-B build \
-S . \
-DCMAKE_CXX_STANDARD=20 \
# Your extra arguments here.
cmake --build build
ctest --test-dir buildImportant
Beman projects are passive projects,
so you need to specify the C++ version via CMAKE_CXX_STANDARD when manually
configuring the project.
Instead of installing the project's dependencies via a package manager, you can optionally configure beman.monadics to fetch them automatically via CMake FetchContent.
To do so, specify
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./infra/cmake/use-fetch-content.cmake. This will
bring in GoogleTest automatically along with any other dependency the project may require.
Example commands:
cmake \
-B build \
-S . \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./infra/cmake/use-fetch-content.cmake
cmake --build build
ctest --test-dir buildThe file ./lockfile.json configures the list of dependencies and versions that will be
acquired by FetchContent.
Project-specific options are prefixed with BEMAN_MONADICS.
You can see the list of available options with:
cmake -LH -S . -B build | grep "BEMAN_MONADICS" -C 2Some project-specific configure arguments
Enable building tests and test infrastructure. Default: ON.
Values: { ON, OFF }.
Enable building examples. Default: ON. Values: { ON, OFF }.
Enable installing the CMake config file package. Default: ON.
Values: { ON, OFF }.
This is required so that users of beman.monadics can use
find_package(beman.monadics) to locate the library.