Meta+WebContent+LibWeb: Add, link and initialize SDL3

This commit is contained in:
Luke Wilde 2025-08-15 14:55:09 +01:00 committed by Andreas Kling
parent 36d5e814ef
commit 50dcd8fc85
6 changed files with 49 additions and 1 deletions

View File

@ -1,6 +1,7 @@
include(libweb_generators)
include(vulkan)
include(skia)
include(SDL3)
find_package(unofficial-angle CONFIG)
if(unofficial-angle_FOUND)
@ -1084,7 +1085,7 @@ set(GENERATED_SOURCES
ladybird_lib(LibWeb web EXPLICIT_SYMBOL_EXPORT)
target_link_libraries(LibWeb PRIVATE LibCore LibCompress LibCrypto LibJS LibHTTP LibGfx LibIPC LibRegex LibSyntax LibTextCodec LibUnicode LibMedia LibWasm LibXML LibIDL LibURL LibTLS LibRequests LibGC LibThreading skia ${ANGLE_TARGETS})
target_link_libraries(LibWeb PRIVATE LibCore LibCompress LibCrypto LibJS LibHTTP LibGfx LibIPC LibRegex LibSyntax LibTextCodec LibUnicode LibMedia LibWasm LibXML LibIDL LibURL LibTLS LibRequests LibGC LibThreading skia ${ANGLE_TARGETS} SDL3::SDL3)
# FIXME: https://github.com/microsoft/vcpkg/issues/42324
target_include_directories(LibWeb PRIVATE ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include)

3
Meta/CMake/SDL3.cmake Normal file
View File

@ -0,0 +1,3 @@
include_guard()
find_package(SDL3 CONFIG REQUIRED)

View File

@ -9,6 +9,7 @@
"command": "Ladybird",
"finish-args": [
"--device=dri",
"--device=input",
"--share=ipc",
"--share=network",
"--socket=wayland",
@ -506,6 +507,22 @@
"-DFASTFLOAT_INSTALL=ON"
]
},
{
"name": "sdl3",
"buildsystem": "cmake-ninja",
"sources": [
{
"type": "git",
"url": "https://github.com/libsdl-org/SDL.git",
"tag": "release-3.2.20"
}
],
"config-opts": [
"-DCMAKE_BUILD_TYPE=Release",
"-DCMAKE_PREFIX_PATH=/app",
"-DCMAKE_INSTALL_LIBDIR=lib"
]
},
{
"name": "Ladybird",
"buildsystem": "cmake-ninja",

View File

@ -1,4 +1,5 @@
include(audio)
include(SDL3)
set(SOURCES
ConnectionFromClient.cpp
@ -31,6 +32,7 @@ target_include_directories(webcontentservice PUBLIC $<BUILD_INTERFACE:${LADYBIRD
target_link_libraries(webcontentservice PUBLIC LibCore LibCrypto LibFileSystem LibGfx LibIPC LibJS LibMain LibMedia LibWeb LibWebSocket LibRequests LibWebView LibImageDecoderClient LibGC)
target_link_libraries(webcontentservice PRIVATE OpenSSL::Crypto OpenSSL::SSL)
target_link_libraries(webcontentservice PRIVATE SDL3::SDL3)
if (ENABLE_QT AND NOT DEFINED LADYBIRD_AUDIO_BACKEND)
find_package(Qt6 REQUIRED COMPONENTS Multimedia)

View File

@ -48,6 +48,8 @@
# include <LibCore/Platform/ProcessStatisticsMach.h>
#endif
#include <SDL3/SDL_init.h>
static ErrorOr<void> load_content_filters(StringView config_path);
static ErrorOr<void> initialize_resource_loader(GC::Heap&, int request_server_socket);
@ -60,6 +62,12 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
{
AK::set_rich_debug_enabled(true);
// SDL is used for the Gamepad API.
if (!SDL_Init(SDL_INIT_GAMEPAD)) {
dbgln("Failed to initialize SDL3: {}", SDL_GetError());
return -1;
}
#if defined(HAVE_QT_MULTIMEDIA)
QCoreApplication app(arguments.argc, arguments.argv);

View File

@ -25,6 +25,11 @@
"zstd"
]
},
{
"name": "dbus",
"default-features": false,
"platform": "linux"
},
{
"name": "dirent",
"platform": "windows"
@ -151,6 +156,10 @@
"name": "pthread",
"platform": "windows"
},
{
"name": "sdl3",
"default-features": false
},
"simdutf",
{
"name": "skia",
@ -201,6 +210,10 @@
"name": "curl",
"version": "8.15.0#1"
},
{
"name": "dbus",
"version": "1.16.2#1"
},
{
"name": "dirent",
"version": "1.25#0"
@ -269,6 +282,10 @@
"name": "qtmultimedia",
"version": "6.8.3#0"
},
{
"name": "sdl3",
"version": "3.2.20#0"
},
{
"name": "simdutf",
"version": "7.4.0#0"