mudlet/CMakePresets.json
Mike Conley 6705cadd11
Infra: Add CMake presets for every platform, and one home for AI assistant skills (#9742)
#### Brief overview of PR changes/additions

- Adds `CMakePresets.json` with configure, build and test presets for
macOS, Linux and Windows, including sanitizer and static-analysis
variants. Each is gated on the host system, so a listing only offers
what the current machine can build.
- Consolidates the AI assistant skills into `.agents/skills/`, which
Claude Code, GitHub Copilot and Cursor all read, replacing two copies
that had drifted into contradicting each other.
- Corrects the build documentation: the Windows toolchain is CLANG64
rather than MinGW64, and the previous "no need to specify number of
jobs" advice holds only for Ninja.

#### Motivation for adding to Mudlet

The instructions presented platform-specific build advice as though it
were universal, so following them on the wrong platform produced either
an unbounded parallel build or a toolchain the setup scripts refuse to
run.

#### Other info (issues closed, discussion etc)

`windows-debug` has been exercised on Windows: `CI/setup-windows-sdk.sh`
in an MSYS2 CLANG64 shell, then configure and build both to completion
against Qt 6.11.1 and Clang 22.1.7. `cmake --list-presets` correctly
offered only `windows-debug` there.

Note that `windows-debug` is a Debug configuration, whereas
`CI/build-mudlet-for-windows.sh` builds Release, so the two are not
equivalent.

`.claude/skills` is a symlink to `.agents/skills`, following the
existing pattern used by `CLAUDE.md`, `AGENTS.md` and `.cursorrules`. On
Windows checkouts without `core.symlinks` it lands as a plain file, in
which case Copilot and Cursor still read `.agents/skills` directly.

**Test case:** `cmake --preset macos-debug && cmake --build --preset
macos-debug`, then `ctest --preset macos-debug`. `cmake --list-presets`
should offer only the current platform's presets, and a variant such as
`macos-debug-nosan` should build into `build-macos-debug-nosan/` while
leaving `build/` untouched.

---------

Signed-off-by: Michael Conley <sousesider@gmail.com>
2026-08-12 21:28:13 +02:00

228 lines
6.9 KiB
JSON

{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 25,
"patch": 1
},
"configurePresets": [
{
"name": "base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "variant",
"hidden": true,
"inherits": "base",
"binaryDir": "${sourceDir}/build-${presetName}"
},
{
"name": "macos-debug",
"displayName": "macOS Debug (Ninja, AddressSanitizer)",
"inherits": "base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "macos-debug-nosan",
"displayName": "macOS Debug, no sanitizers (fastest build and run)",
"inherits": ["variant", "macos-debug"],
"cacheVariables": {
"USE_SANITIZER": ""
}
},
{
"name": "macos-debug-tsan",
"displayName": "macOS Debug, ThreadSanitizer",
"inherits": ["variant", "macos-debug"],
"cacheVariables": {
"USE_SANITIZER": "Thread"
}
},
{
"name": "macos-debug-ubsan",
"displayName": "macOS Debug, UndefinedBehaviorSanitizer",
"inherits": ["variant", "macos-debug"],
"cacheVariables": {
"USE_SANITIZER": "Undefined"
}
},
{
"name": "macos-static-analysis",
"displayName": "macOS Debug with clang-tidy and cppcheck",
"inherits": ["variant", "macos-debug"],
"cacheVariables": {
"ENABLE_STATIC_ANALYSIS": "ON"
}
},
{
"name": "linux-debug",
"displayName": "Linux Debug (Ninja, AddressSanitizer)",
"inherits": "base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "linux-debug-nosan",
"displayName": "Linux Debug, no sanitizers (fastest build and run)",
"inherits": ["variant", "linux-debug"],
"cacheVariables": {
"USE_SANITIZER": ""
}
},
{
"name": "linux-debug-tsan",
"displayName": "Linux Debug, ThreadSanitizer",
"inherits": ["variant", "linux-debug"],
"cacheVariables": {
"USE_SANITIZER": "Thread"
}
},
{
"name": "linux-debug-ubsan",
"displayName": "Linux Debug, UndefinedBehaviorSanitizer",
"inherits": ["variant", "linux-debug"],
"cacheVariables": {
"USE_SANITIZER": "Undefined"
}
},
{
"name": "linux-static-analysis",
"displayName": "Linux Debug with clang-tidy and cppcheck",
"inherits": ["variant", "linux-debug"],
"cacheVariables": {
"ENABLE_STATIC_ANALYSIS": "ON"
}
},
{
"name": "linux-lowspec",
"displayName": "Linux Debug for low-memory machines (Raspberry Pi and similar)",
"inherits": ["variant", "linux-debug"],
"cacheVariables": {
"USE_SANITIZER": "",
"USE_UPDATER": "OFF",
"USE_3DMAPPER": "OFF"
}
},
{
"name": "windows-debug",
"displayName": "Windows Debug (MSYS2, Ninja)",
"inherits": "base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"CMAKE_PREFIX_PATH": "$env{MSYSTEM_PREFIX}"
}
}
],
"buildPresets": [
{
"name": "on-macos",
"hidden": true,
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "on-linux",
"hidden": true,
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{ "name": "macos-debug", "inherits": "on-macos", "configurePreset": "macos-debug" },
{ "name": "macos-debug-nosan", "inherits": "on-macos", "configurePreset": "macos-debug-nosan" },
{ "name": "macos-debug-tsan", "inherits": "on-macos", "configurePreset": "macos-debug-tsan" },
{ "name": "macos-debug-ubsan", "inherits": "on-macos", "configurePreset": "macos-debug-ubsan" },
{ "name": "macos-static-analysis", "inherits": "on-macos", "configurePreset": "macos-static-analysis" },
{ "name": "linux-debug", "inherits": "on-linux", "configurePreset": "linux-debug" },
{ "name": "linux-debug-nosan", "inherits": "on-linux", "configurePreset": "linux-debug-nosan" },
{ "name": "linux-debug-tsan", "inherits": "on-linux", "configurePreset": "linux-debug-tsan" },
{ "name": "linux-debug-ubsan", "inherits": "on-linux", "configurePreset": "linux-debug-ubsan" },
{ "name": "linux-static-analysis", "inherits": "on-linux", "configurePreset": "linux-static-analysis" },
{
"name": "linux-lowspec",
"inherits": "on-linux",
"configurePreset": "linux-lowspec",
"jobs": 2
},
{
"name": "windows-debug",
"configurePreset": "windows-debug",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
}
],
"testPresets": [
{
"name": "test-defaults",
"hidden": true,
"output": {
"outputOnFailure": true
}
},
{
"name": "on-macos",
"hidden": true,
"inherits": "test-defaults",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "on-linux",
"hidden": true,
"inherits": "test-defaults",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{ "name": "macos-debug", "inherits": "on-macos", "configurePreset": "macos-debug" },
{ "name": "macos-debug-nosan", "inherits": "on-macos", "configurePreset": "macos-debug-nosan" },
{ "name": "macos-debug-tsan", "inherits": "on-macos", "configurePreset": "macos-debug-tsan" },
{ "name": "macos-debug-ubsan", "inherits": "on-macos", "configurePreset": "macos-debug-ubsan" },
{ "name": "macos-static-analysis", "inherits": "on-macos", "configurePreset": "macos-static-analysis" },
{ "name": "linux-debug", "inherits": "on-linux", "configurePreset": "linux-debug" },
{ "name": "linux-debug-nosan", "inherits": "on-linux", "configurePreset": "linux-debug-nosan" },
{ "name": "linux-debug-tsan", "inherits": "on-linux", "configurePreset": "linux-debug-tsan" },
{ "name": "linux-debug-ubsan", "inherits": "on-linux", "configurePreset": "linux-debug-ubsan" },
{ "name": "linux-static-analysis", "inherits": "on-linux", "configurePreset": "linux-static-analysis" },
{ "name": "linux-lowspec", "inherits": "on-linux", "configurePreset": "linux-lowspec" },
{
"name": "windows-debug",
"inherits": "test-defaults",
"configurePreset": "windows-debug",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
}
]
}