chore: update development setup and configuration for improved usability

- Modified `.vscode/settings.json` to use workspace-relative paths for `compileCommands` and `buildDirectory`, enhancing portability across different environments.
- Updated task labels in `tasks.json` for clarity, renaming them to reflect their specific CMake operations.
- Added new tasks for cleaning builds and running tests, streamlining the development workflow.

Benefits:
- Improves the development experience by ensuring configurations are adaptable and tasks are clearly defined, facilitating easier project management.
This commit is contained in:
scawful
2025-10-31 20:21:05 -04:00
parent ef07dc0012
commit 91b3c9ede9
2 changed files with 43 additions and 8 deletions

View File

@@ -413,3 +413,4 @@ cmake --build build
5. Submit a pull request 5. Submit a pull request
For more details, see [CONTRIBUTING.md](CONTRIBUTING.md). For more details, see [CONTRIBUTING.md](CONTRIBUTING.md).

View File

@@ -170,15 +170,21 @@ configure_ide() {
cat > .vscode/settings.json << EOF cat > .vscode/settings.json << EOF
{ {
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"C_Cpp.default.compileCommands": "build/compile_commands.json", "C_Cpp.default.compileCommands": "\${workspaceFolder}/build/compile_commands.json",
"C_Cpp.default.intelliSenseMode": "macos-clang-x64", "C_Cpp.default.intelliSenseMode": "macos-clang-x64",
"files.associations": { "files.associations": {
"*.h": "c", "*.h": "c",
"*.cc": "cpp" "*.cc": "cpp"
}, },
"cmake.buildDirectory": "build", "cmake.buildDirectory": "\${workspaceFolder}/build",
"cmake.configureOnOpen": true, "cmake.configureOnOpen": true,
"cmake.generator": "Ninja" "cmake.useCMakePresets": "always",
"cmake.generator": "Ninja Multi-Config",
"cmake.preferredGenerators": [
"Ninja Multi-Config",
"Ninja",
"Unix Makefiles"
]
} }
EOF EOF
@@ -187,11 +193,12 @@ EOF
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "build", "label": "CMake: Configure (dev)",
"type": "shell", "type": "shell",
"command": "cmake", "command": "cmake",
"args": ["--build", "build"], "args": ["--preset", "dev"],
"group": "build", "group": "build",
"problemMatcher": [],
"presentation": { "presentation": {
"echo": true, "echo": true,
"reveal": "always", "reveal": "always",
@@ -200,11 +207,37 @@ EOF
} }
}, },
{ {
"label": "configure", "label": "CMake: Build (dev)",
"type": "shell", "type": "shell",
"command": "cmake", "command": "cmake",
"args": ["--preset", "dev"], "args": ["--build", "--preset", "dev"],
"group": "build" "group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["\$gcc"],
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
}
},
{
"label": "CMake: Clean Build",
"type": "shell",
"command": "cmake",
"args": ["--build", "--preset", "dev", "--target", "clean"],
"group": "build",
"problemMatcher": []
},
{
"label": "CMake: Run Tests",
"type": "shell",
"command": "ctest",
"args": ["--preset", "stable", "--output-on-failure"],
"group": "test",
"problemMatcher": []
} }
] ]
} }
@@ -286,3 +319,4 @@ main() {
# Run main function # Run main function
main "$@" main "$@"