forked from floooh/sokol-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
88 lines (80 loc) · 2.29 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
#
# project: sokol-samples
#
cmake_minimum_required(VERSION 2.8)
project(sokol-samples)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
# 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_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_libmodplug_libmodplug()
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")
endif()
if (FIPS_GCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-braces")
endif()
# macro to select the sokol-backend and shader dialects
macro(sokol_config)
add_definitions(-DSOKOL_NO_DEPRECATED)
if (FIPS_EMSCRIPTEN)
add_definitions(-DSOKOL_GLES3)
set(slang "glsl300es:glsl100")
elseif (FIPS_RASPBERRYPI)
add_definitions(-DSOKOL_GLES2)
set(slang "glsl100")
elseif (FIPS_ANDROID)
add_definitions(-DSOKOL_GLES3)
set(slang "glsl300es:glsl100")
elseif (SOKOL_USE_D3D11)
add_definitions(-DSOKOL_D3D11)
set(slang "hlsl5")
elseif (SOKOL_USE_METAL)
add_definitions(-DSOKOL_METAL)
if (FIPS_IOS)
set(slang "metal_ios:metal_sim")
else()
set(slang "metal_macos")
endif()
else()
if (FIPS_IOS)
add_definitions(-DSOKOL_GLES3)
set(slang "glsl300es:glsl100")
else()
add_definitions(-DSOKOL_GLCORE33)
set(slang "glsl330")
endif()
endif()
endmacro()
if (USE_SOKOL_APP)
include_directories(libs)
fips_ide_group("Libs")
add_subdirectory(libs)
fips_ide_group("Samples")
add_subdirectory(sapp)
fips_ide_group("Tests")
add_subdirectory(tests)
else()
if (FIPS_EMSCRIPTEN)
add_subdirectory(html5)
elseif (FIPS_RASPBERRYPI)
add_subdirectory(raspi)
elseif (SOKOL_USE_D3D11)
add_subdirectory(d3d11)
elseif (SOKOL_USE_METAL)
add_subdirectory(metal)
else()
add_subdirectory(glfw)
endif()
endif()
fips_finish()