Squashed 'docs/standards/playbook/' content from commit e504a68
git-subtree-dir: docs/standards/playbook git-subtree-split: e504a689dcf2e2fdeeb64097930347d504e68f5f
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
---
|
||||
Language: Cpp
|
||||
BasedOnStyle: Google
|
||||
|
||||
# Keep consistent with the repo-wide 100 char guidance (adjust per-project if needed).
|
||||
ColumnLimit: 100
|
||||
|
||||
AccessModifierOffset: -4
|
||||
AlignEscapedNewlines: Left
|
||||
AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: false
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakInheritanceList: AfterColon
|
||||
CommentPragmas: "suppress"
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
Cpp11BracedListStyle: false
|
||||
FixNamespaceComments: false
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
- Regex: '^.*(precomp|pch|stdafx)'
|
||||
Priority: -1
|
||||
- Regex: '^".*"'
|
||||
Priority: 1
|
||||
- Regex: '^<.*>'
|
||||
Priority: 2
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: "BEGIN_TEST_METHOD_PROPERTIES|BEGIN_MODULE|BEGIN_TEST_CLASS|BEGIN_TEST_METHOD"
|
||||
MacroBlockEnd: "END_TEST_METHOD_PROPERTIES|END_MODULE|END_TEST_CLASS|END_TEST_METHOD"
|
||||
NamespaceIndentation: All
|
||||
PointerAlignment: Left
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: false
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
CompileFlags:
|
||||
# Point clangd to a CMake compilation database (compile_commands.json).
|
||||
#
|
||||
# Recommended: keep this aligned with your Conan/CMake preset output directory.
|
||||
# Example (this playbook's default cross build folder):
|
||||
CompilationDatabase: build/windows-x86_64-clang-cross/Release
|
||||
|
||||
---
|
||||
If:
|
||||
PathMatch: [.*\\.hpp, .*\\.hxx, .*\\.cpp, .*\\.cc, .*\\.cxx, .*\\.cppm, .*\\.ixx, .*\\.mpp]
|
||||
|
||||
CompileFlags:
|
||||
Add:
|
||||
- "-std=c++23"
|
||||
Compiler: clang++
|
||||
|
||||
---
|
||||
If:
|
||||
PathMatch: [.*\\.h, .*\\.c]
|
||||
|
||||
CompileFlags:
|
||||
Add:
|
||||
- "-std=c17"
|
||||
Compiler: clang
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
cmake_minimum_required(VERSION 4.2)
|
||||
|
||||
# Enable C++23 Modules + (optional) `import std;` with experimental std module.
|
||||
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444")
|
||||
|
||||
project(app LANGUAGES C CXX)
|
||||
|
||||
set(CMAKE_CXX_SCAN_FOR_MODULES ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_MODULE_STD 1)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Toolchain-specific flags (libc++/runtime/linker/etc) should come from your Conan toolchain/profile.
|
||||
|
||||
# Example: entrypoint built from main.cc; modules live in .cppm files.
|
||||
add_executable(app main.cc)
|
||||
|
||||
# If you use C++ Modules, list module interface units explicitly and keep this in sync:
|
||||
#
|
||||
# target_sources(app
|
||||
# PRIVATE
|
||||
# FILE_SET cxx_modules TYPE CXX_MODULES FILES
|
||||
# modules/app.cppm
|
||||
# )
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": 4,
|
||||
"vendor": {
|
||||
"conan": {}
|
||||
},
|
||||
"include": [
|
||||
"build/windows-x86_64-clang-cross/Release/generators/CMakePresets.json"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
# Linux (Clang)
|
||||
#
|
||||
# Profile naming convention (suggested):
|
||||
# linux-<arch>-clang<major>
|
||||
# If the repo only supports one clang version, you may omit the <major> suffix.
|
||||
|
||||
[settings]
|
||||
os=Linux
|
||||
arch=x86_64
|
||||
compiler=clang
|
||||
compiler.version=20
|
||||
compiler.libcxx=libc++
|
||||
compiler.cppstd=23
|
||||
build_type=Release
|
||||
|
||||
[conf]
|
||||
# Prefer pinning the exact compiler executables to avoid PATH drift.
|
||||
tools.build:compiler_executables={"c": "/usr/bin/clang", "cpp": "/usr/bin/clang++"}
|
||||
tools.cmake.cmaketoolchain:generator=Ninja
|
||||
|
||||
# Keep Conan's cmake_layout output stable and predictable.
|
||||
tools.cmake.cmake_layout:build_folder=.
|
||||
tools.cmake.cmake_layout:build_folder_vars=[]
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# Windows target cross (Clang) from Linux host
|
||||
#
|
||||
# IMPORTANT:
|
||||
# - This profile describes the *output platform* (target), so [settings] os=Windows.
|
||||
# - Use a "windows-..." prefix to avoid misleading readers into thinking the output is Linux.
|
||||
#
|
||||
# Profile naming convention (suggested):
|
||||
# windows-<arch>-clang<major>-cross
|
||||
|
||||
[settings]
|
||||
os=Windows
|
||||
arch=x86_64
|
||||
compiler=clang
|
||||
compiler.version=20
|
||||
compiler.runtime=static
|
||||
compiler.libcxx=libc++
|
||||
compiler.cppstd=23
|
||||
build_type=Release
|
||||
|
||||
[conf]
|
||||
# Configure your cross clang executables here (do NOT hardcode a specific distro name in docs).
|
||||
tools.build:compiler_executables={"c": "<TOOLCHAIN_ROOT>/bin/x86_64-w64-mingw32-clang", "cpp": "<TOOLCHAIN_ROOT>/bin/x86_64-w64-mingw32-clang++"}
|
||||
|
||||
# Tell Conan/CMake the target triple and platform.
|
||||
tools.gnu:host_triplet=x86_64-w64-mingw32
|
||||
tools.cmake.cmaketoolchain:generator=Ninja
|
||||
tools.cmake.cmaketoolchain:system_name=Windows
|
||||
tools.cmake.cmaketoolchain:system_processor=x86_64
|
||||
tools.cmake.cmaketoolchain:system_version=11
|
||||
|
||||
# Keep Conan's cmake_layout output stable and predictable.
|
||||
tools.cmake.cmake_layout:build_folder=.
|
||||
tools.cmake.cmake_layout:build_folder_vars=[]
|
||||
|
||||
[buildenv]
|
||||
# Resource compiler (optional; adjust if your toolchain uses a different windres name/path).
|
||||
RC=x86_64-w64-mingw32-windres
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
[requires]
|
||||
# 本仓库是“模板/标准”仓库:默认不内置任何依赖版本。
|
||||
# 在具体项目中按需添加,并由项目自行锁版本(建议配合 lockfile / 版本策略)。
|
||||
#
|
||||
# 示例(请按项目实际替换/增删):
|
||||
# fmt/12.0.0
|
||||
# spdlog/1.16.0
|
||||
|
||||
[generators]
|
||||
CMakeDeps
|
||||
CMakeToolchain
|
||||
|
||||
[options]
|
||||
# 示例(请按项目实际替换/增删):
|
||||
# spdlog/*:header_only=True
|
||||
# fmt/*:header_only=True
|
||||
|
||||
[layout]
|
||||
cmake_layout
|
||||
|
||||
# 参考命令(按项目 profile/路径调整):
|
||||
# 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
|
||||
# cmake --build --preset conan-release -j 8
|
||||
# ctest --preset conan-release --output-on-failure
|
||||
Reference in New Issue
Block a user