From b7f7f58e5fad9e345628da8beb84d187a211cbc0 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Mon, 17 Feb 2025 13:15:46 -0700 Subject: [PATCH] LibMedia: Don't link null PlaybackStream::create eagerly This avoids static builds putting the "no-op" implementation of PlaybackStream::create() in the static archive before the strong implementation later. On ELF (and probably PE/COFF too), a weak definition in a static archive is chosen and locked-in as the definition before a strong definition later in the archive. Before this change, static builds would have no audio support at all. --- Libraries/LibMedia/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libraries/LibMedia/CMakeLists.txt b/Libraries/LibMedia/CMakeLists.txt index 77d4569cb75..a2a667b8827 100644 --- a/Libraries/LibMedia/CMakeLists.txt +++ b/Libraries/LibMedia/CMakeLists.txt @@ -6,7 +6,6 @@ endif() set(SOURCES Audio/Loader.cpp - Audio/PlaybackStream.cpp Audio/SampleFormats.cpp Color/ColorConverter.cpp Color/ColorPrimaries.cpp @@ -47,4 +46,6 @@ elseif (LADYBIRD_AUDIO_BACKEND STREQUAL "OBOE") target_link_libraries(LibMedia PRIVATE log oboe::oboe) elseif (DEFINED LADYBIRD_AUDIO_BACKEND) message(FATAL_ERROR "Please update ${CMAKE_CURRENT_LIST_FILE} for audio backend ${LADYBIRD_AUDIO_BACKEND}") +else () + target_sources(LibMedia PRIVATE Audio/PlaybackStream.cpp) endif()