CMake: Remove unconditional Qt linkage from WebContent and WebWorker
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

WebContent only needs it when using QtMultimedia for audio playback, and
WebWorker never needs it.
This commit is contained in:
Andrew Kaster 2025-07-06 10:55:16 -06:00 committed by Andrew Kaster
commit 62c5f4b822
Notes: github-actions[bot] 2025-07-07 21:54:10 +00:00
6 changed files with 33 additions and 58 deletions

View file

@ -36,20 +36,6 @@ if (APPLE)
list(APPEND SOURCES MachPortServer.cpp)
endif()
if (ENABLE_QT)
list(APPEND SOURCES
EventLoop/EventLoopImplementationQt.cpp
EventLoop/EventLoopImplementationQtEventTarget.cpp
)
set(CMAKE_AUTOMOC ON)
find_package(Qt6 REQUIRED COMPONENTS Core)
elseif (APPLE)
list(APPEND SOURCES
EventLoop/EventLoopImplementationMacOS.mm
)
endif()
set(GENERATED_SOURCES ${CURRENT_LIB_GENERATED})
embed_as_string(
@ -93,16 +79,29 @@ endif()
find_package(SQLite3 REQUIRED)
target_link_libraries(LibWebView PRIVATE SQLite::SQLite3)
if (ENABLE_QT)
target_link_libraries(LibWebView PRIVATE Qt::Core)
elseif (APPLE)
target_link_libraries(LibWebView PRIVATE "-framework Cocoa")
endif()
if (HAS_FONTCONFIG)
target_link_libraries(LibWebView PRIVATE Fontconfig::Fontconfig)
endif()
add_library(LibWebViewPlatform INTERFACE)
if (ENABLE_QT)
add_library(LibWebViewQt STATIC
EventLoop/EventLoopImplementationQt.cpp
EventLoop/EventLoopImplementationQtEventTarget.cpp
)
set_target_properties(LibWebViewQt PROPERTIES AUTOMOC ON AUTORCC OFF AUTOUIC OFF)
find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(LibWebViewQt PUBLIC Qt::Core)
target_link_libraries(LibWebViewPlatform INTERFACE LibWebViewQt)
elseif (APPLE)
add_library(LibWebViewCocoa STATIC
EventLoop/EventLoopImplementationMacOS.mm
)
target_link_libraries(LibWebViewCocoa PUBLIC "-framework Cocoa")
target_link_libraries(LibWebViewPlatform INTERFACE LibWebViewCocoa)
endif()
if (ENABLE_INSTALL_HEADERS)
foreach(header ${GENERATED_SOURCES})
get_filename_component(extension ${header} EXT)

View file

@ -32,22 +32,19 @@ 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)
if (ENABLE_QT)
if (ENABLE_QT AND NOT DEFINED LADYBIRD_AUDIO_BACKEND)
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
qt_add_executable(WebContent main.cpp)
target_link_libraries(WebContent PRIVATE Qt::Core)
target_compile_definitions(WebContent PRIVATE HAVE_QT=1)
if (NOT DEFINED LADYBIRD_AUDIO_BACKEND)
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_sources(WebContent PRIVATE
${LADYBIRD_SOURCE_DIR}/UI/Qt/AudioCodecPluginQt.cpp
${LADYBIRD_SOURCE_DIR}/UI/Qt/AudioThread.cpp
)
target_link_libraries(WebContent PRIVATE Qt::Multimedia)
target_compile_definitions(WebContent PRIVATE HAVE_QT_MULTIMEDIA=1)
endif()
target_sources(WebContent PRIVATE
${LADYBIRD_SOURCE_DIR}/UI/Qt/AudioCodecPluginQt.cpp
${LADYBIRD_SOURCE_DIR}/UI/Qt/AudioThread.cpp
)
target_link_libraries(WebContent PRIVATE LibWebViewPlatform Qt::Multimedia)
target_compile_definitions(WebContent PRIVATE HAVE_QT_MULTIMEDIA=1)
else()
add_executable(WebContent main.cpp)
endif()

