WIP: switch build to SDL 3 (does not compile yet)

This is the first commit of the SDL 1.2 -> SDL 3 migration. It lands
the build-system change and the include-path rewrites; the code does
NOT compile against SDL 3 yet, by design. Stays on this branch until
the migration is finished.

- CMakeLists.txt: find_package(SDL3 CONFIG) + SDL3::SDL3 /
  SDL3_image::SDL3_image. Drops the legacy FindSDL machinery.
- glSDL.h, sprite.c, glSDL.c, filters.c, gfxengine.cpp, audio.c:
  rewrite #include "SDL*.h" -> <SDL3/...> / <SDL3_image/...>.

Known wall: graphics/glSDL.{c,h} collides with SDL 3's surface API
renames (SDL_FreeSurface, SDL_FillRect, SDL_SetColorKey,
SDL_SetClipRect, SDL_bool). The next phase deletes the entire glSDL
shim and rewrites graphics/ against SDL_Renderer / SDL_Texture.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ville Lindholm 2026-05-28 21:23:08 +03:00
parent 9eaf27b297
commit 9b0662865e
No known key found for this signature in database
GPG Key ID: 89AE9EAA3B6FDE7C
7 changed files with 11 additions and 14 deletions

View File

@ -35,11 +35,9 @@ check_symbol_exists(_vsnprintf stdio.h HAVE__VSNPRINTF)
# ---------------------------------------------------------------------------
# Third-party libraries
# ---------------------------------------------------------------------------
# This codebase targets SDL 1.2 and SDL_image 1.2. CMake's bundled FindSDL
# / FindSDL_image modules locate these directly; on macOS with Homebrew,
# `brew install sdl12-compat sdl_image` works.
find_package(SDL REQUIRED)
find_package(SDL_image REQUIRED)
# Migrating to SDL 3. Homebrew: `brew install sdl3 sdl3_image`.
find_package(SDL3 CONFIG REQUIRED)
find_package(SDL3_image CONFIG REQUIRED)
if(KOBO_ENABLE_OPENGL)
find_package(OpenGL)
@ -122,9 +120,8 @@ target_compile_definitions(kobo_deps INTERFACE
target_include_directories(kobo_deps INTERFACE
${CMAKE_CURRENT_BINARY_DIR} # for generated aconfig.h
${CMAKE_CURRENT_SOURCE_DIR} # for config.h
${SDL_INCLUDE_DIR}
)
target_link_libraries(kobo_deps INTERFACE ${SDL_LIBRARY} ${SDL_IMAGE_LIBRARIES})
target_link_libraries(kobo_deps INTERFACE SDL3::SDL3 SDL3_image::SDL3_image)
if(HAVE_OPENGL)
target_compile_definitions(kobo_deps INTERFACE HAVE_OPENGL)

View File

@ -23,7 +23,7 @@
#include <math.h>
#include "logger.h"
#include "glSDL.h"
#include "SDL_image.h"
#include <SDL3_image/SDL_image.h>
#include "sprite.h"
#include "filters.h"

View File

@ -28,7 +28,7 @@
#include "gfxengine.h"
#include "filters.h"
#include "SDL_image.h"
#include <SDL3_image/SDL_image.h>
#include "glSDL.h"
#include "sofont.h"
#include "window.h"

View File

@ -30,7 +30,7 @@
#include <math.h>
#if HAS_SDL_OPENGL_H
#include "SDL_opengl.h"
#include <SDL3/SDL_opengl.h>
#else
#ifdef WIN32
#include <windows.h>

View File

@ -20,7 +20,7 @@
*/
/* We're still using SDL datatypes here - we just add some stuff. */
#include "SDL.h"
#include <SDL3/SDL.h>
/*
* Ignore the flag from SDL w/ glSDL backend, since we're going

View File

@ -30,7 +30,7 @@ TODO: tables as needed when loading banks.
#include <string.h>
#include "logger.h"
#include "glSDL.h"
#include "SDL_image.h"
#include <SDL3_image/SDL_image.h>
#include "sprite.h"
#include "filters.h"

View File

@ -45,8 +45,8 @@
#include "audiodev.h"
#endif
#include "SDL.h"
#include "SDL_audio.h"
#include <SDL3/SDL.h>
#include <SDL3/SDL_audio.h>
#include "logger.h"
#include "a_struct.h"