Skip to content

feat: add dual SDL2/SDL3 support with CMake option - #128

Closed
doncollins1985 wants to merge 1 commit into
projectM-visualizer:masterfrom
doncollins1985:sdl3-upgrade
Closed

feat: add dual SDL2/SDL3 support with CMake option#128
doncollins1985 wants to merge 1 commit into
projectM-visualizer:masterfrom
doncollins1985:sdl3-upgrade

Conversation

@doncollins1985

Copy link
Copy Markdown
  • Add USE_SDL CMake option (Auto/SDL2/SDL3) — prefers SDL3 when available
  • All source files use #ifdef USE_SDL3 guards for API differences:
    • Event type constants, key event struct access, modifier keys
    • Window/drawable size functions, timer functions
    • ImGui backend (sdl2 vs sdl3), GLSL version (150 vs 300 es)
    • Audio capture API (callback vs polling)
    • OpenGL proc loader for projectM (SDL3 requires explicit loader)
    • Drop file event handling
  • New cmake/SDL3Target.cmake for SDL3 target verification
  • Updated ImGui.cmake for conditional SDL2/SDL3 backend and demo
  • Updated dependencies_check.cmake for version-specific checks
  • Updated packaging-linux.cmake for SDL-appropriate DEB depends
  • Updated CI buildcheck to test both SDL2 and SDL3 on Linux
  • Refactored drop file handler into separate HandleDropFile method
  • Added audio device hotplug support for SDL3
  • Added CurrentAudioLevel() and RefreshDeviceList() to AudioCapture
  • Kept ImGui demo application target (ImGuiDemo)

- Add USE_SDL CMake option (Auto/SDL2/SDL3) — prefers SDL3 when available
- All source files use #ifdef USE_SDL3 guards for API differences:
  Event types, key struct members, modifier keys, timer/window functions,
  ImGui backend (sdl2/sdl3), GLSL version (150/300 es), audio capture API,
  OpenGL proc loader, drop file handling
- Conditional SDL linkage: SDL3::SDL3 vs SDL2::SDL2 + SDL2::SDL2main
- New cmake/SDL3Target.cmake for SDL3 target verification
- Updated ImGui.cmake for conditional backend and kept ImGuiDemo target
- Updated dependencies_check.cmake and packaging-linux.cmake for SDL version
- Added audio device hotplug support for SDL3
- Added CurrentAudioLevel() and RefreshDeviceList() to AudioCapture
- Refactored drop file handler into HandleDropFile() method
- CI builds both SDL2 and SDL3 on all three platforms:
  Linux (apt sdl2-dev / SDL3 from source), Windows (vcpkg),
  macOS (brew sdl2 / SDL3 from source)
- vcpkg.json includes both sdl2 and sdl3
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.

1 participant