-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
143 lines (108 loc) · 4.21 KB
/
Copy pathCMakeLists.txt
File metadata and controls
143 lines (108 loc) · 4.21 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Copyright (c) 2022 Dhiraj Wishal
# Main build script for Rapid
# Set the minimum required CMake version.
cmake_minimum_required(VERSION 3.18.4)
# Set the basic project description.
project(
Rapid
VERSION 1.0.0
DESCRIPTION "Visual programming editor primarily built for game engines."
)
# Set the CMake C++ standard.
set(CMAKE_CXX_STANDARD 20)
# Set the main include directory for the engine.
set(RAPID_EDITOR_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Editor)
# Set the Vulkan headers include directory.
set(VULKAN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/Vulkan-Headers/include)
# Set the volk include directory and the library project
set(VOLK_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/volk)
add_library(
volk
STATIC
${VOLK_INCLUDE_DIR}/volk.c
)
set_property(TARGET volk PROPERTY CXX_STANDARD 20)
if(NOT MSVC)
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -ldl")
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
endif()
# Add the Vulkan include directory for the volk library.
target_include_directories(volk PUBLIC ${VULKAN_INCLUDE_DIR})
# Set the Vulkan memory allocator include directory.
set(VMA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/VulkanMemoryAllocator/include)
# Set the SPIRV Reflect include directory and the library project.
set(SPIRV_REFLECT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/SPIRV-Reflect)
add_library(
SPIRV_Reflect
STATIC
${SPIRV_REFLECT_INCLUDE_DIR}/spirv_reflect.cpp
)
set_property(TARGET SPIRV_Reflect PROPERTY CXX_STANDARD 20)
# Set the spdlog library and add it as a target library.
set(SPDLOG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/include)
add_library(
spdlog
STATIC
${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/src/async.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/src/cfg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/src/color_sinks.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/src/file_sinks.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/src/fmt.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/src/spdlog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/src/stdout_sinks.cpp
)
set_property(TARGET spdlog PROPERTY CXX_STANDARD 20)
target_include_directories(spdlog PUBLIC ${SPDLOG_INCLUDE_DIR})
target_compile_definitions(spdlog PUBLIC SPDLOG_COMPILED_LIB)
# Set the imgui library and add it as a target library.
set(IMGUI_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/imgui)
add_library(
imgui
STATIC
${IMGUI_INCLUDE_DIR}/imgui.cpp
${IMGUI_INCLUDE_DIR}/imgui_demo.cpp
${IMGUI_INCLUDE_DIR}/imgui_draw.cpp
${IMGUI_INCLUDE_DIR}/imgui_tables.cpp
${IMGUI_INCLUDE_DIR}/imgui_widgets.cpp
)
set_property(TARGET imgui PROPERTY CXX_STANDARD 20)
# Add the imnodes library as a target and also set the include directory.
set(IMNODES_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/imnodes)
add_library(
imnodes
STATIC
${IMNODES_INCLUDE_DIR}/imnodes.cpp
)
target_include_directories(imnodes PUBLIC ${IMGUI_INCLUDE_DIR})
# Add the sdl library as a subdirectory and set the include directory.
add_subdirectory(ThirdParty/SDL)
set(SDL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/SDL/include)
# Add the json parser include directory.
set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/json/include)
# Set the output directories to where we want them to be.
set_target_properties(SDL2
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Editor/Application"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Editor/Application"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Editor/Application"
)
# Set global compile definitions.
add_compile_definitions(
$<$<CONFIG:Debug>:RAPID_DEBUG>
$<$<CONFIG:Release>:RAPID_RELEASE>
$<$<CONFIG:RelWithDebInfo>:RAPID_DEBUG>
$<$<CONFIG:MinSizeRel>:RAPID_RELEASE>
$<$<PLATFORM_ID:Windows>:RAPID_PLATFORM_WINDOWS>
$<$<PLATFORM_ID:Linux>:RAPID_PLATFORM_LINUX>
$<$<PLATFORM_ID:Darwin>:RAPID_PLATFORM_MAC>
)
# Add the required subdirectories.
add_subdirectory(Editor/Application)
add_subdirectory(Editor/Backend)
add_subdirectory(Editor/Core)
add_subdirectory(Editor/Frontend)