搭建代码框架并更新文档
This commit is contained in:
49
CMakeLists.txt
Normal file
49
CMakeLists.txt
Normal file
@@ -0,0 +1,49 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(DisplayFlow VERSION 1.0.0 LANGUAGES CXX)
|
||||
|
||||
# 设置 C++ 标准
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# 输出目录
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
|
||||
# 编译选项
|
||||
if(MSVC)
|
||||
add_compile_options(/W4 /WX-)
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
||||
else()
|
||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
endif()
|
||||
|
||||
# 平台检测
|
||||
if(ANDROID)
|
||||
set(PLATFORM_ANDROID ON)
|
||||
elseif(WIN32)
|
||||
set(PLATFORM_WINDOWS ON)
|
||||
elseif(APPLE)
|
||||
set(PLATFORM_MACOS ON)
|
||||
elseif(UNIX)
|
||||
set(PLATFORM_LINUX ON)
|
||||
endif()
|
||||
|
||||
# 添加子目录
|
||||
add_subdirectory(core)
|
||||
|
||||
# 根据平台添加对应的平台适配层
|
||||
if(PLATFORM_ANDROID)
|
||||
add_subdirectory(platforms/android)
|
||||
elseif(PLATFORM_WINDOWS)
|
||||
add_subdirectory(platforms/windows)
|
||||
endif()
|
||||
|
||||
# 添加测试(如果启用)
|
||||
option(BUILD_TESTS "Build tests" OFF)
|
||||
if(BUILD_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user