sdl: consume SDL3 from the SDK - #2176
Conversation
Points the SDK prefix paths at $OSSIA_SDK/SDL3 (see ossia/sdk#27), renames the ossia::sdl2 link target to ossia::sdl3, moves the Emscripten link option to -sUSE_SDL=3, and bumps libossia to the branch carrying the API port. The libossia bump also picks up the 13 commits of master the submodule was behind; none of them touch SDL. avendish is deliberately untouched. avendish.ossia.cmake and avendish.standalone.cmake do reference a bare SDL2 link target, but every one of those references sits behind either the `if(1)` short-circuit at the top of avendish.ossia.cmake or an `if(TARGET ossia::ossia)` that score's build does not enter -- no link.txt in a configured score build mentions SDL2, and the only libSDL2.so left in build.ninja comes from system ffmpeg's avdevice pkg-config ldflags, which is unrelated. Verified on linux-x86_64 against SDL3 3.4.14: JoystickDevice.cpp, JoystickProtocolFactory.cpp, JoystickProtocolSettingsWidget.cpp, JoystickSpecificSettingsSerialization.cpp and score_plugin_audio.cpp (which is what pulls in Audio/SDLInterface.hpp) all compile clean under this build's own flags and warnings. joystick_info keeps its index-based API, so the enumeration loops in JoystickDevice and JoystickProtocolFactory and the (id, index) pair in JoystickSpecificSettings needed no change and existing save files keep loading. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTUi76cnUWh7dGZC64LqbZ
…aries
The prefix-path change only covers builds that consume $OSSIA_SDK. The flatpak
and the distro legs resolve SDL from elsewhere, and find_package(SDL3) finds
nothing there, which silently turns OSSIA_ENABLE_SDL off and drops the joystick
protocol and the SDL audio engine from those artefacts.
The flatpak had no SDL module at all: it was picking SDL2 up from the
org.kde.Platform runtime. Every other non-runtime dependency in that manifest is
bundled (portaudio, boost, faust, ysfx, ...), so SDL3 is bundled the same way,
built with the same subsystem set the SDK uses.
For the distro legs, libsdl3 exists in Debian trixie (3.2.10) and sid (3.4.14)
and in Ubuntu plucky (3.2.8) and questing (3.2.20), so those move to
libsdl3-dev/libsdl3-0, and nix moves to the SDL3 attribute.
Ubuntu jammy, noble, lunar and oracular are deliberately left alone: none of
those releases ship libsdl3 at all, so there is nothing to point them at. They
will build without the joystick protocol until someone decides whether to build
SDL3 from source in their deps scripts. Debian bookworm/bullseye/trixie already
had their libsdl2 lines commented out, so nothing changes for them.
Note this is a silent downgrade rather than a build failure, despite
score_assert_feature(sdl) and SCORE_DEPLOYMENT_BUILD=1 being set on those legs:
score_assert_feature is currently a no-op. It does list(APPEND
SCORE_MISSING_FEATURES ...) inside a function() with no PARENT_SCOPE, so the
variable the FATAL_ERROR tests is always empty, and it also passes a dereferenced
"${SCORE_FEATURES_LIST}" to IN_LIST, which expects the list's name. Left as-is
here on purpose - fixing it belongs in its own change, and would turn several
legs red at once.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TTUi76cnUWh7dGZC64LqbZ
Ubuntu jammy (22.04 LTS), noble (24.04 LTS), lunar and oracular ship no libsdl3 at all, so pointing them at a package was not an option and they would otherwise have built with the joystick protocol and the SDL audio engine quietly missing. ci/sdl3.source.deps.sh builds SDL3 3.4.14 into /usr/local with the same subsystem set as the SDK's sdl.sh and the flatpak module. It is sourced rather than executed so $SUDO from common.setup.sh stays in scope, which is also why it contains no `exit` - that would take the calling deps script down with it and skip common.deps.sh. It short-circuits on `pkg-config --exists sdl3`, so a release that gains a libsdl3 package later only needs its apt line changed and the source build becomes a no-op. libsdl2-dev/libsdl2-2.0-0 are replaced by libudev-dev on those four: SDL3's linux joystick and HIDAPI backends want it, and nothing else in the tree needs SDL2 any more. Version tracks SDL_VERSION in ossia/sdk's common/versions.sh; keep them in step. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTUi76cnUWh7dGZC64LqbZ
jcelerier
left a comment
There was a problem hiding this comment.
urgh, if ubuntu noble still doesn't have SDL3 then maybe it's still a few years too early to do this. There's a lot of work in score right now towards making sure it can build as-is on distros so this would really break this :/
|
Fair point, and taken — Edu and I discussed this live with you, so to record the resolution here: SDL gets disabled on any build whose distro doesn't ship SDL3. No source builds, no dual SDL2/SDL3 code path. (I did size a dual-version option — Before I rework the PRs, here's the actual per-target picture, since it's a bit better than "noble doesn't have it". Ships SDL3 — SDL stays enabled
No SDL3 — SDL disabled
So the net change to "builds as-is on distros" is: noble and jammy lose the joystick protocol and the SDL audio engine. Everything else either already had SDL off, or has SDL3 available. Two things that need your call1. Flatpak. The 2. WASM. Emscripten's Two incidental findings
Also worth a Hardware check, since it came upEdu plugged in a DualShock 4, so the rewritten paths are now verified against real hardware, not just the API: type detected as Not touching anything until you ok this — in particular the flatpak and WASM calls above. Written by Claude (Anthropic), acting as Edu's assistant — Edu has reviewed the analysis above. |
The score half of the SDL3 move. Third of three:
Depends on ossia/libossia#922; the submodule bump here points at that branch, so this can't merge before it.
What changed
$OSSIA_SDK/SDL2*→$OSSIA_SDK/SDL3*inCMakeLists.txtandcmake/ScoreExternalAddon.developer.cmakeossia::sdl2→ossia::sdl3inscore-plugin-audio-sUSE_SDL=2→-sUSE_SDL=3insrc/app/CMakeLists.txtThe submodule bump also picks up the 13 commits of libossia master the pin was behind. None of them touch SDL (two touch audio, both miniaudio).
Nothing else needed changing
joystick_infodeliberately kept its index-based API in ossia/libossia#922, so the enumeration loops inJoystickDevice.cpp/JoystickProtocolFactory.cppand the(id, index)pair inJoystickSpecificSettingsare untouched — existing save files keep loading.avendish is deliberately untouched.
avendish.ossia.cmakeandavendish.standalone.cmakedo reference a bareSDL2link target, but every one of those sits behind either theif(1)short-circuit at the top ofavendish.ossia.cmakeor anif(TARGET ossia::ossia)that score's build never enters. I checked a configured build: nolink.txtmentions SDL2, and the onlylibSDL2.soinbuild.ninjacomes from system ffmpeg'savdevicepkg-config ldflags — unrelated. So this stays a two-repo change rather than needing aceltera/avendishPR.Testing (linux-x86_64, SDL3 3.4.14)
Every affected TU compiles clean under this build's real flags and warnings:
JoystickDevice.cppJoystickProtocolFactory.cppJoystickProtocolSettingsWidget.cppJoystickSpecificSettingsSerialization.cppscore_plugin_audio.cpp(the TU that pulls inAudio/SDLInterface.hpp)Runtime behaviour of the two rewritten paths is verified in ossia/libossia#922.
Packaging targets that don't use the SDK
The prefix-path change only covers
$OSSIA_SDKconsumers. Two other paths resolve SDL elsewhere and needed fixing, or they silently lose the joystick protocol and the SDL audio engine:org.kde.Platformruntime. Every other non-runtime dep in that manifest is bundled (portaudio, boost, faust, ysfx, …), somodules/sdl3.yamlbundles SDL3 the same way, with the SDK's subsystem set.libsdl2-dev, only some releases actually shiplibsdl3. Verified against the Debian and Launchpad archives:libsdl3-devlibsdl3-dev libsdl3-0libsdl3-dev libsdl3-0nix moves to the
SDL3attribute.Ubuntu jammy (22.04 LTS), noble (24.04 LTS), lunar and oracular will build without the joystick protocol — those releases have no
libsdl3to point at. Needs a call on whether to build SDL3 from source in their deps scripts.A correction worth recording
I initially expected these legs to fail rather than degrade, because they set
SCORE_DEPLOYMENT_BUILD=1andScoreFeatureCheck.cmakedoesscore_assert_feature(sdl)with aFATAL_ERROR. That assert is a no-op:list(APPEND)in afunction()withoutPARENT_SCOPEnever reaches the variable theFATAL_ERRORtests, andIN_LISTis given a dereferenced"${SCORE_FEATURES_LIST}"where it wants the list's name. Verified with a minimal CMake repro. Same forscore_assert_plugin. It also explains how the Debian legs pass today with their SDL lines commented out.Not fixed here on purpose — it's an unrelated latent bug and repairing it would turn several legs red simultaneously. Happy to open a separate issue.
Not covered
No gamepad on the test machine, so rumble/sensors/touchpad are compile- and API-verified only. And a full SDK-based build needs an SDK carrying SDL3, which is why ossia/sdk#27 lands first.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TTUi76cnUWh7dGZC64LqbZ