重整cmake

This commit is contained in:
2026-08-11 14:55:46 +08:00
parent f09bfa86a3
commit 5401a14708
24 changed files with 460 additions and 3369 deletions
+33 -19
View File
@@ -1,20 +1,34 @@
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR})
cmake_minimum_required(VERSION 3.16)
# cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>")
project(Renderive)
set(Renderive_VERSION 1.0.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(third_party/build_infra/start.cmake)
include(third_party/CPP_Core/main.cmake)
include(${CMAKE_SOURCE_DIR}/main.cmake)
include(third_party/build_infra/end.cmake)
else ()
cmake_minimum_required(VERSION 3.20)
project(Renderive VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(RENDERIVE_BUILD_2D "Build 2D renderer" ON)
option(RENDERIVE_BUILD_QT "Build Qt integration" ON)
option(RENDERIVE_BUILD_WEB "Build Web integration" ON)
option(RENDERIVE_BUILD_TESTS "Build tests" ON)
option(RENDERIVE_BUILD_3D "Build 3D renderer" OFF)
if (RENDERIVE_BUILD_QT AND NOT RENDERIVE_BUILD_2D)
message(FATAL_ERROR "RENDERIVE_BUILD_QT requires RENDERIVE_BUILD_2D")
endif ()
if (RENDERIVE_BUILD_WEB AND NOT RENDERIVE_BUILD_2D)
message(FATAL_ERROR "RENDERIVE_BUILD_WEB requires RENDERIVE_BUILD_2D")
endif ()
if (RENDERIVE_BUILD_3D)
message(FATAL_ERROR "RENDERIVE_BUILD_3D is reserved; the 3D renderer is not implemented")
endif ()
include("${CMAKE_CURRENT_LIST_DIR}/third_party/build_infra/start.cmake")
if (RENDERIVE_BUILD_TESTS)
enable_testing()
endif ()
add_subdirectory(Kernel)
if (RENDERIVE_BUILD_2D)
add_subdirectory(render_2D)
endif ()
if (RENDERIVE_BUILD_QT)
add_subdirectory(Qt)
endif ()
if (RENDERIVE_BUILD_WEB)
add_subdirectory(web_server)
endif ()
include("${CMAKE_CURRENT_LIST_DIR}/cmake/RenderivePackage.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/third_party/build_infra/end.cmake")