Skip to content

Commit 0e078ac

Browse files
committed
Some interim tidy
1 parent 9fedcc2 commit 0e078ac

File tree

3 files changed

+57
-14
lines changed

3 files changed

+57
-14
lines changed

CMakeSettings.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
"configurations": [
33
{
4-
"name": "x64-Debug",
4+
"name": "No-CMake",
5+
"description": "Default",
56
"generator": "Ninja",
6-
"configurationType": "Debug",
7-
"inheritEnvironments": [ "msvc_x64_x64" ],
8-
"buildRoot": "${projectDir}\\out\\build\\${name}",
9-
"installRoot": "${projectDir}\\out\\install\\${name}",
7+
"buildRoot": "${projectDir}\\build-${name}",
8+
"installRoot": "${projectDir}\\install-${name}",
109
"cmakeCommandArgs": "",
1110
"buildCommandArgs": "",
1211
"ctestCommandArgs": ""

cmake/CMakeUserPresets.json.sample

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
"version": 3,
33
"configurePresets": [
44
{
5-
"name": "my-arm-bin",
6-
"inherits": "stm32l4",
5+
"name": "my-stm32l4",
6+
"displayName": "my STM32L4",
7+
"inherits": [
8+
"stm32l4"
9+
],
10+
"generator": "Ninja",
11+
"binaryDir": "${sourceDir}/build-my-stm32l4",
712
"cacheVariables": {
8-
"ARM_GCC_BIN": "C:/Tools/arm-none-eabi-14.2/bin"
13+
"ARM_GCC_BIN": "C:/SysGCC/arm-eabi/bin",
14+
"HOST_CC": "C:/Program Files/LLVM/bin/clang.exe"
915
}
1016
}
1117
],
1218
"buildPresets": [
1319
{
14-
"name": "my-arm-bin",
15-
"configurePreset": "my-arm-bin"
20+
"name": "my-stm32l4",
21+
"configurePreset": "my-stm32l4"
1622
}
1723
]
1824
}

cmake/README.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ set(USE_DOT_CONFIG false)
2121

2222
## cmake directory overview
2323

24-
- [../CMakeLists.txt](../CMakeLists.txt) - Top-level CMake entry that configures the wolfBoot build.
24+
- [`WOLFBOOT_ROOT`/CMakeLists.txt](../CMakeLists.txt) - Top-level CMake entry that configures the wolfBoot build.
2525
Used to initialize the project, include cmake/wolfboot.cmake, set options, and define targets.
2626
This file is where `project()` is declared and where toolchain logic or preset imports begin.
2727

28-
- [../CMakePresets.json](../CMakePresets.json) - OS-agnostic CMake preset definitions.
28+
- [`WOLFBOOT_ROOT`/CMakePresets.json](../CMakePresets.json) - OS-agnostic CMake preset definitions.
2929
Used by `cmake --preset {name}` and `cmake --build --preset {name}` to apply consistent settings.
3030
Centralizes toolchain paths, target names, build directories, and key cache variables such as:
3131
`{ "CMAKE_TOOLCHAIN_FILE": "cmake/toolchain_arm-none-eabi.cmake", "WOLFBOOT_TARGET": "stm32l4" }`.
3232

33-
- [../CMakeSettings.json](../CMakeSettings.json) - Visual Studio integration file.
33+
- [`WOLFBOOT_ROOT`/CMakeSettings.json](../CMakeSettings.json) - Visual Studio integration file.
3434
Maps Visual Studio configurations (Debug, Release) to existing CMake presets.
3535
Controls IntelliSense, environment variables, and the preset shown in the VS CMake toolbar.
3636

@@ -66,11 +66,12 @@ Controls IntelliSense, environment variables, and the preset shown in the VS CMa
6666

6767
- [downloads/stm32l4.cmake](./downloads/stm32l4.cmake) - STM32L4 fetch script for HAL and CMSIS.
6868

69+
- [`WOLFBOOT_ROOT`/.vs/VSWorkspaceSettings.json](../.vs/VSWorkspaceSettings.json) - Exclusion directories: Visual Studio tries to be "helpful" and open a solution file. This is undesired when opening a directory as a CMake project.
6970
---
7071

7172
### Build with cmake using `.config` files
7273

73-
Presets are preferred, see below.
74+
Presets are preferred instead of `.config`, see below.
7475

7576
To use `.config` files instead of presets,
7677

@@ -148,6 +149,43 @@ cmake --preset stm32h7
148149
cmake --build --preset stm32h7
149150
```
150151

152+
### CMake User Presets.
153+
154+
See the [CMakeUserPresets.json.sample(./CMakeUserPresets.json.sample).
155+
Copy the file to `WOLFBOOT_ROOT` and remove the`.sample` suffix: `CMakeUserPresets.json`.
156+
157+
It is critically important that none the names of a user preset do not conflict with regular presets.
158+
159+
For instance, the sample extends and overrides some of the `stm32l4` settings,
160+
using LLVM clang on Windows, and prefixes ALL the names with `my-`:
161+
162+
```json
163+
{
164+
"version": 3,
165+
"configurePresets": [
166+
{
167+
"name": "my-stm32l4",
168+
"displayName": "my STM32L4",
169+
"inherits": [
170+
"stm32l4"
171+
],
172+
"generator": "Ninja",
173+
"binaryDir": "${sourceDir}/build-my-stm32l4",
174+
"cacheVariables": {
175+
"ARM_GCC_BIN": "C:/SysGCC/arm-eabi/bin",
176+
"HOST_CC": "C:/Program Files/LLVM/bin/clang.exe"
177+
}
178+
}
179+
],
180+
"buildPresets": [
181+
{
182+
"name": "my-stm32l4",
183+
"configurePreset": "my-stm32l4"
184+
}
185+
]
186+
}
187+
```
188+
151189

152190
From the [docs for CMake Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html):
153191

0 commit comments

Comments
 (0)