-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
235 lines (177 loc) · 5.23 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
cmake_minimum_required(VERSION 3.12)
project("luminoveau" VERSION 0.0.1 DESCRIPTION "Luminoveau")
option(ADD_IMGUI "Include ImGui" OFF)
# Add the content from the provided "engine.cmake" file
add_library("luminoveau" STATIC
luminoveau.h
audio/audiohandler.cpp
audio/audiohandler.h
configuration/configuration.h
text/texthandler.cpp
text/texthandler.h
eventbus/eventbushandler.cpp
eventbus/eventbushandler.h
input/inputconstants.h
input/inputdevice.cpp
input/inputdevice.h
input/inputhandler.cpp
input/inputhandler.h
render2d/render2dhandler.cpp
render2d/render2dhandler.h
settings/mini.h
settings/settingshandler.cpp
settings/settingshandler.h
state/basestate.h
state/state.h
state/state.cpp
steam/steamhandler.cpp
steam/steamhandler.h
assethandler/assethandler.cpp
assethandler/assethandler.h
assethandler/DroidSansMono.cpp
utils/camera.h
utils/colors.h
utils/constants.h
utils/easings.h
utils/helpers.cpp
utils/helpers.h
utils/lerp.cpp
utils/lerp.h
utils/quadtree.h
utils/rectangles.cpp
utils/rectangles.h
utils/vectors.cpp
utils/vectors.h
window/windowhandler.cpp
window/windowhandler.h
)
target_sources("luminoveau" PRIVATE
extern/miniaudio.cpp
extern/SDL_stbimage.cpp
extern/stb_image.cpp
extern/stb_image_write.cpp
)
target_sources("luminoveau" PRIVATE
steam/steamhandler.cpp
)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/steam/sdk/public/steam/steam_api.h")
find_package(Threads REQUIRED)
target_include_directories("luminoveau" PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/steam/sdk/public/steam/"
)
target_link_libraries(${PROJECT_NAME}
PRIVATE Threads::Threads
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/steam/sdk/redistributable_bin/win64/steam_api64.lib
#"C:/Users/user/Documents/Visual Studio 2022/Libraries/steam-sdk/redistributable_bin/win64/steam_api64.lib"
)
message("[Luminoveau]: adding SteamWorks SDK")
endif()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/log/loghandler.cpp")
target_sources("luminoveau" PRIVATE
log/loghandler.cpp
log/loghandler.h
)
message("[Luminoveau]: adding loghandler")
endif()
if (FORCE_ALL_WARNINGS)
target_compile_options("luminoveau" PRIVATE -Wall)
else()
if (MSVC)
# Add compiler flags to suppress specific warnings
add_compile_options(/wd4820 /wd4514 /wd5045)
endif()
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_options("luminoveau" PRIVATE -O3)
endif()
target_compile_features("luminoveau" PRIVATE cxx_std_20)
target_include_directories("luminoveau" PUBLIC
"${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/extern"
)
file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.38.3/CPM.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
EXPECTED_HASH SHA256=cc155ce02e7945e7b8967ddfaff0b050e958a723ef7aad3766d368940cb15494
)
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)
set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS ON)
#remove AV1 support in SDL3Image because it requires perl and nasm which just breaks in MSVC
set(SDL3IMAGE_AVIF_SAVE OFF)
set(SDL3IMAGE_AVIF OFF)
if (ANDROID) #for android we want to build shared libs
set(BUILD_SHARED_LIBS ON)
set(SDL_STATIC OFF)
set(SDL_SHARED ON)
set(INTERFACE_SDL3_SHARED ON)
else()
set(BUILD_SHARED_LIBS OFF)
set(SDL_STATIC ON)
set(SDL_SHARED OFF)
set(INTERFACE_SDL3_SHARED OFF)
set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS ON)
endif()
CPMAddPackage(
NAME SDL3
GIT_TAG 2786290
GITHUB_REPOSITORY libsdl-org/SDL
)
if(SDL3_ADDED)
target_include_directories("luminoveau" PUBLIC ${SDL3_SOURCE_DIR}/include)
endif()
set(BLEND2D_STATIC TRUE)
set(ASMJIT_EMBED TRUE)
CPMAddPackage(
NAME asmjit
GIT_TAG 6784722
GITHUB_REPOSITORY asmjit/asmjit
)
CPMAddPackage(
NAME blend2d
GIT_TAG 44baf9e
GITHUB_REPOSITORY blend2d/blend2d
)
if(blend2d_ADDED)
target_include_directories("luminoveau" PUBLIC ${blend2d_SOURCE_DIR}/src)
endif()
if (ANDROID)
target_link_libraries("luminoveau" PUBLIC
SDL3::SDL3
blend2d::blend2d
)
else()
target_link_libraries("luminoveau" PUBLIC
SDL3::SDL3-static
blend2d::blend2d
)
endif()
if (ADD_IMGUI)
CPMAddPackage(
NAME Imgui
GIT_TAG 8cc6eee
GITHUB_REPOSITORY ocornut/imgui
)
if(Imgui_ADDED)
target_include_directories("luminoveau" PUBLIC ${Imgui_SOURCE_DIR})
target_sources("luminoveau" PUBLIC
${Imgui_SOURCE_DIR}/imgui.cpp
${Imgui_SOURCE_DIR}/imgui_demo.cpp
${Imgui_SOURCE_DIR}/imgui_draw.cpp
${Imgui_SOURCE_DIR}/imgui_tables.cpp
${Imgui_SOURCE_DIR}/imgui_widgets.cpp
)
if (WIN32)
target_sources("luminoveau" PRIVATE
window/imgui_impl_win32.cpp
window/imgui_impl_sdlrenderer3.cpp
window/imgui_impl_sdl3.cpp
)
else()
target_sources("luminoveau" PRIVATE
window/imgui_impl_sdlrenderer3.cpp
window/imgui_impl_sdl3.cpp
)
endif()
endif()
endif()