|
15 | 15 | - ✅ C++20 (extendable to C++23) |
16 | 16 | - ✅ GoogleTest (with `FetchContent`) |
17 | 17 | - ✅ Sanitizers: AddressSanitizer + UndefinedBehaviorSanitizer |
18 | | -- ✅ Pre-commit hooks + clang-format + clang-tidy |
| 18 | +- ✅ Link Time Optimization (LTO) presets |
| 19 | +- ✅ Clang-format + Clang-tidy + Pre-commit hook |
19 | 20 | - ✅ GitHub Actions CI for builds, tests, and formatting |
| 21 | +- ✅ Install targets |
20 | 22 |
|
21 | 23 | --- |
22 | 24 |
|
23 | | -## 🚀 Build & Test |
| 25 | +## 🚀 Getting Started |
24 | 26 |
|
25 | | -This project uses [CMake Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html). |
| 27 | +This template uses [CMake Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html). |
26 | 28 |
|
27 | | -### Build locally |
| 29 | +### Build and Test |
28 | 30 |
|
29 | 31 | ```bash |
30 | 32 | cmake --preset gcc-RelWithDebInfo |
31 | 33 | cmake --build --preset gcc-RelWithDebInfo |
32 | 34 | ctest --preset gcc-RelWithDebInfo |
33 | 35 | ``` |
34 | 36 |
|
35 | | -### Run Unit Tests |
| 37 | +You can choose from the list of available presets: |
| 38 | +```bash |
| 39 | +cmake --list-presets |
| 40 | +``` |
| 41 | + |
| 42 | +#### Enable Sanitizers |
| 43 | +Use the special `Sanitize` build type: |
| 44 | +```bash |
| 45 | +cmake --preset gcc-Sanitize |
| 46 | +cmake --build --preset gcc-Sanitize |
| 47 | +ctest --preset gcc-Sanitize |
| 48 | +``` |
| 49 | + |
| 50 | +#### LTO Builds |
| 51 | +LTO is enabled via special preset: |
| 52 | +```bash |
| 53 | +cmake --preset gcc-RelWithDebInfo-lto |
| 54 | +cmake --build --preset gcc-RelWithDebInfo-lto |
| 55 | +``` |
| 56 | + |
| 57 | +#### Testing |
36 | 58 |
|
37 | 59 | Unit tests are enabled by default via the `ENABLE_TESTING` option. |
38 | 60 | Tests work with all build types, but `Sanitize` is recommended to catch runtime issues (e.g., buffer overflows). |
39 | 61 |
|
40 | 62 | Run tests using the `Sanitize` build type (recommended): |
41 | 63 | ```bash |
42 | | -ctest --preset clang-Sanitize |
| 64 | +ctest --preset gcc-Sanitize |
43 | 65 | ``` |
44 | 66 |
|
45 | 67 | Tests are auto-discovered via GoogleTest and integrated into CTest. |
46 | 68 |
|
47 | | -### Code Style and Lint |
| 69 | +### Code Style and Linting |
48 | 70 |
|
49 | 71 | This project uses: |
50 | | -- `.clang-format` for formatting |
51 | | -- `.clang-tidy` for linting |
52 | | -- Pre-commit hook to enforce formatting |
| 72 | +- `.clang-format` for formatting (pre-commit hook) |
| 73 | +- `.clang-tidy` for linting (static analysis) |
53 | 74 |
|
54 | | -To check formatting locally: |
| 75 | +Run manually: |
55 | 76 | ```bash |
56 | | -clang-format -i src/*.cpp include/*.hpp tests/*.cpp tests/*.hpp |
| 77 | +clang-format -i src/*.cpp include/**/*.hpp tests/*.cpp |
| 78 | +clang-tidy src/*.cpp -p build/gcc-RelWithDebInfo |
57 | 79 | ``` |
58 | 80 |
|
59 | | -### Tips |
60 | | - |
61 | | -- All sanitizers are enabled via the `Sanitize` build type. |
62 | | -- CI runs on Clang + GCC using GitHub Actions. |
63 | | -- You can safely override default settings in `CMakePresets.json`. |
64 | | - |
65 | 81 | ### Installation |
66 | 82 |
|
67 | 83 | This project supports CMake installation: |
@@ -90,6 +106,11 @@ cmake -DCMAKE_PREFIX_PATH=/path/to/install .. |
90 | 106 |
|
91 | 107 | This project is licensed under the [Apache License 2.0](LICENSE). |
92 | 108 |
|
| 109 | +You are free to use, modify, distribute, and include this code in commercial or open-source projects. |
| 110 | + |
93 | 111 | ## Contributing |
94 | 112 |
|
95 | | -Pull requests are welcome. Please ensure code is formatted and tests pass before submitting. |
| 113 | +Pull requests are welcome. Please ensure the following before submitting: |
| 114 | +- Code passes all tests |
| 115 | +- Code is formatted and clang-tidy clean |
| 116 | += Commits follow clear, atomic changes |
0 commit comments