ladybird/Libraries/LibMedia/CMakeLists.txt
Timothy Flynn 79a2b96d1c Meta: Consolidate checking for the system audio backend
The goal here is to ensure we check for audio backends in a way that
makes sense. On macOS, let's just always use Audio Unit (and thus avoid
any checks for Pulse, to reduce needless/confusing build log noise). We
will also only use the Qt audio backend if no other backend was found,
rather than only checking for Pulse.
2024-12-25 12:00:43 +01:00

50 lines
1.7 KiB
CMake

include(audio)
if (NOT ANDROID AND NOT WIN32)
include(ffmpeg)
endif()
set(SOURCES
Audio/Loader.cpp
Audio/PlaybackStream.cpp
Audio/SampleFormats.cpp
Color/ColorConverter.cpp
Color/ColorPrimaries.cpp
Color/TransferCharacteristics.cpp
Containers/Matroska/MatroskaDemuxer.cpp
Containers/Matroska/Reader.cpp
PlaybackManager.cpp
VideoFrame.cpp
)
serenity_lib(LibMedia media)
target_link_libraries(LibMedia PRIVATE LibCore LibCrypto LibRIFF LibIPC LibGfx LibThreading LibUnicode)
if (NOT ANDROID AND NOT WIN32)
target_sources(LibMedia PRIVATE
Audio/FFmpegLoader.cpp
FFmpeg/FFmpegVideoDecoder.cpp
)
target_link_libraries(LibMedia PRIVATE PkgConfig::AVCODEC PkgConfig::AVFORMAT PkgConfig::AVUTIL)
else()
# FIXME: Need to figure out how to build or replace ffmpeg libs on Android and Windows
target_sources(LibMedia PRIVATE FFmpeg/FFmpegVideoDecoderStub.cpp)
endif()
if (LADYBIRD_AUDIO_BACKEND STREQUAL "PULSE")
target_sources(LibMedia PRIVATE
Audio/PlaybackStreamPulseAudio.cpp
Audio/PulseAudioWrappers.cpp
)
target_link_libraries(LibMedia PRIVATE PkgConfig::PULSEAUDIO)
elseif (LADYBIRD_AUDIO_BACKEND STREQUAL "AUDIO_UNIT")
target_sources(LibMedia PRIVATE Audio/PlaybackStreamAudioUnit.cpp)
find_library(AUDIO_UNIT AudioUnit REQUIRED)
target_link_libraries(LibMedia PRIVATE ${AUDIO_UNIT})
elseif (LADYBIRD_AUDIO_BACKEND STREQUAL "OBOE")
target_sources(LibMedia PRIVATE Audio/PlaybackStreamOboe.cpp)
find_package(oboe REQUIRED CONFIG)
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}")
endif()