- CMake 多目标工程:shs_core 静态库 + smart_home 可执行 + shs_tests 测试 - CMakePresets.json:debug/release/asan/coverage 四个预设(debug 告警即错误) - 自研零依赖测试框架 tests/framework/test_framework.h + 运行器(套件过滤、CTest 集成) - 工具:tools/header_check.sh 头文件独立编译检查(接口冻结门) - 已实现公共层:errors / string_utils / num_utils,main 启动自检 - 实测:debug 预设 0 告警、ctest 3/3 通过(45 项断言)
69 lines
1.9 KiB
JSON
69 lines
1.9 KiB
JSON
{
|
|
"version": 6,
|
|
"cmakeMinimumRequired": { "major": 3, "minor": 20, "patch": 0 },
|
|
"configurePresets": [
|
|
{
|
|
"name": "base",
|
|
"hidden": true,
|
|
"generator": "Unix Makefiles",
|
|
"binaryDir": "${sourceDir}/build/${presetName}",
|
|
"cacheVariables": {
|
|
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
|
}
|
|
},
|
|
{
|
|
"name": "debug",
|
|
"displayName": "Debug (告警即错误)",
|
|
"description": "开发调试用:-g、-Wall -Wextra -Wpedantic -Werror",
|
|
"inherits": "base",
|
|
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", "SHS_WERROR": "ON" }
|
|
},
|
|
{
|
|
"name": "release",
|
|
"displayName": "Release (-O2)",
|
|
"inherits": "base",
|
|
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release", "SHS_WERROR": "ON" }
|
|
},
|
|
{
|
|
"name": "asan",
|
|
"displayName": "ASan/UBSan (内存检查)",
|
|
"description": "地址与未定义行为检查:泄漏、越界、未定义行为",
|
|
"inherits": "base",
|
|
"cacheVariables": {
|
|
"CMAKE_BUILD_TYPE": "Debug",
|
|
"SHS_WERROR": "ON",
|
|
"SHS_ENABLE_SANITIZERS": "ON"
|
|
}
|
|
},
|
|
{
|
|
"name": "coverage",
|
|
"displayName": "Coverage (gcov)",
|
|
"inherits": "base",
|
|
"cacheVariables": {
|
|
"CMAKE_BUILD_TYPE": "Debug",
|
|
"SHS_ENABLE_COVERAGE": "ON"
|
|
}
|
|
}
|
|
],
|
|
"buildPresets": [
|
|
{ "name": "debug", "configurePreset": "debug" },
|
|
{ "name": "release", "configurePreset": "release" },
|
|
{ "name": "asan", "configurePreset": "asan" },
|
|
{ "name": "coverage", "configurePreset": "coverage" }
|
|
],
|
|
"testPresets": [
|
|
{
|
|
"name": "debug",
|
|
"configurePreset": "debug",
|
|
"output": { "outputOnFailure": true },
|
|
"execution": { "stopOnFailure": false }
|
|
},
|
|
{
|
|
"name": "asan",
|
|
"configurePreset": "asan",
|
|
"output": { "outputOnFailure": true },
|
|
"execution": { "stopOnFailure": false }
|
|
}
|
|
]
|
|
}
|