Here is some wisdom to help you build and test this project as a developer and potential contributor.
If you plan to contribute, please read the CONTRIBUTING guide.
Build system targets that are only useful for developers of this project are
hidden if the RPP_DEVELOPER_MODE
option is disabled. Enabling this
option makes tests and other developer targets and options available. Not
enabling this option means that you are a consumer of this project and thus you
have no need for these targets and options.
Developer mode is always set to on in CI workflows.
This project makes use of presets to simplify the process of configuring the project. As a developer, you are recommended to always have the latest CMake version installed to make use of the latest Quality-of-Life additions.
You have a few options to pass RPP_DEVELOPER_MODE
to the configure
command, but this project prefers to use presets.
As a developer, you should create a CMakeUserPresets.json
file at the root of
the project:
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 14,
"patch": 0
},
"configurePresets": [
{
"name": "dev",
"binaryDir": "${sourceDir}/build",
"inherits": ["<some_preset>"],
"cacheVariables": {
"CMAKE_BUILD_TYPE" : "Release",
"RPP_BUILD_EXAMPLES" : "ON"
}
}
],
"buildPresets": [
{
"name": "dev",
"configurePreset": "dev",
"configuration": "Release",
"jobs" : 2
}
],
"testPresets": [
{
"name": "dev",
"configurePreset": "dev",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
}
]
}
You should replace <some_preset>
in your newly created presets file with the name of
some base preset from CMakePresets.json
file. It is highly recommended to use user-*
presets.
CMakeUserPresets.json
is also the perfect place in which you can put all
sorts of things that you would otherwise want to pass to the configure command
in the terminal.
Don't forget to add some compile options to enable different parts of RPP like enabling tests/benchmarks
If you followed the above instructions, then you can configure, build and test the project respectively with the following commands from the project root on any operating system with any build system:
cmake --preset=dev
cmake --build --preset=dev
ctest --preset=dev
If you are using a compatible editor (e.g. VSCode) or IDE (e.g. CLion, VS), you will also be able to select the above created user presets for automatic integration.
Please note that both the build and test commands accept a -j
flag to specify
the number of jobs to use, which should ideally be specified to the number of
threads your CPU has. You may also want to add that to your preset using the
jobs
property, see the presets documentation for more details.
These are targets you may invoke using the build command from above, with an
additional -t <target>
flag:
Available if RPP_ENABLE_COVERAGE
is enabled. This target processes the output of
the previously run tests when built with coverage configuration.
if your cmake version is >= 3.24, you can use conan to install RPP's dependencies. To use it your Cmake preset should be inherited from use-conan
. CMake would configure conan properly.