View file

@ -36,13 +36,10 @@
#include <WebContent/PageClient.h>
#include <WebContent/WebDriverConnection.h>
#if defined(HAVE_QT)
#if defined(HAVE_QT_MULTIMEDIA)
# include <LibWebView/EventLoop/EventLoopImplementationQt.h>
# include <QCoreApplication>
# if defined(HAVE_QT_MULTIMEDIA)
# include <UI/Qt/AudioCodecPluginQt.h>
# endif
# include <UI/Qt/AudioCodecPluginQt.h>
#endif
#if defined(AK_OS_MACOS)
@ -76,7 +73,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
{
AK::set_rich_debug_enabled(true);
#if defined(HAVE_QT)
#if defined(HAVE_QT_MULTIMEDIA)
QCoreApplication app(arguments.argc, arguments.argv);
Core::EventLoopManager::install(*new WebView::EventLoopManagerQt);

View file

@ -16,13 +16,7 @@ target_include_directories(webworkerservice PRIVATE ${LADYBIRD_SOURCE_DIR}/Servi
target_link_libraries(webworkerservice PUBLIC LibCore LibFileSystem LibGfx LibIPC LibJS LibRequests LibWeb LibWebView LibUnicode LibImageDecoderClient LibMain LibURL LibGC)
target_link_libraries(webworkerservice PRIVATE OpenSSL::Crypto OpenSSL::SSL)
if (ENABLE_QT)
qt_add_executable(WebWorker main.cpp)
target_link_libraries(WebWorker PRIVATE webworkerservice LibWebSocket)
target_compile_definitions(WebWorker PRIVATE HAVE_QT=1)
else()
add_executable(WebWorker main.cpp)
endif()
add_executable(WebWorker main.cpp)
target_include_directories(WebWorker PRIVATE ${LADYBIRD_SOURCE_DIR})
target_link_libraries(WebWorker PRIVATE webworkerservice)

View file

@ -6,9 +6,7 @@
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
#include <LibCore/LocalServer.h>
#include <LibCore/Process.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
#include <LibIPC/SingleServer.h>
@ -18,18 +16,12 @@
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Platform/EventLoopPlugin.h>
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
#include <LibWeb/WebSockets/WebSocket.h>
#include <LibWebView/HelperProcess.h>
#include <LibWebView/Plugins/FontPlugin.h>
#include <LibWebView/Plugins/ImageCodecPlugin.h>
#include <LibWebView/Utilities.h>
#include <WebWorker/ConnectionFromClient.h>
#if defined(HAVE_QT)
# include <LibWebView/EventLoop/EventLoopImplementationQt.h>
# include <QCoreApplication>
#endif
static ErrorOr<void> initialize_image_decoder(int image_decoder_socket);
static ErrorOr<void> initialize_resource_loader(GC::Heap&, int request_server_socket);
@ -71,10 +63,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto worker_type = TRY(agent_type_from_string(worker_type_string));
#if defined(HAVE_QT)
QCoreApplication app(arguments.argc, arguments.argv);
Core::EventLoopManager::install(*new WebView::EventLoopManagerQt);
#endif
Core::EventLoop event_loop;
WebView::platform_init();

View file

@ -68,7 +68,7 @@ else()
set(LADYBIRD_TARGET ladybird PRIVATE)
endif()
set(LADYBIRD_LIBS AK LibCore LibFileSystem LibGfx LibImageDecoderClient LibIPC LibJS LibMain LibWeb LibWebView LibRequests LibURL)
set(LADYBIRD_LIBS AK LibCore LibFileSystem LibGfx LibImageDecoderClient LibIPC LibJS LibMain LibWeb LibWebView LibWebViewPlatform LibRequests LibURL)
target_link_libraries(${LADYBIRD_TARGET} PRIVATE ${LADYBIRD_LIBS})
target_link_libraries(${LADYBIRD_TARGET} PRIVATE OpenSSL::Crypto OpenSSL::SSL)