Skip to content

Conversation

@slouken
Copy link
Collaborator

@slouken slouken commented Nov 3, 2025

This prevents people from accidentally creating builds that are missing expected functionality.

@slouken slouken added this to the 3.4.0 milestone Nov 3, 2025
@slouken slouken requested review from icculus and madebr November 3, 2025 18:45
@slouken
Copy link
Collaborator Author

slouken commented Nov 3, 2025

@smcv, @madebr, thoughts?

@smcv
Copy link
Contributor

smcv commented Nov 3, 2025

I'm sure we've discussed this in the past, but I'm not sure on what issue or PR.

What we probably ideally want is the CMake equivalent of Meson's feature, which can take three values enabled (find the dependency and enable the feature, or fail the build); disabled (don't enable the feature even if the dependency happens to be present); or auto (an "automagic dependency": if the dependency is present, enable the feature, else don't). But in CMake it's conventional to enable/disable features with boolean arguments (ON or OFF), which can't possibly represent all three of those states: we can have either ON → enabled, OFF → disabled or ON → auto, OFF → disabled (or in theory ON → enabled, OFF → auto but that's just silly).

https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Automagic_dependencies#CMake describes how to make the boolean argument a toggle between the equivalent of Meson's enabled and disabled. This is great for packagers, who want their feature-set to be predictable, but relatively user-hostile for a quick developer build with "whatever features are conveniently available".

If I understand correctly, having features be ON or OFF is only a convention, not a hard rule, and we could equally well have ON/AUTO/OFF or something if we wanted to?

@smcv
Copy link
Contributor

smcv commented Nov 3, 2025

What we probably ideally want is the CMake equivalent of Meson's feature, which can take three values enabled, disabled or auto

See also Autotools --enable-foo (exactly equivalent to --enable-foo=yes), --enable-foo=auto or --disable-foo (exactly equivalent to --enable-foo=no).

@slouken slouken force-pushed the update branch 2 times, most recently from 51c2eee to 173c77f Compare November 3, 2025 19:11
@smcv
Copy link
Contributor

smcv commented Nov 3, 2025

This prevents people from accidentally creating builds that are missing expected functionality.

I see you're doing this for the X11 stuff. One important cost of this is that it makes X11 inconsistent with e.g. Wayland, PulseAudio, Pipewire where =ON means something different.

I agree that in an ideal world, we probably want all the X11 libraries to be mandatory-unless-explicitly-disabled on OSs where X11 is expected to be used (Linux, *BSD, and basically any other Unix system, except for special cases that have their own UI framework, like the Darwin family, Android and maybe Haiku) - but is this inconsistency an acceptable price to pay for that? (And the fact that this is OS-dependent means we need OS-dependent behaviour, which is more complicated.)

On Linux in the 2020s, we probably also want Pulseaudio and Wayland to be mandatory-unless-explicitly-disabled? (We can disable Wayland for retrocomputing platforms like Steam Runtime 1 'scout'.) And perhaps also Pipewire and ALSA?

If Wayland is enabled, perhaps libdecor should also be mandatory-unless-explicitly-disabled? But that's getting into dependencies that are conditional on other dependencies which is pretty complicated.

@slouken
Copy link
Collaborator Author

slouken commented Nov 3, 2025

This prevents people from accidentally creating builds that are missing expected functionality.

I see you're doing this for the X11 stuff. One important cost of this is that it makes X11 inconsistent with e.g. Wayland, PulseAudio, Pipewire where =ON means something different.

I agree that in an ideal world, we probably want all the X11 libraries to be mandatory-unless-explicitly-disabled on OSs where X11 is expected to be used (Linux, *BSD, and basically any other Unix system, except for special cases that have their own UI framework, like the Darwin family, Android and maybe Haiku) - but is this inconsistency an acceptable price to pay for that? (And the fact that this is OS-dependent means we need OS-dependent behaviour, which is more complicated.)

On Linux in the 2020s, we probably also want Pulseaudio and Wayland to be mandatory-unless-explicitly-disabled? (We can disable Wayland for retrocomputing platforms like Steam Runtime 1 'scout'.) And perhaps also Pipewire and ALSA?

If Wayland is enabled, perhaps libdecor should also be mandatory-unless-explicitly-disabled? But that's getting into dependencies that are conditional on other dependencies which is pretty complicated.

Yeah, I'm not 100% sure we want this change, but we're relying on X11 extensions more and I want to make sure people don't accidentally have broken builds. It comes up pretty regularly that we get a bug report and someone forgot to install one of the development packages.

Maybe we should just treat the X11 extension libraries as required if X11 is enabled and found?

@slouken
Copy link
Collaborator Author

slouken commented Nov 3, 2025

I've re-scoped this just to X11 libraries, for clarity.

@slouken slouken changed the title Fail configuration if desired dependency packages aren't available Fail configuration if X11 dependency packages aren't available Nov 3, 2025
It happens fairly often that people enable X11 support but don't install the extension libraries that SDL depends on. This makes those required if not explicitly disabled, which should help prevent accidentally broken builds.
@slouken slouken merged commit 05887f2 into libsdl-org:main Nov 3, 2025
43 checks passed
@slouken slouken deleted the update branch November 3, 2025 21:01
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

Successfully merging this pull request may close these issues.

3 participants