Skip to content

Commit 504a09e

Browse files
committed
Update docs main page
1 parent b0ccac9 commit 504a09e

File tree

1 file changed

+115
-97
lines changed

1 file changed

+115
-97
lines changed

docs/mainpage.md

Lines changed: 115 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,115 @@
1-
/**
2-
* @mainpage Modern C++ Project Template
3-
*
4-
* A modern C++20+ starter project using CMake, GoogleTest, sanitizers, GitHub Actions, and developer tooling.
5-
*
6-
* ## ✅ Features
7-
*
8-
* - CMake presets with Clang & GCC support
9-
* - C++20 (extendable to C++23)
10-
* - GoogleTest (with FetchContent)
11-
* - Sanitizers: AddressSanitizer + UndefinedBehaviorSanitizer
12-
* - Link Time Optimization (LTO) presets
13-
* - clang-format + clang-tidy + pre-commit hook
14-
* - GitHub Actions CI for builds, tests, and formatting
15-
* - Install targets
16-
*
17-
* ## 🚀 Getting Started
18-
*
19-
* This project uses [CMake Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html).
20-
*
21-
* ### Build and Test
22-
* ```bash
23-
* cmake --preset gcc-RelWithDebInfo
24-
* cmake --build --preset gcc-RelWithDebInfo
25-
* ctest --preset gcc-RelWithDebInfo
26-
* ```
27-
*
28-
* To list available presets:
29-
* ```bash
30-
* cmake --list-presets
31-
* ```
32-
*
33-
* ### Sanitizers
34-
*
35-
* Use the `Sanitize` build type to catch runtime issues:
36-
* ```bash
37-
* cmake --preset gcc-Sanitize
38-
* cmake --build --preset gcc-Sanitize
39-
* ctest --preset gcc-Sanitize
40-
* ```
41-
*
42-
* ### LTO Builds
43-
* ```bash
44-
* cmake --preset gcc-RelWithDebInfo-lto
45-
* cmake --build --preset gcc-RelWithDebInfo-lto
46-
* ```
47-
*
48-
* ### Testing
49-
*
50-
* - Enabled via `ENABLE_TESTING` (default: ON)
51-
* - Works with all build types
52-
* - `Sanitize` is recommended for catching runtime errors
53-
* - GoogleTest + CTest integration
54-
*
55-
* ### Code Style and Linting
56-
*
57-
* - Uses `.clang-format` (enforced via pre-commit)
58-
* - Uses `.clang-tidy` for static analysis
59-
*
60-
* Manual usage:
61-
* ```bash
62-
* clang-format -i src/*.cpp include/**/*.hpp tests/*.cpp
63-
* clang-tidy src/*.cpp -p build/gcc-RelWithDebInfo
64-
* ```
65-
*
66-
* ## 📦 Installation
67-
*
68-
* To install includes, libraries, and CMake config files:
69-
* ```bash
70-
* cmake --preset gcc-RelWithDebInfo
71-
* cmake --build --preset gcc-RelWithDebInfo
72-
* cmake --install build/gcc-RelWithDebInfo --prefix install
73-
* ```
74-
*
75-
* ## 🔗 Using in Another Project
76-
*
77-
* After installation:
78-
* ```cmake
79-
* find_package(modern_cpp_project REQUIRED)
80-
* target_link_libraries(<your_app> PRIVATE modern_cpp_project::math)
81-
* ```
82-
*
83-
* Set this variable in your project:
84-
* ```bash
85-
* cmake -DCMAKE_PREFIX_PATH=/path/to/install ..
86-
* ```
87-
*
88-
* ## 📄 License
89-
*
90-
* Licensed under the [Apache License 2.0](https://github.com/ramsafin/modern-cpp-project-template/blob/master/LICENSE)
91-
*
92-
* ## 🤝 Contributing
93-
*
94-
* - Code must pass all tests
95-
* - Code must be clang-format and clang-tidy clean
96-
* - Commits should follow clear, atomic changes
97-
*/
1+
# Modern C++ Project Template!
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+
[![Clang-Tidy](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/clang-tidy.yml/badge.svg)](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/clang-tidy.yml)
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+
- ✅ Sanitizers: AddressSanitizer + UndefinedBehaviorSanitizer
17+
- ✅ Link Time Optimization (LTO) presets
18+
- ✅ Clang-format + Clang-tidy + Pre-commit hook
19+
- ✅ GitHub Actions CI for builds, tests, and formatting
20+
- ✅ Install targets
21+
22+
---
23+
24+
## 🚀 Getting Started
25+
26+
This template uses [CMake Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html).
27+
28+
### Build and Test
29+
30+
```bash
31+
cmake --preset gcc-RelWithDebInfo
32+
cmake --build --preset gcc-RelWithDebInfo
33+
ctest --preset gcc-RelWithDebInfo
34+
```
35+
36+
You can list available presets:
37+
```bash
38+
cmake --list-presets
39+
```
40+
41+
#### Enable Sanitizers
42+
Use the special `Sanitize` build type to catch runtime issues:
43+
```bash
44+
cmake --preset gcc-Sanitize
45+
cmake --build --preset gcc-Sanitize
46+
ctest --preset gcc-Sanitize
47+
```
48+
49+
#### LTO Builds
50+
LTO is enabled via a dedicated preset:
51+
```bash
52+
cmake --preset gcc-RelWithDebInfo-lto
53+
cmake --build --preset gcc-RelWithDebInfo-lto
54+
```
55+
56+
#### Testing
57+
58+
- Enabled via the `ENABLE_TESTING` option (`ON` by default)
59+
- Works with all build types
60+
- `Sanitize` is recommended to detect memory/undefined behavior issues
61+
- Tests are auto-discovered using `gtest_discover_tests()`
62+
63+
Run tests:
64+
```bash
65+
ctest --preset gcc-Sanitize
66+
```
67+
68+
### Code Style and Linting
69+
70+
This project uses:
71+
- `.clang-format` for formatting (enforced via pre-commit)
72+
- `.clang-tidy` for linting (static analysis)
73+
74+
Run manually:
75+
```bash
76+
clang-format -i src/*.cpp include/**/*.hpp tests/*.cpp
77+
clang-tidy src/*.cpp -p build/gcc-RelWithDebInfo
78+
```
79+
80+
### Installation
81+
82+
Install includes, libs, and CMake config files:
83+
```bash
84+
cmake --preset gcc-RelWithDebInfo
85+
cmake --build --preset gcc-RelWithDebInfo
86+
cmake --install build/gcc-RelWithDebInfo --prefix install # or /usr/local
87+
```
88+
89+
This will install the compiled library, public headers and CMake config files for `find_package(...)` consumers.
90+
91+
#### Consuming in Another Project
92+
93+
After installation, your project can consume this library like so:
94+
```cmake
95+
find_package(modern_cpp_project REQUIRED)
96+
target_link_libraries(<your_app> PRIVATE modern_cpp_project::math)
97+
```
98+
99+
Add this to your CMake call:
100+
```bash
101+
cmake -DCMAKE_PREFIX_PATH=/path/to/install ..
102+
```
103+
104+
## License
105+
106+
This project is licensed under the Apache License 2.0.
107+
108+
You are free to use, modify, distribute, and include this code in commercial or open-source projects.
109+
110+
## Contributing
111+
112+
Pull requests are welcome. Please ensure:
113+
- Code passes all tests
114+
- Code is formatted and clang-tidy clean
115+
- Commits follow clear, atomic changes

0 commit comments

Comments
 (0)