Skip to content

Commit ce40e31

Browse files
committed
cmake: Report enabled subsystem backends in a compact form.
Looks like this: ``` -- Enabled backends: -- Video drivers: dummy kmsdrm(dynamic) offscreen wayland(dynamic) x11(dynamic) -- X11 libraries: dynamic xcursor xdbe xfixes xinput2 xrandr xscrnsaver xshape xsync xtest -- Render drivers: gpu ogl vulkan -- GPU drivers: vulkan -- Audio drivers: alsa(dynamic) disk dummy jack(dynamic) pipewire(dynamic) pulseaudio(dynamic) sndio(dynamic) -- Joystick drivers: hidapi linux virtual ``` Fixes #7922.
1 parent 8d5b82b commit ce40e31

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

cmake/macros.cmake

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,32 @@ if(APPLE)
334334
endif()
335335
endif()
336336

337+
function(PrintEnabledBackends _SUBSYS _REGEXP)
338+
get_cmake_property(_ALLVARS VARIABLES)
339+
foreach(_VAR IN LISTS _ALLVARS)
340+
string(REGEX MATCH "${_REGEXP}" _MATCH "${_VAR}")
341+
if(_MATCH)
342+
if(${_VAR})
343+
string(TOLOWER "${CMAKE_MATCH_1}" _LOWERED)
344+
if(NOT _LOWERED STREQUAL "available" AND NOT _LOWERED STREQUAL "default") # a little hack
345+
if(${_VAR}_DYNAMIC)
346+
list(APPEND _ENABLED_BACKENDS "${_LOWERED}(dynamic)")
347+
else()
348+
list(APPEND _ENABLED_BACKENDS "${_LOWERED}")
349+
endif()
350+
endif()
351+
endif()
352+
endif()
353+
endforeach()
354+
355+
if(_ENABLED_BACKENDS STREQUAL "")
356+
set(_SPACEDOUT "(none)")
357+
else()
358+
string(REPLACE ";" " " _SPACEDOUT "${_ENABLED_BACKENDS}")
359+
endif()
360+
message(STATUS " ${_SUBSYS}: ${_SPACEDOUT}")
361+
endfunction()
362+
337363
function(SDL_PrintSummary)
338364
##### Info output #####
339365
message(STATUS "")
@@ -366,6 +392,18 @@ function(SDL_PrintSummary)
366392
message(STATUS " Build libraries as Apple Framework: ${SDL_FRAMEWORK}")
367393
endif()
368394
message(STATUS "")
395+
396+
message(STATUS "Enabled backends:")
397+
PrintEnabledBackends("Video drivers" "^SDL_VIDEO_DRIVER_([A-Z0-9]*)$")
398+
if(SDL_VIDEO_DRIVER_X11)
399+
PrintEnabledBackends("X11 libraries" "^SDL_VIDEO_DRIVER_X11_([A-Z0-9]*)$")
400+
endif()
401+
PrintEnabledBackends("Render drivers" "^SDL_VIDEO_RENDER_([A-Z0-9]*)$")
402+
PrintEnabledBackends("GPU drivers" "^SDL_GPU_([A-Z0-9]*)$")
403+
PrintEnabledBackends("Audio drivers" "^SDL_AUDIO_DRIVER_([A-Z0-9]*)$")
404+
PrintEnabledBackends("Joystick drivers" "^SDL_JOYSTICK_([A-Z0-9]*)$")
405+
message(STATUS "")
406+
369407
if(UNIX)
370408
message(STATUS "If something was not detected, although the libraries")
371409
message(STATUS "were installed, then make sure you have set the")

0 commit comments

Comments
 (0)