switch to SDL3 dep

This commit is contained in:
octocar 2025-10-01 21:04:31 +02:00 committed by crueter
parent 61adc85c4b
commit b7541c3564
21 changed files with 57 additions and 57 deletions

View file

@ -97,8 +97,8 @@ cmake .. -G Ninja \
-DCMAKE_CXX_FLAGS="$ARCH_FLAGS" \
-DCMAKE_C_FLAGS="$ARCH_FLAGS" \
-DYUZU_USE_BUNDLED_QT=OFF \
-DYUZU_USE_BUNDLED_SDL2=OFF \
-DYUZU_USE_EXTERNAL_SDL2=ON \
-DYUZU_USE_BUNDLED_SDL3=OFF \
-DYUZU_USE_EXTERNAL_SDL3=ON \
-DYUZU_TESTS=OFF \
-DYUZU_USE_QT_MULTIMEDIA=$MULTIMEDIA \
-DYUZU_USE_QT_WEB_ENGINE=$WEBENGINE \

View file

@ -137,14 +137,14 @@ if (PLATFORM_FREEBSD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
endif()
# Set bundled sdl2/qt as dependent options.
# On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion
cmake_dependent_option(ENABLE_SDL2 "Enable the SDL2 frontend" ON "NOT ANDROID" OFF)
# Set bundled sdl3/qt as dependent options.
# On Linux system SDL3 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion
cmake_dependent_option(ENABLE_SDL3 "Enable the SDL3 frontend" ON "NOT ANDROID" OFF)
if (ENABLE_SDL2)
if (ENABLE_SDL3)
# TODO(crueter): Cleanup, each dep that has a bundled option should allow to choose between bundled, external, system
cmake_dependent_option(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" OFF "NOT MSVC" OFF)
option(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 build" "${MSVC}")
cmake_dependent_option(YUZU_USE_EXTERNAL_SDL3 "Compile external SDL3" OFF "NOT MSVC" OFF)
option(YUZU_USE_BUNDLED_SDL3 "Download bundled SDL3 build" "${MSVC}")
endif()
option(ENABLE_QT "Enable the Qt frontend" ON)
@ -215,7 +215,7 @@ option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android"
cmake_dependent_option(YUZU_ROOM "Enable dedicated room functionality" ON "NOT ANDROID" OFF)
cmake_dependent_option(YUZU_ROOM_STANDALONE "Enable standalone room executable" ON "YUZU_ROOM" OFF)
cmake_dependent_option(YUZU_CMD "Compile the eden-cli executable" ON "ENABLE_SDL2;NOT ANDROID" OFF)
cmake_dependent_option(YUZU_CMD "Compile the eden-cli executable" ON "ENABLE_SDL3;NOT ANDROID" OFF)
cmake_dependent_option(YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support" OFF "WIN32 OR LINUX" OFF)
@ -609,10 +609,10 @@ if(ENABLE_CUBEB)
endif()
endif()
# find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the YUZU_find_package
if (ENABLE_SDL2)
if (YUZU_USE_EXTERNAL_SDL2)
message(STATUS "Using SDL2 from externals.")
# find SDL3 exports a bunch of variables that are needed, so its easier to do this outside of the YUZU_find_package
if (ENABLE_SDL3)
if (YUZU_USE_EXTERNAL_SDL3)
message(STATUS "Using SDL3 from externals.")
if (NOT WIN32)
# Yuzu itself needs: Atomic Audio Events Joystick Haptic Sensor Threads Timers
# Since 2.0.18 Atomic+Threads required for HIDAPI/libusb (see https://github.com/libsdl-org/SDL/issues/5095)
@ -635,16 +635,16 @@ if (ENABLE_SDL2)
if ("${YUZU_SYSTEM_PROFILE}" STREQUAL "steamdeck")
set(SDL_PIPEWIRE OFF) # build errors out with this on
AddJsonPackage("sdl2_steamdeck")
AddJsonPackage("sdl3_steamdeck")
else()
AddJsonPackage("sdl2_generic")
AddJsonPackage("sdl3_generic")
endif()
elseif (YUZU_USE_BUNDLED_SDL2)
message(STATUS "Using bundled SDL2")
AddJsonPackage(sdl2)
elseif (YUZU_USE_BUNDLED_SDL3)
message(STATUS "Using bundled SDL3")
AddJsonPackage(sdl3)
endif()
find_package(SDL2 2.26.4 REQUIRED)
find_package(SDL3 3.2.22 REQUIRED)
endif()
# List of all FFmpeg components required

View file

@ -4,5 +4,5 @@
function(copy_yuzu_SDL_deps target_dir)
include(WindowsCopyFiles)
set(DLL_DEST "$<TARGET_FILE_DIR:${target_dir}>/")
windows_copy_files(${target_dir} ${SDL2_DLL_DIR} ${DLL_DEST} SDL2.dll)
windows_copy_files(${target_dir} ${SDL3_DLL_DIR} ${DLL_DEST} SDL3.dll)
endfunction(copy_yuzu_SDL_deps)

View file

@ -6,7 +6,7 @@ set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX})
set(SDL2_PATH ${MINGW_PREFIX})
set(SDL3_PATH ${MINGW_PREFIX})
set(MINGW_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-)
# Specify the cross compiler

View file

@ -9,7 +9,7 @@ set(CMAKE_HOST_WIN32 TRUE)
set(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX})
set(SDL2_PATH ${MINGW_PREFIX})
set(SDL3_PATH ${MINGW_PREFIX})
set(MINGW_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-)
# Specify the cross compiler

View file

@ -157,30 +157,30 @@
"hash": "99779ca9b6e040d36558cadf484f9ffdab5b47bcc8fc72e4d33639d1d60c0ceb4410d335ba445d72a4324e455167fd6769d99b459943aa135bec085dff2d4b7c",
"find_args": "MODULE"
},
"sdl2_generic": {
"package": "SDL2",
"sdl3_generic": {
"package": "SDL3",
"repo": "libsdl-org/SDL",
"sha": "54772f345a",
"hash": "2a68a0e01c390043aa9d9df63d8a20a52076c88bb460ac4e0f33194ca7d9bc8fadbbcc04e7506872ac4b6354a73fbc267c036f82200da59465789b87c7d9e3a4",
"sha": "a96677bdf6",
"hash": "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e",
"key": "generic",
"bundled": true
},
"sdl2_steamdeck": {
"package": "SDL2",
"sdl3_steamdeck": {
"package": "SDL3",
"repo": "libsdl-org/SDL",
"sha": "cc016b0046",
"hash": "34d5ef58da6a4f9efa6689c82f67badcbd741f5a4f562a9c2c30828fa839830fb07681c5dc6a7851520e261c8405a416ac0a2c2513b51984fb3b4fa4dcb3e20b",
"key": "steamdeck",
"bundled": true
},
"sdl2": {
"sdl3": {
"ci": true,
"package": "SDL2",
"name": "SDL2",
"repo": "crueter-ci/SDL2",
"version": "2.32.8",
"min_version": "2.26.4",
"cmake_filename": "sdl2"
"package": "SDL3",
"name": "SDL3",
"repo": "libsdl-org/SDL3",
"version": "3.2.22",
"min_version": "3.2.0",
"cmake_filename": "sdl3"
},
"llvm-mingw": {
"repo": "misc/llvm-mingw",

View file

@ -40,12 +40,12 @@ Notes:
* Unavailable on OpenBSD
The following options are desktop only:
- `ENABLE_SDL2` (ON) Enable the SDL2 desktop, audio, and input frontend (HIGHLY RECOMMENDED!)
- `ENABLE_SDL3` (ON) Enable the SDL2 desktop, audio, and input frontend (HIGHLY RECOMMENDED!)
* Unavailable on Android
- `YUZU_USE_EXTERNAL_SDL2` (ON for non-UNIX) Compiles SDL2 from source
- `YUZU_USE_BUNDLED_SDL2` (ON for MSVC) Download a prebuilt SDL2
* Unavailable on OpenBSD
* Only enabled if YUZU_USE_CPM and ENABLE_SDL2 are both ON
* Only enabled if YUZU_USE_CPM and ENABLE_SDL3 are both ON
- `ENABLE_LIBUSB` (ON) Enable the use of the libusb input frontend (HIGHLY RECOMMENDED)
- `ENABLE_OPENGL` (ON) Enable the OpenGL graphics frontend
* Unavailable on Windows/ARM64 and Android

View file

@ -223,7 +223,7 @@ if (YUZU_TESTS)
add_subdirectory(tests)
endif()
if (ENABLE_SDL2 AND YUZU_CMD)
if (ENABLE_SDL3 AND YUZU_CMD)
add_subdirectory(yuzu_cmd)
set_target_properties(yuzu-cmd PROPERTIES OUTPUT_NAME "eden-cli")
endif()

View file

@ -168,7 +168,7 @@ android {
cmake {
arguments(
"-DENABLE_QT=0", // Don't use QT
"-DENABLE_SDL2=0", // Don't use SDL
"-DENABLE_SDL3=0", // Don't use SDL
"-DENABLE_WEB_SERVICE=1", // Enable web service
"-DENABLE_OPENSSL=ON",
"-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work

View file

@ -247,14 +247,14 @@ if (ENABLE_CUBEB)
target_compile_definitions(audio_core PRIVATE HAVE_CUBEB=1)
endif()
if (ENABLE_SDL2)
if (ENABLE_SDL3)
target_sources(audio_core PRIVATE
sink/sdl2_sink.cpp
sink/sdl2_sink.h
)
target_link_libraries(audio_core PRIVATE SDL2::SDL2)
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
target_link_libraries(audio_core PRIVATE SDL3::SDL3)
target_compile_definitions(audio_core PRIVATE HAVE_SDL3)
endif()
if(ANDROID)

View file

@ -7,7 +7,7 @@
#include <span>
#include <vector>
#include <SDL.h>
#include <SDL3/SDL.h>
#include "audio_core/common/common.h"
#include "audio_core/sink/sdl2_sink.h"

View file

@ -47,7 +47,7 @@ else()
)
endif()
if (ENABLE_SDL2)
if (ENABLE_SDL3)
target_sources(input_common PRIVATE
drivers/joycon.cpp
drivers/joycon.h
@ -73,8 +73,8 @@ if (ENABLE_SDL2)
helpers/joycon_protocol/rumble.cpp
helpers/joycon_protocol/rumble.h
)
target_link_libraries(input_common PRIVATE SDL2::SDL2)
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
target_link_libraries(input_common PRIVATE SDL3::SDL3)
target_compile_definitions(input_common PRIVATE HAVE_SDL3)
endif()
if (ENABLE_LIBUSB)

View file

@ -8,7 +8,7 @@
#include <thread>
#include <unordered_map>
#include <SDL.h>
#include <SDL3/SDL.h>
#include "common/common_types.h"
#include "common/threadsafe_queue.h"

View file

@ -468,9 +468,9 @@ if (YUZU_USE_BUNDLED_QT)
copy_yuzu_Qt6_deps(yuzu)
endif()
if (ENABLE_SDL2)
target_link_libraries(yuzu PRIVATE SDL2::SDL2)
target_compile_definitions(yuzu PRIVATE HAVE_SDL2)
if (ENABLE_SDL3)
target_link_libraries(yuzu PRIVATE SDL3::SDL3)
target_compile_definitions(yuzu PRIVATE HAVE_SDL3)
endif()
if (MSVC)

View file

@ -98,7 +98,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#ifdef HAVE_SDL2
#include <QCheckBox>
#include <QStringLiteral>
#include <SDL.h> // For SDL ScreenSaver functions
#include <SDL3/SDL.h> // For SDL ScreenSaver functions
#endif
#include <fmt/ranges.h>

View file

@ -41,7 +41,7 @@ target_link_libraries(yuzu-cmd PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
create_resource("../../dist/yuzu.bmp" "yuzu_cmd/yuzu_icon.h" "yuzu_icon")
target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
target_link_libraries(yuzu-cmd PRIVATE SDL2::SDL2)
target_link_libraries(yuzu-cmd PRIVATE SDL3::SDL3)
if(UNIX AND NOT APPLE)
install(TARGETS yuzu-cmd)

View file

@ -3,7 +3,7 @@
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <SDL.h>
#include <SDL3/SDL.h>
#include "common/logging/log.h"
#include "common/scm_rev.h"

View file

@ -9,7 +9,7 @@
#include <string>
#define SDL_MAIN_HANDLED
#include <SDL.h>
#include <SDL3/SDL.h>
#include <fmt/ranges.h>
#include <glad/glad.h>

View file

@ -18,7 +18,7 @@
#include <SDL_config.h>
#endif
#include <SDL.h>
#include <SDL3/SDL.h>
EmuWindow_SDL2_Null::EmuWindow_SDL2_Null(InputCommon::InputSubsystem* input_subsystem_,
Core::System& system_, bool fullscreen)

View file

@ -12,7 +12,7 @@
#include "video_core/renderer_vulkan/renderer_vulkan.h"
#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h"
#include <SDL.h>
#include <SDL3/SDL.h>
#include <SDL_syswm.h>
EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem_,

View file

@ -3,7 +3,7 @@
// SDL will break our main function in yuzu-cmd if we don't define this before adding SDL.h
#define SDL_MAIN_HANDLED
#include <SDL.h>
#include <SDL3/SDL.h>
#include "common/logging/log.h"
#include "input_common/main.h"