@@ -48,6 +48,7 @@ These are optional requirements that can be useful when **developing** any of th
-[**doxygen**](https://www.doxygen.nl/): Used for generating documentation for some projects.
-[**dot**, from graphviz](https://graphviz.org/): Used for generating inheritance diagrams for doxygen.
-[**OpenCppCoverage**](https://github.com/OpenCppCoverage/OpenCppCoverage): When installed, coverage reports will be generated for the unit test.
-[**ccache**](https://ccache.dev/): Can be used to speed up compilation, see [Speed up options](#speed-up-options) for more info.
## Known issues
...
...
@@ -106,3 +107,46 @@ For now, see [General CMake](#general-cmake).
## Apple OSX
For now, see [General CMake](#general-cmake).
## Speed up options
There are a few options for speeding up both the compilation and the configuration of the projects through caching.
When used in combination, it can speed up the compilation even further.
Some information can be found [here](https://github.com/cpm-cmake/CPM.cmake/wiki/Caching-with-CPM.cmake-and-ccache-on-GitHub-Actions).
### CPM cache
CPM offers the option to cache any call to `CPMAddPackage`.
When this is done, any external package only needs to be downloaded once.
Any later call, i.e. another configuration, does not download anything, speeding up the configuration set significantly.
To use this, pass `-DCPM_SOURCE_CACHE=<pathtoanexternaldownloaddirectory>` to CMake when configuring.
Preferably use an absolute path.
Then the cache can be easily shared between projects.
The CMake variable can also be set as an environment variable, see [this](https://github.com/cpm-cmake/CPM.cmake#CPM_SOURCE_CACHE) for further info.
### ccache
Similar to CPM ccache caches the compiler invocations.
When the same invocation is found, the cached object file is used.
In order to enable ccache, some further options have to be passed to CMake when configuring:
- `-DCMAKE_CXX_COMPILER_LAUNCHER=ccache` actually use ccache when compiling `cpp` files
- `-DCMAKE_C_COMPILER_LAUNCHER=ccache` same for `c` files.
- `-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded` when using msvc, the default compiler invocation uses the `/Zi` flag (store debug info in `pdb` file).
This flag is not supported [ccache at the moment](https://github.com/ccache/ccache/issues/1040).
As a result, no invocation can be stored.
By setting the `CMAKE_MSVC_DEBUG_INFORMATION_FORMAT` to `Embedded`, the flag `-Z7` will be used which is supported by ccache (see [this](https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_DEBUG_INFORMATION_FORMAT.html) for further info; `-Z7` stores debug info in object file, making it a bit bigger).
Sadly, this is a newer feature of CMake and requires **at least version 3.25**.
In addition, the following option also has to be passed to CMake.