-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
261 lines (227 loc) · 6.94 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.20)
project(Ashura)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_COLOR_DIAGNOSTICS ON)
set(VMA_DYNAMIC_VULKAN_FUNCTIONS
ON
CACHE BOOL "")
set(ENABLE_OPT
OFF
CACHE BOOL "")
set(ENABLE_HLSL
OFF
CACHE BOOL "")
set(ENABLE_GLSLANG_BINARIES
OFF
CACHE BOOL "")
set(ENABLE_SPVREMAPPER
OFF
CACHE BOOL "")
set(SPIRV_REFLECT_EXECUTABLE
OFF
CACHE BOOL "")
set(SPIRV_REFLECT_STATIC_LIB
ON
CACHE BOOL "")
set(SDL_STATIC
ON
CACHE BOOL "")
set(SDL_JOYSTICK
OFF
CACHE BOOL "")
set(SDL_HAPTIC
OFF
CACHE BOOL "")
include(FetchContent)
set(ASH_VULKAN_VERSION "1.3.296.0")
FetchContent_Declare(
VulkanHeaders
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Headers.git
GIT_TAG vulkan-sdk-${ASH_VULKAN_VERSION})
FetchContent_Declare(
VulkanGLSL
GIT_REPOSITORY https://github.com/KhronosGroup/glslang.git
GIT_TAG vulkan-sdk-${ASH_VULKAN_VERSION})
FetchContent_Declare(
SpirvReflect
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Reflect.git
GIT_TAG vulkan-sdk-${ASH_VULKAN_VERSION})
FetchContent_Declare(
VulkanUtilityLibraries
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
GIT_TAG vulkan-sdk-${ASH_VULKAN_VERSION})
FetchContent_Declare(
VulkanLoader
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Loader.git
GIT_TAG be0e1c3)
FetchContent_Declare(
VulkanMemoryAllocator
GIT_REPOSITORY
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
GIT_TAG v3.1.0)
FetchContent_Declare(
SDL3
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG preview-3.1.6)
FetchContent_Declare(
harfbuzz
GIT_REPOSITORY https://github.com/harfbuzz/harfbuzz.git
GIT_TAG 8.5.0)
FetchContent_Declare(
Freetype
GIT_REPOSITORY https://gitlab.freedesktop.org/freetype/freetype.git
GIT_TAG VER-2-13-2)
FetchContent_Declare(
SheenBidi
GIT_REPOSITORY https://github.com/Tehreer/SheenBidi.git
GIT_TAG v2.7
CONFIGURE_COMMAND "" BUILD_COMMAND "")
FetchContent_Declare(
WebP
GIT_REPOSITORY https://chromium.googlesource.com/webm/libwebp
GIT_TAG 1.4.0)
FetchContent_Declare(
CURL
GIT_REPOSITORY https://github.com/curl/curl.git
GIT_TAG curl-8_8_0)
FetchContent_Declare(
xxHash
GIT_REPOSITORY https://github.com/Cyan4973/xxHash.git
GIT_TAG dd11140
CONFIGURE_COMMAND "" BUILD_COMMAND "")
FetchContent_Declare(
fast_float
GIT_REPOSITORY https://github.com/fastfloat/fast_float.git
GIT_TAG v7.0.0
CONFIGURE_COMMAND "" BUILD_COMMAND "")
find_package(simdjson CONFIG REQUIRED)
find_package(GTest REQUIRED)
find_package(libjpeg-turbo CONFIG REQUIRED)
find_package(PNG REQUIRED)
find_package(FFMPEG REQUIRED)
find_package(benchmark CONFIG REQUIRED)
find_package(Threads REQUIRED)
FetchContent_MakeAvailable(VulkanHeaders)
FetchContent_MakeAvailable(VulkanUtilityLibraries)
FetchContent_MakeAvailable(VulkanLoader)
FetchContent_MakeAvailable(VulkanMemoryAllocator)
FetchContent_MakeAvailable(VulkanGLSL)
FetchContent_MakeAvailable(harfbuzz)
FetchContent_MakeAvailable(Freetype)
FetchContent_MakeAvailable(SheenBidi)
FetchContent_MakeAvailable(SpirvReflect)
FetchContent_MakeAvailable(SDL3)
FetchContent_MakeAvailable(WebP)
FetchContent_MakeAvailable(CURL)
FetchContent_MakeAvailable(xxHash)
FetchContent_MakeAvailable(fast_float)
set(xxHash_INCLUDE_DIR ${xxhash_SOURCE_DIR})
set(fast_float_INCLUDE_DIR ${fast_float_SOURCE_DIR}/include)
file(GLOB SheenBidi_SOURCES ${sheenbidi_SOURCE_DIR}/Source/*.c)
add_library(SheenBidi ${SheenBidi_SOURCES})
target_include_directories(
SheenBidi
PUBLIC ${sheenbidi_SOURCE_DIR}/Headers
PRIVATE ${sheenbidi_SOURCE_DIR}/Source)
add_library(SheenBidi::SheenBidi ALIAS SheenBidi)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(-Wall -Wextra -Wpedantic)
else()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wno-nullability-completeness
-Wno-nullability-extension)
else()
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/W3 /Zc:preprocessor /permissive)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()
endif()
endif()
add_library(
ashura_std
ashura/std/allocator.cc
ashura/std/allocators.cc
ashura/std/async.cc
ashura/std/format.cc
ashura/std/fs.cc
ashura/std/hash.cc
ashura/std/log.cc
ashura/std/panic.cc)
target_include_directories(
ashura_std
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${xxHash_INCLUDE_DIR})
target_link_libraries(ashura_std PUBLIC Threads::Threads)
add_executable(
ashura_std_tests
ashura/std/tests/tests.cc
ashura/std/tests/option.cc
ashura/std/tests/enum.cc
ashura/std/tests/async.cc
ashura/std/tests/list.cc
ashura/std/tests/range.cc
ashura/std/tests/main.cc
ashura/std/tests/hash_map.cc
ashura/std/tests/result.cc
ashura/std/tests/sparse_vec.cc)
add_executable(ashura_std_bench ashura/std/bench/hash_map.cc)
target_link_libraries(ashura_std_tests ashura_std GTest::gtest
GTest::gtest_main)
target_link_libraries(ashura_std_bench benchmark::benchmark
benchmark::benchmark_main ashura_std)
add_library(ashura_gpu ashura/gpu/gpu.cc ashura/gpu/vma_def.cc
ashura/gpu/vulkan.cc)
target_link_libraries(
ashura_gpu PUBLIC ashura_std Vulkan-Headers Vulkan::UtilityHeaders
Vulkan::Loader GPUOpen::VulkanMemoryAllocator)
target_include_directories(ashura_gpu PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_library(
ashura_engine
ashura/engine/engine.cc
ashura/engine/font.cc
ashura/engine/font_impl.cc
ashura/engine/text.cc
ashura/engine/canvas.cc
ashura/engine/gpu_context.cc
ashura/engine/image_decoder.cc
ashura/engine/render_text.cc
ashura/engine/shader.cc
ashura/engine/text_compositor.cc
ashura/engine/window.cc
ashura/engine/view.cc
ashura/engine/view_system.cc
ashura/engine/views.cc
ashura/engine/scene.cc
ashura/engine/renderer.cc
ashura/engine/passes.cc)
target_link_libraries(
ashura_engine
PUBLIC ashura_std ashura_gpu
PRIVATE
glslang::glslang
spirv-reflect-static
SDL3::SDL3-static
harfbuzz
CURL::libcurl
freetype
simdjson::simdjson
webp
webpdecoder
$<IF:$<TARGET_EXISTS:libjpeg-turbo::turbojpeg>,libjpeg-turbo::turbojpeg,libjpeg-turbo::turbojpeg-static>
PNG::PNG
${FFMPEG_LIBRARIES}
SheenBidi::SheenBidi)
target_include_directories(
ashura_engine
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${JPEG_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS} ${FFMPEG_LIBRARY_DIRS}
${fast_float_INCLUDE_DIR})
add_executable(
ashura_engine_tests
ashura/engine/tests/main.cc ashura/engine/tests/render_text.cc
ashura/engine/tests/views.cc ashura/engine/tests/text_compositor.cc)
target_link_libraries(ashura_engine_tests ashura_std ashura_engine GTest::gtest)
add_executable(ashura_editor ashura/editor/editor.cc)
target_link_libraries(ashura_editor ashura_std ashura_engine GTest::gtest)