🔧 chore(cpp): align conventions and formatter config

This commit is contained in:
csh
2026-07-20 09:08:37 +08:00
parent 502e1321c1
commit 1d5304e7b6
4 changed files with 36 additions and 27 deletions
+17 -11
View File
@@ -7,18 +7,23 @@
### 1.1 编译器与标准
- C++ 标准:C++23(含 Modules
- 编译器:
- 目标平台:Windows(通过 Linux 交叉编译)
- 目标平台:Windows
- 原生验证:
- 主机平台:Windows
- 工具链:项目固定并验证的 MSVC 或 clang-cl 版本
- 要求:必须完成构建和测试
- 附加交叉验证:
- 主机平台:Linux
- 工具链:`clang <版本>`交叉编译;具体 clang 可执行路径由 Conan
profile 配置)
- 工具链:`clang <版本>`具体可执行路径由 Conan profile 配置)
- 目标三元组(示例):`x86_64-w64-mingw32` / `aarch64-w64-mingw32`
- 明确记录目标 ABI 与运行时;交叉验证不能替代原生 Windows 验证
### 1.2 构建系统
- CMake`>= 4.0`
- 生成器:
- Linux`Ninja`
- Windows 原生:项目固定的 `Ninja` 或 Visual Studio 生成器
- Linux 交叉编译:`Ninja`
### 1.3 依赖管理(Conan,推荐)
@@ -49,7 +54,8 @@
### 2.1 最小构建(必须能跑)
- Conan 生成(推荐,示例):
- `CONAN_HOME=/tmp/conan-home conan install . -pr:b=conan/profiles/linux-x86_64-clang -pr:h=conan/profiles/windows-x86_64-clang-cross -of build/windows-x86_64-clang-cross --build=missing`
- Windows 原生:`conan install . -pr:b=<windows-build-profile> -pr:h=<windows-host-profile> -of build/windows-native --build=missing`
- Linux 交叉验证:`CONAN_HOME=/tmp/conan-home conan install . -pr:b=conan/profiles/linux-x86_64-clang -pr:h=conan/profiles/windows-x86_64-clang-cross -of build/windows-x86_64-clang-cross --build=missing`
- 配置(示例):
- `cmake --preset conan-release`
- 构建(示例):
@@ -57,8 +63,9 @@
### 2.2 运行冒烟(建议)
- `build/<app_or_tool> <args>`
- 或:`cmake --build build -t run_smoke`(如项目提供自定义 target
- Windows 原生环境必须运行项目测试,例如:
`ctest --preset conan-release --output-on-failure`
- Linux 交叉编译可以执行额外的编译期检查;未在目标运行时执行的产物不能代替原生测试。
### 2.3 格式化检查(建议)
@@ -86,6 +93,5 @@
- `CMakeUserPresets.json` 不是强制标准,仅作为一种推荐落地方式(模板见
`templates/cpp/CMakeUserPresets.json`)。
不在本 Playbook 中强制规定工具链分发方式(例如某种特定打包形态);只要求把交叉编译所需的
`compiler_executables`、triplet、system_name 等写进 Conan
profile,保证命令可复现。
不在本 Playbook 中强制规定工具链分发方式(例如某种特定打包形态)。原生与交叉编译 profile
必须记录所需的 `compiler_executables`、triplet、system_name、ABI 与运行时,保证命令可复现。