Skip to content

Commit 273f42a

Browse files
committed
Add README.md
1 parent ae4de64 commit 273f42a

File tree

1 file changed

+70
-1
lines changed

1 file changed

+70
-1
lines changed

README.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,70 @@
1-
# cpp-cmake-project-template
1+
# modern_cpp_project
2+
3+
[![CI](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/ci.yml/badge.svg)](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/ci.yml)
4+
[![clang-format](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/clang-format.yml/badge.svg)](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/clang-format.yml)
5+
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
6+
7+
> A modern C++20+ starter project using CMake, GoogleTest, sanitizers, GitHub Actions, and developer tooling.
8+
9+
---
10+
11+
## Features
12+
13+
- ✅ CMake presets with Clang & GCC support
14+
- ✅ C++20 (extendable to C++23)
15+
- ✅ GoogleTest (with `FetchContent`)
16+
- ✅ AddressSanitizer + UndefinedBehaviorSanitizer
17+
- ✅ Pre-commit hooks + clang-format + clang-tidy
18+
- ✅ GitHub Actions CI for builds, tests, and formatting
19+
20+
---
21+
22+
## 🚀 Build & Test
23+
24+
This project uses [CMake Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html).
25+
26+
### Build locally
27+
28+
```bash
29+
cmake --preset gcc-RelWithDebInfo
30+
cmake --build --preset gcc-RelWithDebInfo
31+
ctest --preset gcc-RelWithDebInfo
32+
```
33+
34+
### Run Unit Tests
35+
36+
Unit tests are enabled by default via the `ENABLE_TESTING` option.
37+
Tests work with all build types, but `Sanitize` is recommended to catch runtime issues (e.g., buffer overflows).
38+
39+
Run tests using the `Sanitize` build type (recommended):
40+
```bash
41+
ctest --preset clang-Sanitize
42+
```
43+
44+
Tests are auto-discovered via GoogleTest and integrated into CTest.
45+
46+
### Code Style and Lint
47+
48+
This project uses:
49+
- `.clang-format` for formatting
50+
- `.clang-tidy` for linting
51+
- Pre-commit hook to enforce formatting
52+
53+
To check formatting locally:
54+
```bash
55+
clang-format -i src/*.cpp include/*.hpp tests/*.cpp tests/*.hpp
56+
```
57+
58+
### Tips
59+
60+
- All sanitizers are enabled via the `Sanitize` build type.
61+
- CI runs on Clang + GCC using GitHub Actions.
62+
- You can safely override default settings in `CMakePresets.json`.
63+
64+
## License
65+
66+
This project is licensed under the [Apache License 2.0](LICENSE).
67+
68+
## Contributing
69+
70+
Pull requests are welcome. Please ensure code is formatted and tests pass before submitting.

0 commit comments

Comments
 (0)