Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Descriptive Wiki entries for CMake options #11230

Closed
M2-TE opened this issue Oct 16, 2024 · 4 comments
Closed

Descriptive Wiki entries for CMake options #11230

M2-TE opened this issue Oct 16, 2024 · 4 comments

Comments

@M2-TE
Copy link

M2-TE commented Oct 16, 2024

The CMake options are currently being described in the README-cmake.md, which seems to be missing some options that may be of interest to people who use CMake's FetchContent or would otherwise build SDL themselves in general.

Examples include stuff like SDL_VULKAN or SDL_OPENGL, support for which is automatically enabled under e.g. Windows. Disabling these manually should not be an issue if the application does not plan on using these graphics APIs (as far as I am aware) and would cut down on compilation time + file size.

Another example would be SDL_PRESEED, of which I'm curious about how it works exactly, as configuration time can be rather long.

It would also be nice if all the CMake configuration options could be put onto the SDL3/FrontPage Wiki, so that these are available at a glance. Currently there's just the SDL3/Installation section, but it focuses more on the different platforms, rather than CMake options themselves, so it might warrant an extra page such as SDL3/CMake.

@slouken
Copy link
Collaborator

slouken commented Oct 16, 2024

Feel free to contribute a PR!

@M2-TE
Copy link
Author

M2-TE commented Oct 20, 2024

Going through the options, there is SDL_DUMMYAUDIO, enabled by default when the audio subsystem is requested.

SDL/CMakeLists.txt

Lines 1178 to 1193 in 679dd4b

# General SDL subsystem options, valid for all platforms
if(SDL_AUDIO)
# CheckDummyAudio/CheckDiskAudio - valid for all platforms
if(SDL_DUMMYAUDIO)
set(SDL_AUDIO_DRIVER_DUMMY 1)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/audio/dummy/*.c")
set(HAVE_DUMMYAUDIO TRUE)
set(HAVE_SDL_AUDIO TRUE)
endif()
if(SDL_DISKAUDIO)
set(SDL_AUDIO_DRIVER_DISK 1)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/audio/disk/*.c")
set(HAVE_DISKAUDIO TRUE)
set(HAVE_SDL_AUDIO TRUE)
endif()
endif()

It is also forcefully enabled in case there is no audio implementation present

SDL/CMakeLists.txt

Lines 2972 to 2975 in 679dd4b

if(NOT HAVE_SDL_AUDIO)
set(SDL_AUDIO_DRIVER_DUMMY 1)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/audio/dummy/*.c")
endif()

The same goes for the camera and video subsystems with SDL_DUMMYCAMERA and SDL_DUMMYVIDEO respectively. Forcefully disabling the compilation of dummy files causes no issues and compiles normally regardless. So what exactly is the purpose of these subsystem dummies?

@M2-TE M2-TE closed this as completed Jan 21, 2025
@slouken
Copy link
Collaborator

slouken commented Jan 21, 2025

They are dummy implementations that provide the API with no underlying hardware. They're useful for testing or for making sure the API is functional even if implementations are not available.

@M2-TE
Copy link
Author

M2-TE commented Jan 22, 2025

Thanks for the explanation @slouken !
My original goal was to reduce the compile times for SDL by selectively disabling certain subsystems during development, e.g. when using it only for window management and nothing else. Thought I could disable them in the CMake via all those options, hence the issue. I was not really successful in reducing compile times though (headers were also still pretty large). The CMake configuration steps where SDL compiles small test programs can also run very slow, especially on Windows, where each resulting test binary had to be checked by the OS.

Combined with the fact that the SDL CMake chooses the options pretty well by default and the fact that a lot of the systems are closely intertwined, creating a wiki for them or especially separating subsystems went way above my head, so I simply dropped the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants