SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Descriptive Wiki entries for CMake options

Open M2-TE opened this issue 1 year ago • 1 comments

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.

M2-TE avatar Oct 16 '24 13:10 M2-TE

Feel free to contribute a PR!

slouken avatar Oct 16 '24 14:10 slouken

Going through the options, there is SDL_DUMMYAUDIO, enabled by default when the audio subsystem is requested. https://github.com/libsdl-org/SDL/blob/679dd4b18127cdde882c0c7967ca18cb25df0366/CMakeLists.txt#L1178-L1193

It is also forcefully enabled in case there is no audio implementation present https://github.com/libsdl-org/SDL/blob/679dd4b18127cdde882c0c7967ca18cb25df0366/CMakeLists.txt#L2972-L2975

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 avatar Oct 20 '24 15:10 M2-TE

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.

slouken avatar Jan 21 '25 15:01 slouken

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.

M2-TE avatar Jan 22 '25 12:01 M2-TE