-
-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
543 lines (491 loc) · 17.1 KB
/
Copy pathCMakeLists.txt
File metadata and controls
543 lines (491 loc) · 17.1 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
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
cmake_minimum_required(VERSION 4.2)
project(cute_framework
DESCRIPTION "The cutest framework out there for creating 2D and 3D games in C++!"
HOMEPAGE_URL "https://github.com/RandyGaul/cute_framework"
LANGUAGES C CXX
VERSION 1.1.1
)
# Must have at least C++20 and C23.
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 23)
include(cmake/StandardProjectSettings.cmake)
include(cmake/CuteSym.cmake)
include(GNUInstallDirs)
# These are needed for how we use FetchContent.
include(FetchContent)
set(FETCHCONTENT_QUIET FALSE)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Todo - Fix how turning some of these off breaks the build.
option(CF_FRAMEWORK_STATIC "Build static library for Cute Framework." ON)
option(CF_CUTE_SHADERC "Build cute-shaderc, an offline shader compiler." ON)
option(CF_CUTE_SYM "Build cute-sym, the crash reporter's symbol table tool (cf_symbols needs it)." ON)
option(CF_FRAMEWORK_APPLE_FRAMEWORK "Build CF libraries as Apple Framework" OFF)
# Make sure all libraries are placed into the same output folder.
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
endif ()
# Platform detection.
# Put Emscripten first so it doesn't fall into the generic UNIX/Linux path.
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR DEFINED EMSCRIPTEN)
set(EMSCRIPTEN TRUE)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android" OR DEFINED ANDROID)
set(ANDROID TRUE)
elseif(WIN32)
set(WINDOWS TRUE)
elseif(APPLE)
enable_language(OBJC)
if(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*" OR CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
set(MACOSX TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*")
set(IOS TRUE)
else()
message(FATAL_ERROR "No supported Apple platform detected.")
endif()
elseif(UNIX AND NOT APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(LINUX TRUE)
else()
message(FATAL_ERROR "No supported UNIX platform detected.")
endif()
else()
message(FATAL_ERROR "No supported platform detected.")
endif()
# Disable annoying MSVC warnings.
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options(/MP)
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/cute_version.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/include/cute_version.h"
@ONLY
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/src/cute_version.cpp.in"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cute_version.cpp"
@ONLY
)
# Common directories for compiler/linker path.
include_directories(src libraries test)
# Cute Framework shared library.
set(CF_SRCS
src/cute_app.cpp
src/cute_binding.cpp
src/cute_ckit.cpp
src/cute_audio.cpp
src/cute_clipboard.cpp
src/cute_multithreading.cpp
src/cute_file_system.cpp
src/cute_input.cpp
src/cute_time.cpp
src/cute_version.cpp
src/cute_json.cpp
src/cute_base64.cpp
src/cute_math.cpp
src/cute_math3d.cpp
src/cute_physics.cpp
src/cute_draw.cpp
src/cute_draw3d.cpp
src/cute_image.cpp
src/cute_video.cpp
src/cute_model.cpp
src/cute_graphics.cpp
src/cute_graphics_sdlgpu.cpp
src/cute_graphics_gles.cpp
src/cute_graphics_glad.cpp
src/cute_aseprite_cache.cpp
src/cute_custom_sprite.cpp
src/cute_https.cpp
src/cute_crash.cpp
src/cute_joypad.cpp
src/cute_symbol.cpp
src/cute_sprite.cpp
src/cute_coroutine.cpp
src/cute_networking.cpp
src/cute_guid.cpp
src/cute_alloc.cpp
src/cute_result.cpp
src/cute_noise.cpp
src/cute_imgui.cpp
src/internal/yyjson.c
libraries/imgui/imgui.cpp
libraries/imgui/imgui_demo.cpp
libraries/imgui/imgui_draw.cpp
libraries/imgui/imgui_tables.cpp
libraries/imgui/imgui_widgets.cpp
libraries/imgui/backends/imgui_impl_sdl3.cpp
libraries/imgui/dcimgui.cpp
libraries/imgui/dcimgui_internal.cpp
libraries/imgui/backends/imgui_impl_sdlgpu3.cpp
libraries/imgui/backends/imgui_impl_opengl3.cpp
libraries/glad/glad.c
)
if(APPLE)
set(CF_SRCS ${CF_SRCS}
src/internal/cute_tls.m
)
endif()
set(CF_PUBLIC_HDRS
include/cute_alloc.h
include/cute_app.h
include/cute_audio.h
include/cute_user_config.h
include/cute_c_runtime.h
include/cute_clipboard.h
include/cute_multithreading.h
include/cute_defines.h
include/cute_result.h
include/cute_file_system.h
include/cute_input.h
include/cute_time.h
include/cute_version.h
include/cute_doubly_list.h
include/cute_json.h
include/cute_base64.h
include/cute_array.h
include/cute_map.h
include/cute_string.h
include/cute_defer.h
include/cute_math.h
include/cute_math3d.h
include/cute_draw3d.h
include/cute_draw.h
include/cute_debug_printf.h
include/cute_image.h
include/cute_video.h
include/cute_color.h
include/cute.h
include/cute_main_callbacks.h
include/cute_graphics.h
include/cute_rnd.h
include/cute_sprite.h
include/cute_custom_sprite.h
include/cute_https.h
include/cute_crash.h
include/cute_joypad.h
include/cute_priority_queue.h
include/cute_symbol.h
include/cute_coroutine.h
include/cute_networking.h
include/cute_guid.h
include/cute_routine.h
include/cute_noise.h
)
set(IMGUI_HDRS
libraries/imgui/imgui.h
libraries/imgui/imconfig.h
libraries/imgui/imgui_internal.h
libraries/imgui/imstb_rectpack.h
libraries/imgui/imstb_textedit.h
libraries/imgui/imstb_truetype.h
libraries/imgui/dcimgui.h
libraries/imgui/dcimgui_internal.h
)
set(CF_HDRS
${CF_PUBLIC_HDRS}
${IMGUI_HDRS}
src/internal/cute_imgui_internal.h
src/internal/cute_app_internal.h
src/internal/cute_input_internal.h
src/internal/cute_serialize_internal.h
src/internal/cute_custom_sprite_internal.h
src/internal/cute_draw_internal.h
src/internal/cute_font_internal.h
src/internal/cute_graphics_internal.h
src/internal/cute_aseprite_cache_internal.h
src/internal/cute_alloc_internal.h
src/internal/cute_file_system_internal.h
src/internal/yyjson.h
)
if(CF_FRAMEWORK_STATIC)
add_library(cute STATIC ${CF_SRCS} ${CF_HDRS})
target_compile_definitions(cute PUBLIC CF_STATIC)
else()
add_library(cute SHARED ${CF_SRCS} ${CF_HDRS})
endif()
target_compile_definitions(cute PRIVATE CF_EXPORT)
# Box2D v3.1.1 (MIT), fetched shallow at configure time -- the release tag is the pin
# (GIT_SHALLOW only composes with branch/tag names, not commit hashes, and a tag keeps the
# download at a single commit's worth of history). SOURCE_SUBDIR points at a directory with
# no CMakeLists on purpose: Box2D's own build is skipped entirely, because CF compiles the
# sources itself as an object library folded into cute -- the C sources need C17 (the rest
# of CF compiles as C++), and shared builds define box2d_EXPORTS so b2* symbols export from
# the DLL for direct user calls.
FetchContent_Declare(
box2d
GIT_REPOSITORY https://github.com/erincatto/box2d.git
GIT_TAG v3.1.1
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
UPDATE_DISCONNECTED TRUE
SOURCE_SUBDIR cmake_is_unused
)
FetchContent_MakeAvailable(box2d)
file(GLOB CF_BOX2D_SRCS ${box2d_SOURCE_DIR}/src/*.c)
add_library(cute-box2d OBJECT ${CF_BOX2D_SRCS})
target_include_directories(cute-box2d PRIVATE
${box2d_SOURCE_DIR}/include
${box2d_SOURCE_DIR}/src
)
set_target_properties(cute-box2d PROPERTIES
C_STANDARD 17
C_STANDARD_REQUIRED YES
C_EXTENSIONS YES
POSITION_INDEPENDENT_CODE ON
)
if(NOT CF_FRAMEWORK_STATIC)
target_compile_definitions(cute-box2d PRIVATE box2d_EXPORTS)
endif()
if(EMSCRIPTEN)
# Matches upstream: wasm SIMD via the SSE2 emulation path.
target_compile_options(cute-box2d PRIVATE -msimd128 -msse2)
endif()
target_sources(cute PRIVATE $<TARGET_OBJECTS:cute-box2d>)
# Box3D v0.1.0 (MIT), fetched shallow at configure time -- identical treatment to Box2D
# above: the release tag is the pin, Box3D's own CMake is skipped via the unused
# SOURCE_SUBDIR, and CF compiles the sources itself as a C17 object library folded into
# cute with b3* symbols exported on shared builds.
FetchContent_Declare(
box3d
GIT_REPOSITORY https://github.com/erincatto/box3d.git
GIT_TAG v0.1.0
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
UPDATE_DISCONNECTED TRUE
SOURCE_SUBDIR cmake_is_unused
)
FetchContent_MakeAvailable(box3d)
file(GLOB CF_BOX3D_SRCS ${box3d_SOURCE_DIR}/src/*.c)
add_library(cute-box3d OBJECT ${CF_BOX3D_SRCS})
target_include_directories(cute-box3d PRIVATE
${box3d_SOURCE_DIR}/include
${box3d_SOURCE_DIR}/src
)
set_target_properties(cute-box3d PROPERTIES
C_STANDARD 17
C_STANDARD_REQUIRED YES
C_EXTENSIONS YES
POSITION_INDEPENDENT_CODE ON
)
if(NOT CF_FRAMEWORK_STATIC)
target_compile_definitions(cute-box3d PRIVATE box3d_EXPORTS)
endif()
if(EMSCRIPTEN)
target_compile_options(cute-box3d PRIVATE -msimd128 -msse2)
endif()
target_sources(cute PRIVATE $<TARGET_OBJECTS:cute-box3d>)
if(EMSCRIPTEN)
message(STATUS "Configuring CF for Web (Emscripten)")
# Emscripten forces off a couple options that don't make sense for web builds.
set(CF_FRAMEWORK_APPLE_FRAMEWORK OFF CACHE BOOL "" FORCE)
set(PHYSFS_BUILD_SHARED OFF CACHE BOOL "" FORCE)
set(PHYSFS_BUILD_STATIC ON CACHE BOOL "" FORCE)
target_compile_options(cute PUBLIC -sUSE_SDL=3)
target_compile_options(cute PRIVATE -gsplit-dwarf)
# CF requires WebGL 2, but imgui_impl_opengl3 auto-selects its ES2 path on Emscripten, which
# compiles out glBindSampler: CF's sampler objects then stay bound to unit 0 during ImGui draws.
target_compile_definitions(cute PRIVATE IMGUI_IMPL_OPENGL_ES3)
target_link_options(cute INTERFACE
-sUSE_SDL=3
-sUSE_WEBGL2=1 -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2
-sFULL_ES3=1
-sALLOW_MEMORY_GROWTH=1
-sFILESYSTEM=1
-sASYNCIFY=1
-sASYNCIFY_STACK_SIZE=2040000
# Skip ASYNCIFY instrumentation for functions proven never to suspend
# (never reach cf_sleep / a coroutine yield / a fiber swap). This severs
# the allocator hub (cf_alloc & co, an indirect call) and the cspv shader
# compiler from the instrumented set, shrinking the wasm-opt link pass and
# the output module. See cmake/asyncify_remove.txt for the list + contract.
-sASYNCIFY_REMOVE=@${CMAKE_CURRENT_SOURCE_DIR}/cmake/asyncify_remove.txt
)
target_compile_options(cute PRIVATE -O1 -fno-rtti -fno-exceptions)
endif()
if(ANDROID)
message(STATUS "Configuring CF for Android")
# Android-specific options.
set(CF_CUTE_SHADERC OFF CACHE BOOL "" FORCE)
set(CF_FRAMEWORK_APPLE_FRAMEWORK OFF CACHE BOOL "" FORCE)
set(PHYSFS_BUILD_SHARED OFF CACHE BOOL "" FORCE)
set(PHYSFS_BUILD_STATIC ON CACHE BOOL "" FORCE)
# Link Android-specific libraries.
# GLESv3 needed for imgui OpenGL3 backend (VAO functions).
set(CF_LINK_LIBS ${CF_LINK_LIBS} android log GLESv3 EGL)
endif()
# PhysicsFS for virtual file system and archive support.
if(CF_FRAMEWORK_STATIC)
set(PHYSFS_BUILD_SHARED OFF CACHE BOOL "Build PhysFS as shared library")
set(PHYSFS_BUILD_STATIC ON CACHE BOOL "Build PhysFS as static library")
else()
set(PHYSFS_BUILD_SHARED ON CACHE BOOL "Build PhysFS as shared library")
set(PHYSFS_BUILD_STATIC OFF CACHE BOOL "Build PhysFS as static library")
endif()
set(PHYSFS_BUILD_TEST OFF CACHE BOOL "Do not build PhysFS tests.")
set(PHYSFS_BUILD_DOCS OFF CACHE BOOL "Do not build PhysFS docs.")
FetchContent_Declare(
physfs
GIT_REPOSITORY https://github.com/icculus/physfs.git
GIT_TAG 9d18d36b5a5207b72f473f05e1b2834e347d8144
UPDATE_DISCONNECTED TRUE
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(physfs)
if(APPLE)
find_library(IOKIT IOKit)
find_library(FOUNDATION Foundation)
find_library(SECURITY Security)
find_library(QUARTZCORE QuartzCore)
find_library(METAL Metal)
find_library(METALKIT MetalKit)
find_library(NETWORK Network)
# For the VideoToolbox hardware video-encode backend in cute_video.cpp.
find_library(VIDEOTOOLBOX VideoToolbox)
find_library(COREMEDIA CoreMedia)
find_library(COREVIDEO CoreVideo)
find_library(COREFOUNDATION CoreFoundation)
set(CF_LINK_LIBS ${CF_LINK_LIBS} ${IOKIT} ${FOUNDATION} ${SECURITY} ${QUARTZCORE} ${METAL} ${METALKIT} ${NETWORK} ${VIDEOTOOLBOX} ${COREMEDIA} ${COREVIDEO} ${COREFOUNDATION})
endif()
if(LINUX)
find_package(OpenGL REQUIRED)
set(CF_LINK_LIBS ${CF_LINK_LIBS} ${OPENGL_LIBRARIES})
endif()
if(CF_FRAMEWORK_STATIC)
set(CF_LINK_LIBS ${CF_LINK_LIBS} PhysFS::PhysFS-static)
else ()
set(CF_LINK_LIBS ${CF_LINK_LIBS} PhysFS::PhysFS)
endif()
# Add s2n for Linux builds.
if(LINUX)
# Ensure tests are not built.
set(BUILD_TESTING OFF CACHE BOOL "Disable building s2n tests." FORCE)
FetchContent_Declare(
s2n
URL https://github.com/aws/s2n-tls/archive/refs/tags/v1.6.3.zip
DOWNLOAD_EXTRACT_TIMESTAMP ON
UPDATE_DISCONNECTED TRUE
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(s2n)
set(CF_LINK_LIBS ${CF_LINK_LIBS} s2n)
endif()
# MinGW needs these since gcc ignores pragma links in C/C++.
if(WINDOWS AND NOT MSVC)
set(CF_LINK_LIBS ${CF_LINK_LIBS} ws2_32 secur32 shlwapi)
endif()
# Deprecated no-op, kept so existing user CMake scripts don't break. CF no longer
# ships or uses dxcompiler.dll/dxil.dll -- D3D12 shaders go through the system's
# FXC (d3dcompiler_47.dll) fed by cute_spirv's HLSL transpiler backend.
function(target_dxc_copy TARGET)
endfunction()
if(NOT EMSCRIPTEN) # Emscripten provides it's own SDL3.
# SDL for platform support.
set(SDL_REQUIRED_VERSION 3.4.0)
# Just don't build the shared library at all, it's not needed.
set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
if(CF_FRAMEWORK_STATIC)
set(SDL_STATIC ON CACHE BOOL "Build SDL as a static library")
set(SDL_SHARED OFF CACHE BOOL "Do not build SDL as a shared library")
else()
set(SDL_STATIC OFF CACHE BOOL "Do not build SDL as a static library")
set(SDL_SHARED ON CACHE BOOL "Build SDL as a shared library")
endif()
set(SDL_TEST_LIBRARY OFF CACHE BOOL "Do not build SDL tests")
set(SDL_EXAMPLES OFF CACHE BOOL "Do not build SDL examples")
FetchContent_Declare(
SDL3
URL https://github.com/libsdl-org/SDL/releases/download/release-${SDL_REQUIRED_VERSION}/SDL3-${SDL_REQUIRED_VERSION}.zip
DOWNLOAD_EXTRACT_TIMESTAMP ON
UPDATE_DISCONNECTED TRUE
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(SDL3)
if(CF_FRAMEWORK_STATIC)
set(CF_LINK_LIBS ${CF_LINK_LIBS} SDL3::SDL3-static)
else ()
set(CF_LINK_LIBS ${CF_LINK_LIBS} SDL3::SDL3)
endif()
target_include_directories(cute PUBLIC ${SDL3_INCLUDE_DIRS})
# Build-time tool to extract D3D12 struct layout offsets from SDL3 private headers.
if(WIN32)
set(D3D12_LAYOUT_HEADER "${CMAKE_CURRENT_BINARY_DIR}/generated/d3d12_layout.gen.h")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/generated")
add_executable(gen_d3d12_layout EXCLUDE_FROM_ALL tools/gen_d3d12_layout.c)
add_custom_command(
OUTPUT ${D3D12_LAYOUT_HEADER}
COMMAND gen_d3d12_layout
"${sdl3_SOURCE_DIR}/src/gpu/SDL_sysgpu.h"
"${sdl3_SOURCE_DIR}/src/gpu/d3d12/SDL_gpu_d3d12.c"
"${D3D12_LAYOUT_HEADER}"
DEPENDS gen_d3d12_layout
"${sdl3_SOURCE_DIR}/src/gpu/SDL_sysgpu.h"
"${sdl3_SOURCE_DIR}/src/gpu/d3d12/SDL_gpu_d3d12.c"
COMMENT "Generating D3D12 struct layout offsets"
)
add_custom_target(gen_d3d12_layout_target DEPENDS ${D3D12_LAYOUT_HEADER})
add_dependencies(cute gen_d3d12_layout_target)
target_include_directories(cute PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/generated")
endif()
endif()
add_subdirectory(tools)
if (CF_CUTE_SYM)
cf_symbols_cute()
endif()
# Some platform specific settings.
if(MINGW)
set(CF_LINK_LIBS ${CF_LINK_LIBS} d3d11 crypt32 mfplat mfreadwrite mfuuid ole32)
elseif(WINDOWS)
set(CF_LINK_LIBS ${CF_LINK_LIBS} crypt32 mfplat mfreadwrite mfuuid ole32)
elseif(LINUX)
target_compile_options(cute PRIVATE -msse4.1)
elseif(APPLE)
if(CF_FRAMEWORK_APPLE_FRAMEWORK)
set_target_properties(cute PROPERTIES FRAMEWORK TRUE)
if (CF_FRAMEWORK_STATIC)
set_target_properties(cute PROPERTIES
FRAMEWORK_VERSION "${PROJECT_VERSION}"
MACOSX_FRAMEWORK_IDENTIFIER "com.cuteframework.static"
)
else()
set_target_properties(cute PROPERTIES
FRAMEWORK_VERSION "${PROJECT_VERSION}"
MACOSX_FRAMEWORK_IDENTIFIER "com.cuteframework.shared"
)
endif()
endif()
endif()
# Link up all dependencies to Cute.
target_link_libraries(cute PUBLIC ${CF_LINK_LIBS})
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
option(CF_FRAMEWORK_BUILD_TESTS "Build the cute framework unit tests." ON)
option(CF_FRAMEWORK_BUILD_SAMPLES "Build the cute framework sample programs." ON)
option(CF_BUILD_DOCSPARSER "Build the docsparser documentation generator." ON)
# Cute unit tests executable (optional, defaulted to also build).
if (CF_FRAMEWORK_BUILD_TESTS)
add_subdirectory(test)
endif()
# Cute sample programs (optional, defaulted to also build).
if (CF_FRAMEWORK_BUILD_SAMPLES)
add_subdirectory(samples)
endif()
endif()
# Propogate public headers to other cmake scripts including this subdirectory.
target_include_directories(cute PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_include_directories(cute PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libraries>)
target_include_directories(cute PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libraries/imgui>)
target_include_directories(cute PUBLIC $<BUILD_INTERFACE:${box2d_SOURCE_DIR}/include>)
target_include_directories(cute PUBLIC $<BUILD_INTERFACE:${box3d_SOURCE_DIR}/include>)
target_include_directories(cute PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tools)
# Install target
install(TARGETS cute
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}
)