更新依赖库到最新版本,C++ 标准升级到 C++20
This commit is contained in:
parent
d6c709a89b
commit
fe626858f0
3
.cursorignore
Normal file
3
.cursorignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Add directories or file patterns to ignore during indexing (e.g. foo/ or *.csv)
|
||||||
|
.cursorignore
|
||||||
|
build/
|
||||||
12
.cursorrules
12
.cursorrules
@ -27,4 +27,14 @@
|
|||||||
5. 文档结构
|
5. 文档结构
|
||||||
- 章节层次分明
|
- 章节层次分明
|
||||||
- 内容组织有序
|
- 内容组织有序
|
||||||
- 格式统一一致
|
- 格式统一一致
|
||||||
|
|
||||||
|
请遵循如下 C++ 规范:
|
||||||
|
- 使用 C++17 标准
|
||||||
|
- 使用 CMake 3.14 及以上版本
|
||||||
|
- 使用 nlohmann_json 3.11.3 版本
|
||||||
|
- 使用 FetchContent 管理第三方库
|
||||||
|
- 使用 Google Test 进行单元测试
|
||||||
|
- 使用 Google Mock 进行单元测试
|
||||||
|
- 使用 Google Benchmark 进行性能测试
|
||||||
|
- 在头文件中定义函数,在源文件中实现函数
|
||||||
|
|||||||
@ -1,13 +1,26 @@
|
|||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.14...3.27)
|
||||||
|
|
||||||
# 设置 CMake 策略
|
# 设置 CMake 策略
|
||||||
cmake_policy(SET CMP0074 NEW) # 使用 <PackageName>_ROOT 变量
|
cmake_policy(SET CMP0074 NEW) # 使用 <PackageName>_ROOT 变量
|
||||||
cmake_policy(SET CMP0167 NEW) # 使用新的 Boost 查找模块
|
cmake_policy(SET CMP0167 NEW) # 使用新的 Boost 查找模块
|
||||||
|
cmake_policy(SET CMP0135 NEW) # 设置解压时间戳行为
|
||||||
|
|
||||||
project(airport_collision_avoidance)
|
project(airport_collision_avoidance)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
# 检查编译器版本
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||||
|
message(FATAL_ERROR "GCC 版本需要 >= 10.0 以支持 C++20")
|
||||||
|
endif()
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
|
||||||
|
message(FATAL_ERROR "Clang 版本需要 >= 13.0 以支持 C++20")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# 设置输出目录
|
# 设置输出目录
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
@ -24,7 +37,7 @@ find_package(Boost REQUIRED COMPONENTS system)
|
|||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
json
|
json
|
||||||
URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
|
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(json)
|
FetchContent_MakeAvailable(json)
|
||||||
|
|
||||||
@ -63,7 +76,7 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/tests")
|
|||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
googletest
|
googletest
|
||||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||||
GIT_TAG release-1.12.1
|
GIT_TAG v1.15.2
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(googletest)
|
FetchContent_MakeAvailable(googletest)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user