-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
106 lines (89 loc) · 2.86 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
cmake_minimum_required(VERSION 3.25)
project("Vixen")
set(ENGINE_NAME "Vixen")
set(ENGINE_VERSION_MAJOR 1)
set(ENGINE_VERSION_MINOR 0)
set(ENGINE_VERSION_PATCH 0)
if (CMAKE_BUILD_TYPE MATCHES "Release")
set(ENGINE_VERSION_STATUS "stable")
else ()
set(ENGINE_VERSION_STATUS "dev")
endif ()
set(ENGINE_VERSION "${ENGINE_VERSION_MAJOR}.${ENGINE_VERSION_MINOR}.${ENGINE_VERSION_PATCH}.${ENGINE_VERSION_STATUS}")
add_compile_definitions(
ENGINE_NAME="${ENGINE_NAME}"
ENGINE_VERSION_MAJOR=${ENGINE_VERSION_MAJOR}
ENGINE_VERSION_MINOR=${ENGINE_VERSION_MINOR}
ENGINE_VERSION_PATCH=${ENGINE_VERSION_PATCH}
ENGINE_VERSION_STATUS="${ENGINE_VERSION_STATUS}"
ENGINE_VERSION="${ENGINE_VERSION}"
)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_link_options(-stdlib=libc++ -static)
else ()
add_link_options(-std=c++23 -static -static-libstdc++ -static-libgcc)
endif ()
add_compile_options(-Wall -Wextra -Wpedantic)
if (CMAKE_BUILD_TYPE MATCHES "Release")
add_link_options(-O2)
endif ()
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif ()
set(SKIP_INSTALL_ALL ON)
include(FetchContent)
find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED)
option(ENABLE_VULKAN "Enable or disable Vulkan support" ON)
option(ENABLE_D3D12 "Enable or disable D3D12 support" OFF)
option(ENABLE_OPENGL "Enable or disable OpenGL support" OFF)
option(ENABLE_TESTS "Enable or disable building of the tests" ON)
option(ENABLE_EDITOR "Enable or disable the editor" ON)
if (CMAKE_BUILD_TYPE MATCHES "Debug")
add_compile_definitions(DEBUG_ENABLED)
elseif (CMAKE_BUILD_TYPE MATCHES "Release")
if (WIN32)
add_link_options(-mwindows)
endif ()
endif ()
if (ENABLE_VULKAN)
add_compile_definitions(VULKAN_ENABLED)
endif ()
if (ENABLE_D3D12)
add_compile_definitions(D3D12_ENABLED)
endif ()
if (ENABLE_OPENGL)
add_compile_definitions(OPENGL_ENABLED)
endif ()
add_subdirectory(thirdparty/glfw)
set(ENABLE_OPT "OFF")
add_subdirectory(thirdparty/glslang)
add_subdirectory(thirdparty/SPIRV-Cross)
add_subdirectory(thirdparty/glm)
add_subdirectory(thirdparty/spdlog)
set(ASSIMP_WARNINGS_AS_ERRORS "OFF")
set(ASSIMP_INSTALL "OFF")
set(ASSIMP_BUILD_TESTS "OFF")
set(BUILD_SHARED_LIBS "OFF")
add_subdirectory(thirdparty/assimp)
add_subdirectory(core)
if (ENABLE_VULKAN)
add_subdirectory(thirdparty/VulkanMemoryAllocator)
add_subdirectory(thirdparty/volk)
add_subdirectory(platform/vulkan)
endif ()
if (ENABLE_D3D12)
add_subdirectory(platform/d3d12)
endif ()
if (ENABLE_OPENGL)
add_subdirectory(platform/opengl)
endif ()
if (ENABLE_EDITOR)
add_subdirectory(editor)
endif ()