-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
110 lines (93 loc) · 3.58 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
cmake_minimum_required(VERSION 3.24)
# Vulkan package call has to be separated out since either GLSLC or glslangValidator
# will fufill the shader requirement of the compute engine and the graphics engine
find_package(Vulkan REQUIRED)
find_package(Vulkan COMPONENTS glslc glslangValidator)
# Check if the CMP0077 policy is set and if not, set it to NEW
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
string(TIMESTAMP maj "%Y")
string(TIMESTAMP min "%m")
string(TIMESTAMP rev "%d")
project(DragonEngine VERSION ${maj}.${min}.${rev}.0)
set(Dragon_FOUND CACHE BOOL "" ON)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(FMT_MASTER_PROJECT ON)
message(STATUS "CMake version: ${CMAKE_VERSION}")
endif ()
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_C_STANDARD 23)
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
message(STATUS "Build started for ${PROJECT_NAME} Version ${PROJECT_VERSION}")
endif()
option(Dragon_INSTALL "Toggle to optionally configure the install files for DragonEngine" OFF)
option(Dragon_PACKAGE_BUILD "Toggle to optionally configure the CPack generator files" OFF)
option(Dragon_BUILD_EXAMPLES "Toggle to optionally build all the examples (dginfo is always built)" ON)
option(Dragon_BUILD_TESTS "Toggle to optionally not build the tests for DragonEngine" OFF)
option(Dragon_BUILD_DOCS "Toggle to optionally build the documentation (has no effect without Doxygen)" OFF)
option(Dragon_BUILD_DEPENDENCY_DOCS "Toggle to optionally build the documentation for Dragon's source dependencies (VkBootstrap, VMA, etc.)" OFF)
option(Dragon_NO_VULKAN "Toggle to build DragonEngine without any Vulkan or VMA support" OFF)
message(CHECK_START "Finding Dragon Submodules")
unset(missingComponents)
message(CHECK_START "Finding Dragon::Core")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/core/CMakeLists.txt)
set(DragonCore_FOUND CACHE BOOL "" ON)
message(CHECK_PASS "found sources")
add_subdirectory(modules/core)
else()
find_package(DragonCore)
if(DragonCore_FOUND)
message(CHECK_PASS "found binaries")
else()
message(CHECK_FAIL "not found")
endif()
endif()
if(DragonCore_FOUND)
message(CHECK_START "Finding Dragon::Graphics")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/graphics/CMakeLists.txt)
set(DragonGraphics_FOUND CACHE BOOL "" ON)
message(CHECK_PASS "found sources")
add_subdirectory(modules/graphics)
else()
find_package(DragonGraphics)
if(DragonGraphics_FOUND)
message(CHECK_PASS "found binaries")
else()
message(CHECK_FAIL "not found")
endif()
endif()
message(CHECK_START "Finding Dragon::Compute")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/modules/compute/CMakeLists.txt)
set(DragonCompute_FOUND CACHE BOOL "" ON)
message(CHECK_PASS "found sources")
add_subdirectory(modules/compute)
else()
find_package(DragonCompute)
if(DragonCompute_FOUND)
message(CHECK_PASS "found binaries")
else()
message(CHECK_FAIL "not found")
endif()
endif()
endif()
list(POP_BACK CMAKE_MESSAGE_INDENT)
if(missingComponents)
message(CHECK_FAIL "missing components: ${missingComponents}")
else()
message(CHECK_PASS "all components found")
endif()
if(Dragon_BUILD_TESTS)
add_subdirectory(tests)
endif()
if(Dragon_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(Dragon_BUILD_DOCS)
add_subdirectory(docs)
endif()
if(Dragon_INSTALL)
include(GNUInstallDirs)
include(cmake/install.cmake)
if(Dragon_PACKAGE_BUILD)
include(cmake/package.cmake)
endif()
endif()