cmake: Report enabled subsystem backends in a compact form. (#13926)

Looks like this:

```
-- Enabled backends:
--   Video drivers: dummy kmsdrm(dynamic) offscreen wayland(dynamic) x11(dynamic)
--   X11 libraries: 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.

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
This commit is contained in:
Ryan C. Gordon
2025-09-12 14:59:43 -04:00
committed by GitHub
parent c78818bd4b
commit 1c784c453d

View File

@@ -334,6 +334,29 @@ if(APPLE)
endif()
endif()
function(PrintEnabledBackends _SUBSYS _REGEXP)
get_cmake_property(_ALLVARS VARIABLES)
foreach(_VAR IN LISTS _ALLVARS)
if(_VAR AND _VAR MATCHES "${_REGEXP}")
string(TOLOWER "${CMAKE_MATCH_1}" _LOWERED)
if(NOT _LOWERED MATCHES "available|default|dynamic") # a little hack
if(${_VAR}_DYNAMIC)
list(APPEND _ENABLED_BACKENDS "${_LOWERED}(dynamic)")
else()
list(APPEND _ENABLED_BACKENDS "${_LOWERED}")
endif()
endif()
endif()
endforeach()
if(_ENABLED_BACKENDS STREQUAL "")
set(_SPACEDOUT "(none)")
else()
string(REPLACE ";" " " _SPACEDOUT "${_ENABLED_BACKENDS}")
endif()
message(STATUS " ${_SUBSYS}: ${_SPACEDOUT}")
endfunction()
function(SDL_PrintSummary)
##### Info output #####
message(STATUS "")
@@ -366,6 +389,18 @@ function(SDL_PrintSummary)
message(STATUS " Build libraries as Apple Framework: ${SDL_FRAMEWORK}")
endif()
message(STATUS "")
message(STATUS "Enabled backends:")
PrintEnabledBackends("Video drivers" "^SDL_VIDEO_DRIVER_([A-Z0-9]*)$")
if(SDL_VIDEO_DRIVER_X11)
PrintEnabledBackends("X11 libraries" "^SDL_VIDEO_DRIVER_X11_([A-Z0-9]*)$")
endif()
PrintEnabledBackends("Render drivers" "^SDL_VIDEO_RENDER_([A-Z0-9]*)$")
PrintEnabledBackends("GPU drivers" "^SDL_GPU_([A-Z0-9]*)$")
PrintEnabledBackends("Audio drivers" "^SDL_AUDIO_DRIVER_([A-Z0-9]*)$")
PrintEnabledBackends("Joystick drivers" "^SDL_JOYSTICK_([A-Z0-9]*)$")
message(STATUS "")
if(UNIX)
message(STATUS "If something was not detected, although the libraries")
message(STATUS "were installed, then make sure you have set the")