From 25453f13bbd74f94eb1be3d15320f6c79aad2472 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Sat, 21 Feb 2026 23:07:35 +0100 Subject: [PATCH] Use SDL3 by default if it's available The support for SDL3 should now be good enough so we can use it by default if it's available. --- .cirrus.yml | 2 +- .gitlab-ci.yml | 2 +- CMakeLists.txt | 19 +++++++++---------- configure | 7 ------- hatari.spec | 3 ++- 5 files changed, 13 insertions(+), 20 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index de884096a..d5f930ea1 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -117,7 +117,7 @@ cygwin_task: script: - C:\tools\cygwin\bin\bash.exe -lc "cd '%cd%' ; CFLAGS='-Werror -Wno-error=char-subscripts' - cmake -G 'Unix Makefiles' -DENABLE_SDL3=1 ." + cmake -G 'Unix Makefiles' ." - C:\tools\cygwin\bin\bash.exe -lc "cd '%cd%' ; make -j4" test_script: - C:\tools\cygwin\bin\bash.exe -lc "cd '%cd%' ; ctest -j4 --output-on-failure" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 72572d24f..8255b694e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -94,7 +94,7 @@ build-fedora: before_script: - dnf update -y - dnf install -y cmake make gcc diffutils python-unversioned-command - capstone-devel GraphicsMagick SDL2-devel libpng-devel zlib-devel tidy + capstone-devel GraphicsMagick SDL3-devel libpng-devel zlib-devel tidy python3-gobject gtk3 readline-devel man git rpmdevtools libarchive-devel script: - rpmdev-setuptree diff --git a/CMakeLists.txt b/CMakeLists.txt index 57df9f749..2361df4ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,8 +55,6 @@ set(ENABLE_DSP_EMU 1 CACHE BOOL "Enable DSP 56k emulator for Falcon mode") set(ENABLE_TRACING 1 CACHE BOOL "Enable tracing messages for debugging") -set(ENABLE_SDL3 0 - CACHE BOOL "Use SDL3 instead of SDL2") find_path(LIBRETRO_INCLUDE_DIR libretro.h PATH_SUFFIXES libretro libretro-common) @@ -123,19 +121,20 @@ endif(ENABLE_OSX_BUNDLE) # Check for libraries: # #################### -if(ENABLE_SDL3) - find_package(SDL3) - if(NOT SDL3_FOUND) - message(FATAL_ERROR "SDL3 library not found!") - endif(NOT SDL3_FOUND) +if(NOT DEFINED ENABLE_SDL3 OR ENABLE_SDL3) + find_package(SDL3 QUIET) +endif() +if(SDL3_FOUND) # Yes, we're cheating by re-using the SDL2_* variables: set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS}) set(SDL2_LIBRARIES ${SDL3_LIBRARIES}) + set(ENABLE_SDL3 1 CACHE BOOL "Use SDL3 instead of SDL2") else() find_package(SDL2) if(NOT SDL2_FOUND) - message(FATAL_ERROR "SDL2 library not found!") + message(FATAL_ERROR "SDL library not found!") endif(NOT SDL2_FOUND) + set(ENABLE_SDL3 0 CACHE BOOL "Use SDL3 instead of SDL2") endif() find_package(Math) @@ -216,7 +215,7 @@ if(DETECTED_LFS_CFLAGS) endif(DETECTED_LFS_CFLAGS) # Additional CFLAGS suggested by the SDL library: -if(NOT ENABLE_SDL3) +if(NOT SDL3_FOUND) if(PKG_CONFIG_FOUND) execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --cflags-only-other sdl2 OUTPUT_VARIABLE SDL2_OTHER_CFLAGS @@ -451,7 +450,7 @@ Libraries summary : ------------------- ") -if(ENABLE_SDL3) +if(SDL3_FOUND) message(" - sdl :\tusing SDL3 ${SDL3_VERSION}") else() message(" - sdl :\tusing SDL2 ${SDL2_VERSION}") diff --git a/configure b/configure index a3b584e0e..a4e7110a7 100755 --- a/configure +++ b/configure @@ -17,7 +17,6 @@ print_help() echo " --enable-asan Enable address sanitizer debug build" echo " --enable-debug Enable debug (non-optimized) build" echo " --disable-dsp Disable DSP emulation for Falcon mode." - echo " --enable-sdl3 Use SDL3 instead of SDL2" echo " --disable-tracing Disable tracing messages for debugging" echo " --disable-osx-bundle Disable application bundling on macOS" echo " --enable-ubsan Enable undefined behavior sanitizer debug build" @@ -65,12 +64,6 @@ do --disable-dsp) cmake_args="$cmake_args -DENABLE_DSP_EMU:BOOL=0" ;; - --enable-sdl3) - cmake_args="$cmake_args -DENABLE_SDL3:BOOL=1" - ;; - --disable-sdl3) - cmake_args="$cmake_args -DENABLE_SDL3:BOOL=0" - ;; --enable-tracing) cmake_args="$cmake_args -DENABLE_TRACING:BOOL=1" ;; diff --git a/hatari.spec b/hatari.spec index 688fc5848..7a709145c 100644 --- a/hatari.spec +++ b/hatari.spec @@ -19,7 +19,8 @@ Prefix: /usr BuildRequires: binutils cmake coreutils cpio cpp diffutils file filesystem BuildRequires: findutils gcc grep gzip libgcc make man patch sed util-linux -BuildRequires: glibc-devel zlib-devel SDL2-devel libpng-devel readline-devel +BuildRequires: glibc-devel zlib-devel SDL3-devel libpng-devel readline-devel +BuildRequires: libarchive-devel # Required by zip2st and atari-hd-image Requires: unzip