Skip to content

Commit 1183b54

Browse files
authored
build: add minimal local setup guidance and CMake presets
* build: add local setup README pointer * build: add minimal developer setup doc * build: add shared CMake presets
1 parent bdd6ce8 commit 1183b54

File tree

3 files changed

+139
-9
lines changed

3 files changed

+139
-9
lines changed

CMakePresets.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"version": 3,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 20,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "dev-debug",
11+
"displayName": "Local Debug",
12+
"description": "Default local debug build with tests enabled.",
13+
"binaryDir": "${sourceDir}/build/dev-debug",
14+
"cacheVariables": {
15+
"BUILD_TESTING": "ON",
16+
"CMAKE_BUILD_TYPE": "Debug",
17+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
18+
}
19+
},
20+
{
21+
"name": "ci-release",
22+
"displayName": "CI-style Release",
23+
"description": "Release build that matches the repository CI flags.",
24+
"binaryDir": "${sourceDir}/build/ci-release",
25+
"cacheVariables": {
26+
"BUILD_TESTING": "ON",
27+
"CMAKE_BUILD_TYPE": "Release"
28+
}
29+
}
30+
],
31+
"buildPresets": [
32+
{
33+
"name": "dev-debug",
34+
"configurePreset": "dev-debug",
35+
"configuration": "Debug"
36+
},
37+
{
38+
"name": "ci-release",
39+
"configurePreset": "ci-release",
40+
"configuration": "Release"
41+
}
42+
],
43+
"testPresets": [
44+
{
45+
"name": "dev-debug",
46+
"configurePreset": "dev-debug",
47+
"configuration": "Debug",
48+
"output": {
49+
"outputOnFailure": true
50+
}
51+
},
52+
{
53+
"name": "ci-release",
54+
"configurePreset": "ci-release",
55+
"configuration": "Release",
56+
"output": {
57+
"outputOnFailure": true
58+
}
59+
}
60+
]
61+
}

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,17 @@ LogLens does not currently detect:
8080
- PAM-specific failures beyond the parsed sample patterns
8181
- Cross-file or cross-host correlation
8282

83-
## Build
84-
85-
```bash
86-
cmake -S . -B build
87-
cmake --build build
88-
ctest --test-dir build --output-on-failure
89-
```
90-
91-
## Run
83+
## Build
84+
85+
```bash
86+
cmake -S . -B build
87+
cmake --build build
88+
ctest --test-dir build --output-on-failure
89+
```
90+
91+
For fresh-machine setup and repeatable local presets, see [`docs/dev-setup.md`](./docs/dev-setup.md).
92+
93+
## Run
9294

9395
```bash
9496
./build/loglens --mode syslog --year 2026 ./assets/sample_auth.log ./out

docs/dev-setup.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Developer Setup
2+
3+
This note is for contributors working in a fresh local environment. It keeps the setup small and mirrors the repository's existing CMake and CTest flow.
4+
5+
## Required Tools
6+
7+
- CMake 3.21 or newer for the shared presets in `CMakePresets.json`
8+
- CMake 3.20 or newer for the manual fallback flow
9+
- A C++20 compiler
10+
- Windows: Visual Studio 2022 or Build Tools 2022 with the MSVC v143 toolset
11+
- Linux: `g++` 10+ or `clang++` 14+ plus `make` or `ninja`
12+
- Git for normal contribution flow
13+
14+
## Quick Start With Presets
15+
16+
`CMakePresets.json` includes two repeatable local entry points:
17+
18+
- `dev-debug`: default local iteration build with tests enabled
19+
- `ci-release`: release build intended to mirror the GitHub Actions CI flags
20+
21+
Local debug iteration:
22+
23+
```bash
24+
cmake --preset dev-debug
25+
cmake --build --preset dev-debug
26+
ctest --preset dev-debug
27+
```
28+
29+
Local CI-style validation:
30+
31+
```bash
32+
cmake --preset ci-release
33+
cmake --build --preset ci-release
34+
ctest --preset ci-release
35+
```
36+
37+
## Manual Fallback
38+
39+
If you do not want to use presets, or if your local CMake is 3.20 but not 3.21+, the equivalent manual flow is:
40+
41+
```bash
42+
cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -D BUILD_TESTING=ON
43+
cmake --build build
44+
ctest --test-dir build --output-on-failure
45+
```
46+
47+
## Windows Notes
48+
49+
- Run from a Developer PowerShell for Visual Studio 2022, an x64 Native Tools prompt, or another shell where the MSVC toolchain is already available.
50+
- If `cmake` is missing from `PATH`, install either the Visual Studio C++ workload with CMake support or a standalone Kitware CMake package, then reopen the shell.
51+
- Visual Studio generators are multi-config, so the presets set `Debug` or `Release` again at build and test time for consistency.
52+
53+
## Linux Notes
54+
55+
- A small Ubuntu/Debian-style setup is usually enough:
56+
57+
```bash
58+
sudo apt install cmake g++ make
59+
```
60+
61+
- If you prefer Clang, configure manually with `-D CMAKE_CXX_COMPILER=clang++` or create a local user preset.
62+
63+
## Expected Local Outputs
64+
65+
- Build directories under `build/dev-debug` or `build/ci-release`
66+
- Test runs for `parser`, `detector`, and `cli`
67+
- `compile_commands.json` in the debug build directory when the selected generator supports it

0 commit comments

Comments
 (0)