blob: e258fa874b583e4070e546e53e0fdb9bcf849b33 (
plain)
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
|
project(floormat-external)
if(NOT DEFINED FLOORMAT_SUBMODULE-SDL2)
find_package(SDL2 QUIET)
if(SDL2_FOUND)
set(FLOORMAT_SUBMODULE-SDL2 OFF CACHE BOOL
"SDL2 as a submodule")
endif()
endif()
set(FLOORMAT_SUBMODULE-SDL2 ON CACHE BOOL
"SDL2 as submodule")
if(NOT DEFINED FLOORMAT_SUBMODULE-BENCHMARK)
find_package(benchmark QUIET)
if(benchmark_FOUND)
set(FLOORMAT_SUBMODULE-BENCHMARK OFF CACHE BOOL
"Benchmark as a submodule")
endif()
endif()
set(FLOORMAT_SUBMODULE-BENCHMARK ON CACHE BOOL
"Benchmark as a submodule")
set(FLOORMAT_SUBMODULE-DEPENDENCIES ON CACHE BOOL
"Use dependencies included in the source directory (needs git submodule update --init).")
foreach(_module corrade magnum magnum-integration magnum-plugins)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/modules")
endforeach()
if(MSVC)
add_link_options(-WX:NO)
set_property(DIRECTORY APPEND PROPERTY STATIC_LIBRARY_OPTIONS
-IGNORE:4006 #warning LNK4006: main already defined in x.cpp.obj; second definition ignored
)
add_compile_options(
-wd4244 # warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
-wd4312 # warning C4312: 'reinterpret_cast': conversion from 'GLenum' to 'void *' of greater size
-wd4251 # warning C4251: 't::f': class 'x' needs to have dll-interface to be used by clients of class 'y'
-wd4456 # warning C4456: declaration of 'x' hides previous local declaration
-wd4457 # warning C4457: declaration of 'name' hides function parameter
-wd4244 # warning C4244: 'initializing': conversion from 'unsigned int' to '_Ty', possible loss of data
-wd4005 # warning C4005: '_USE_MATH_DEFINES': macro redefinition
-wd4910 # warning C4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
-wd4661 # warning C4661: no suitable definition provided for explicit template instantiation request
-wd4267 # warning C4267: 'initializing': conversion from 'size_t' to '_Ty2', possible loss of data
)
else()
add_compile_options(
-Wno-error
-Wno-undef
-Wno-cast-function-type
)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast")
endif()
if(FLOORMAT_SUBMODULE-DEPENDENCIES)
add_definitions(
-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS
-DIMGUI_DISABLE_OBSOLETE_KEYIO
-DJSON_HAS_THREE_WAY_COMPARISON=1
)
sets(STRING
SDL_ASSERTIONS release
SDL_INSTALL_CMAKEDIR "share/cmake/SDL2"
NLOHMANN_JSON_CONFIG_INSTALL_DIR "share/cmake/nlohmann_json"
)
sets(BOOL
FMT_SYSTEM_HEADERS ON
JSON_Diagnostics ON
JSON_Install ON
JSON_MultipleHeaders ON
JSON_SystemInclude ON
CORRADE_BUILD_STATIC OFF
CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT OFF
MAGNUM_BUILD_STATIC OFF
MAGNUM_BUILD_PLUGINS_STATIC OFF
CORRADE_BUILD_STATIC_UNIQUE_GLOBALS OFF
CORRADE_BUILD_TESTS ON
CORRADE_BUILD_DEPRECATED OFF
CORRADE_MSVC_COMPATIBILITY OFF
CORRADE_UTILITY_USE_ANSI_COLORS ON
CORRADE_WITH_TESTSUITE ON
MAGNUM_BUILD_TESTS ON
MAGNUM_BUILD_DEPRECATED OFF
MAGNUM_WITH_SDL2APPLICATION ON
MAGNUM_WITH_WINDOWLESSWGLAPPLICATION OFF
MAGNUM_WITH_WINDOWLESSGLXAPPLICATION OFF
MAGNUM_WITH_WINDOWLESSCGLAPPLICATION OFF
MAGNUM_WITH_ANYAUDIOIMPORTER OFF
MAGNUM_WITH_ANYIMAGEIMPORTER ON
MAGNUM_WITH_ANYSCENEIMPORTER OFF
MAGNUM_WITH_ASSIMPIMPORTER OFF
MAGNUM_WITH_ASTCIMPORTER OFF
MAGNUM_WITH_BASISIMPORTER OFF
MAGNUM_WITH_CGLTFIMPORTER OFF
MAGNUM_WITH_DEVILIMAGEIMPORTER OFF
MAGNUM_WITH_DRFLACAUDIOIMPORTER OFF
MAGNUM_WITH_DRMP3AUDIOIMPORTER OFF
MAGNUM_WITH_DRWAVAUDIOIMPORTER OFF
MAGNUM_WITH_FAAD2AUDIOIMPORTER OFF
MAGNUM_WITH_GLTFIMPORTER OFF
MAGNUM_WITH_ICOIMPORTER OFF
MAGNUM_WITH_JPEGIMPORTER OFF
MAGNUM_WITH_KTXIMPORTER OFF
MAGNUM_WITH_OBJIMPORTER OFF
MAGNUM_WITH_OPENEXRIMPORTER OFF
MAGNUM_WITH_OPENGEXIMPORTER OFF
MAGNUM_WITH_PNGIMPORTER OFF
MAGNUM_WITH_PRIMITIVEIMPORTER OFF
MAGNUM_WITH_STANFORDIMPORTER OFF
MAGNUM_WITH_STBVORBISAUDIOIMPORTER OFF
MAGNUM_WITH_STLIMPORTER OFF
MAGNUM_WITH_TINYGLTFIMPORTER OFF
MAGNUM_WITH_WAVAUDIOIMPORTER OFF
MAGNUM_WITH_WEBPIMPORTER OFF
MAGNUM_WITH_DDSIMPORTER ON
MAGNUM_WITH_STBIMAGEIMPORTER ON
MAGNUM_WITH_STBTRUETYPEFONT ON
MAGNUM_WITH_TGAIMPORTER ON
MAGNUM_WITH_GL_INFO ON
MAGNUM_WITH_MAGNUMFONT ON
MAGNUM_WITH_OPENGLTESTER ON
MAGNUM_WITH_SHADERS ON
MAGNUM_WITH_SHADERTOOLS ON
MAGNUM_WITH_ANYIMAGECONVERTER ON
MAGNUM_WITH_ANYSCENECONVERTER OFF
MAGNUM_WITH_ANYSHADERCONVERTER OFF
MAGNUM_WITH_BASISIMAGECONVERTER OFF
MAGNUM_WITH_DISTANCEFIELDCONVERTER OFF
MAGNUM_WITH_GLSLANGSHADERCONVERTER OFF
MAGNUM_WITH_GLTFSCENECONVERTER OFF
MAGNUM_WITH_IMAGECONVERTER ON
MAGNUM_WITH_JPEGIMAGECONVERTER OFF
MAGNUM_WITH_KTXIMAGECONVERTER OFF
MAGNUM_WITH_MESHOPTIMIZERSCENECONVERTER OFF
MAGNUM_WITH_MINIEXRIMAGECONVERTER OFF
MAGNUM_WITH_OPENEXRIMAGECONVERTER OFF
MAGNUM_WITH_PNGIMAGECONVERTER OFF
MAGNUM_WITH_SCENECONVERTER OFF
MAGNUM_WITH_SPIRVTOOLSSHADERCONVERTER OFF
MAGNUM_WITH_STANFORDSCENECONVERTER OFF
MAGNUM_WITH_STBRESIZEIMAGECONVERTER ON
MAGNUM_WITH_TGAIMAGECONVERTER ON
MAGNUM_WITH_MAGNUMFONTCONVERTER ON
MAGNUM_WITH_SHADERCONVERTER ON
MAGNUM_WITH_STBDXTIMAGECONVERTER ON
MAGNUM_WITH_STBIMAGECONVERTER ON
MAGNUM_WITH_BULLET OFF
MAGNUM_WITH_DART OFF
MAGNUM_WITH_EIGEN OFF
MAGNUM_WITH_GLM OFF
MAGNUM_WITH_IMGUI ON
)
if(WIN32)
sets(BOOL
SDL2_DISABLE_INSTALL OFF
SDL2_DISABLE_SDL2MAIN ON
SDL_3DNOW OFF
SDL_ALTIVEC OFF
#SDL_ASSEMBLY OFF
SDL_ATOMIC OFF
SDL_AUDIO OFF
SDL_CPUINFO OFF
SDL_DIRECTX OFF
SDL_DISKAUDIO OFF
SDL_DUMMYAUDIO OFF
SDL_DUMMYVIDEO OFF
SDL_FILE OFF
SDL_FILESYSTEM OFF
SDL_HAPTIC OFF
SDL_HIDAPI OFF
SDL_HIDAPI_JOYSTICK OFF
SDL_JOYSTICK OFF
SDL_LIBC OFF
SDL_LOADSO ON
SDL_LOCALE OFF
SDL_MISC OFF
#SDL_MMX OFF
SDL_OPENGL ON
SDL_OPENGLES OFF
SDL_POWER OFF
SDL_RENDER OFF
SDL_RENDER_D3D OFF
SDL_SENSOR OFF
#SDL_SSE OFF
#SDL_SSE2 OFF
#SDL_SSE3 OFF
#SDL_SSEMATH OFF
SDL_SYSTEM_ICONV OFF
SDL_TEST OFF
SDL_THREADS ON
SDL_TIMERS OFF
SDL_VIDEO ON
SDL_VIRTUAL_JOYSTICK OFF
SDL_VULKAN OFF
SDL_WASAPI OFF
SDL_XINPUT OFF
)
endif(WIN32)
if(WIN32)
sets(BOOL MAGNUM_WITH_WINDOWLESSWGLAPPLICATION ON)
elseif(APPLE)
sets(BOOL MAGNUM_WITH_WINDOWLESSCGLAPPLICATION ON)
else()
sets(BOOL MAGNUM_WITH_WINDOWLESSGLXAPPLICATION ON)
endif()
endif()
set(fm-quiet-message 0)
function(message m)
list(REMOVE_AT ARGV 0)
if(fm-quiet-message)
if(m STREQUAL FATAL_ERROR OR m STREQUAL SEND_ERROR OR m STREQUAL WARNING OR m STREQUAL AUTHOR_WARNING)
_message("${m}" "${ARGV}")
endif()
else()
_message("${m}" "${ARGV}")
endif()
endfunction()
set(system "")
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25)
set(system "SYSTEM")
endif()
if(NOT FLOORMAT_SUBMODULE-DEPENDENCIES OR NOT FLOORMAT_SUBMODULE-SDL2)
add_subdirectory(sdl2 ${system})
endif()
if(FLOORMAT_SUBMODULE-DEPENDENCIES)
sets(PATH IMGUI_DIR "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
function(fm_add_sdl2)
if(FLOORMAT_SUBMODULE-SDL2)
unset(CMAKE_C_VISIBILITY_PRESET)
unset(CMAKE_VISIBILITY_INLINES_HIDDEN)
add_subdirectory(sdl2 ${system})
endif()
endfunction()
function(fm_add_benchmark)
set(BUILD_SHARED_LIBS 1)
if(WIN32)
set(HAVE_STD_REGEX 1)
endif()
set(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_EXCEPTIONS ON)
set(BENCHMARK_ENABLE_LTO OFF)
set(BENCHMARK_ENABLE_WERROR OFF)
set(BENCHMARK_FORCE_WERROR OFF)
set(BENCHMARK_ENABLE_INSTALL OFF)
set(BENCHMARK_ENABLE_DOXYGEN OFF)
set(BENCHMARK_INSTALL_DOCS OFF)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG")
add_subdirectory(benchmark ${system})
install(TARGETS benchmark RUNTIME DESTINATION "bin")
endfunction()
function(fm_add_luajit)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_EXTENSIONS 1)
unset(CMAKE_C_VISIBILITY_PRESET)
unset(CMAKE_VISIBILITY_INLINES_HIDDEN)
if(CMAKE_COMPILER_IS_GNUCXX)
# HACK
add_compile_options(-fno-sanitize=all)
add_link_options(-fno-sanitize=all)
add_subdirectory(luajit ${system})
endif()
endfunction()
fm_run_hook(fm-userconfig-external)
function(fm_add_libs)
if(fm-external-configured)
set(fm-quiet-message 1)
endif()
#if(MAGNUM_BUILD_TESTS OR CORRADE_BUILD_TESTS AND NOT DEFINED CORRADE_TESTSUITE_TEST_TARGET)
if(CORRADE_BUILD_TESTS AND NOT DEFINED CORRADE_TESTSUITE_TEST_TARGET)
sets(STRING CORRADE_TESTSUITE_TEST_TARGET corrade-test)
endif()
if(FLOORMAT_SUBMODULE-BENCHMARK)
fm_add_benchmark()
endif()
fm_add_sdl2()
#fm_add_luajit()
if(MSVC)
add_compile_options(-GR-)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
endif()
add_subdirectory(fmt ${system})
add_subdirectory(json ${system})
add_subdirectory(corrade ${system})
if(MSVC)
target_compile_options(CorradeTestSuiteObjects PUBLIC -GR)
target_compile_options(CorradeTestSuite PUBLIC -GR)
else()
target_compile_options(CorradeTestSuiteObjects PUBLIC -frtti)
target_compile_options(CorradeTestSuite PUBLIC -frtti)
endif()
add_subdirectory(magnum ${system})
add_subdirectory(magnum-plugins ${system})
add_subdirectory(magnum-integration ${system})
endfunction()
if(MAGNUM_BUILD_PLUGINS_STATIC)
sets(BOOL
MAGNUM_WITH_SHADERTOOLS OFF
MAGNUM_WITH_SHADERCONVERTER OFF
)
endif()
fm_add_libs()
endif()
add_subdirectory(robin-map ${system})
if(FLOORMAT_SUBMODULE-DEPENDENCIES)
if(MSVC)
target_compile_options(CorradeTestSuiteObjects PRIVATE -EHsc)
endif()
fm_run_hook(fm-userconfig-post)
endif()
find_package(SDL2 QUIET REQUIRED)
find_package(ImGui QUIET REQUIRED)
if(fm-external-configured)
set(fm-quiet-message 1)
endif()
find_package(Corrade QUIET REQUIRED)
find_package(Magnum QUIET REQUIRED)
find_package(MagnumPlugins QUIET REQUIRED)
find_package(MagnumIntegration QUIET REQUIRED ImGui)
if(NOT FLOORMAT_SUBMODULE-DEPENDENCIES)
find_package(fmt QUIET REQUIRED)
endif()
set(fm-quiet-message 0)
sets(INTERNAL fm-external-configured 1)
|