-
Notifications
You must be signed in to change notification settings - Fork 80
/
CMakeLists.txt
105 lines (99 loc) · 2.67 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
#
# project: sokol-samples
#
cmake_minimum_required(VERSION 3.21)
set(CMAKE_C_STANDARD 99)
if (FIPS_IOS)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "")
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "")
endif()
set(CMAKE_CXX_STANDARD 17)
project(sokol-samples)
if (SOKOL_USE_WGPU_DAWN)
set(USE_DAWN_SDK ON)
endif()
# include the fips main cmake file
get_filename_component(FIPS_ROOT_DIR "../fips" ABSOLUTE)
include("${FIPS_ROOT_DIR}/cmake/fips.cmake")
fips_setup()
fips_ide_group("Imports")
if (NOT USE_SOKOL_APP AND NOT SOKOL_USE_WGPU_DAWN AND NOT SOKOL_USE_D3D11 AND NOT SOKOL_USE_METAL)
fips_import_fips_glfw_glfw3()
endif()
fips_import_fips_imgui_imgui()
fips_import_fips_cimgui_cimgui()
fips_import_fips_imgui_dock_imgui_dock()
if (NOT FIPS_UWP)
fips_import_fips_libmodplug_libmodplug()
endif()
fips_ide_group("")
# just suppress this pesky "missing field initializer warning" for now
if (FIPS_CLANG OR FIPS_GCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-field-initializers -Wsign-conversion")
endif()
# platform selection
add_definitions(-DSOKOL_NO_DEPRECATED)
if (FIPS_EMSCRIPTEN)
if (FIPS_EMSCRIPTEN_USE_WEBGPU)
set(sokol_backend SOKOL_WGPU)
set(slang "wgsl")
else()
set(sokol_backend SOKOL_GLES3)
set(slang "glsl300es")
endif()
elseif (FIPS_ANDROID)
set(sokol_backend SOKOL_GLES3)
set(slang "glsl300es")
elseif (SOKOL_USE_D3D11)
set(sokol_backend SOKOL_D3D11)
set(slang "hlsl5")
elseif (SOKOL_USE_METAL)
set(sokol_backend SOKOL_METAL)
if (FIPS_IOS)
set(slang "metal_ios:metal_sim")
else()
set(slang "metal_macos")
endif()
elseif (SOKOL_USE_EGL_GLES3)
set(sokol_backend SOKOL_GLES3)
set(slang "glsl300es")
elseif (SOKOL_USE_EGL_GL)
set(sokol_backend SOKOL_GLCORE)
set(slang "glsl430")
else()
if (FIPS_IOS)
set(sokol_backend SOKOL_GLES3)
set(slang "glsl300es")
else()
set(sokol_backend SOKOL_GLCORE)
if (FIPS_MACOS)
set(slang "glsl410")
else()
set(slang "glsl430")
endif()
endif()
endif()
if (USE_SOKOL_APP)
include_directories(libs)
fips_ide_group("Libs")
add_subdirectory(libs)
fips_ide_group("Samples")
add_subdirectory(sapp)
else()
if (FIPS_EMSCRIPTEN)
if (FIPS_EMSCRIPTEN_USE_WEBGPU)
add_subdirectory(wgpu)
else()
add_subdirectory(html5)
endif()
elseif (SOKOL_USE_D3D11)
add_subdirectory(d3d11)
elseif (SOKOL_USE_METAL)
add_subdirectory(metal)
elseif (SOKOL_USE_WGPU_DAWN)
add_subdirectory(wgpu)
else()
add_subdirectory(glfw)
endif()
endif()