diff --git a/README.md b/README.md index e7de709b3..e07dbe6a4 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ General dependencies: - [doxygen](https://www.doxygen.nl/index.html) if documentation generation is enabled - [Pybind11 ≥ v2.13.3](https://github.com/pybind/pybind11) if Python bindings are enabled - [OpenMP](https://www.openmp.org/) 4.0 or newer (optional) to speed-up library utilities (like file parsing) +- [Format.cmake](https://github.com/TheLartians/Format.cmake) if auto formatting via clang-format is enabled; also requires at least clang-format-18 and git - multiple Python modules used in the utility scripts, to install all modules use `pip install --user -r install/python_requirements.txt` Additional dependencies for the OpenMP backend: @@ -276,6 +277,7 @@ The `[optional_options]` can be one or multiple of: - `PLSSVM_ENABLE_TESTING=ON|OFF` (default: `ON`): enable testing using GoogleTest and ctest - `PLSSVM_ENABLE_LANGUAGE_BINDINGS=ON|OFF` (default: `OFF`): enable language bindings - `PLSSVM_STL_DEBUG_MODE_FLAGS=ON|OFF` (default: `OFF`): enable STL debug modes (**note**: changes the resulting library's ABI!) +- `PLSSVM_ENABLE_FORMATTING=ON|OFF` (default: `OFF`): enable automatic formatting using clang-format; adds additional targets `check-clang-format`, `clang-format`, and `fix-clang-format` If `PLSSVM_ENABLE_TESTING` is set to `ON`, the following option can also be set: @@ -432,6 +434,23 @@ cmake --build . -- coverage The resulting `html` coverage report is located in the `coverage` folder in the build directory. +### Automatic Source File Formatting + +To enable automatic formatting `PLSSVM_ENABLE_FORMATTING` must be set to `ON` and a `clang-format` and `git` executables must be available in `PATH` (minimum `clang-format` version is 18). + +To check whether formatting changes must be applied use: + +```bash +cmake --build . --target check-clang-format +``` + +To auto format all files use: + +```bash +cmake --build . --target clang-format +cmake --build . --target fix-clang-format +``` + ### Creating the Documentation If doxygen is installed and `PLSSVM_ENABLE_DOCUMENTATION` is set to `ON` the documentation can be build using