# Copyright (c) 2026 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT

# Sources
target_sources(${DUSK_LIBRARY_TARGET_NAME}
  PUBLIC
    audiodolphin.c
    audiostreamdolphin.c
)

# No hardware MP3 decoder used on Dolphin (see audiostreammp3decoder.h's
# own comment on why libogc's MP3Player wrapper isn't a fit) - use the
# same shared minimp3-based software backend as Linux, sourced directly
# from src/dusk/audio rather than through its own unconditional
# CMakeLists.txt so platforms with a hardware decoder (PSP) never pull
# minimp3 in at all.
if(NOT minimp3_FOUND)
  find_package(minimp3 REQUIRED)
endif()
# PRIVATE to match this toolchain's own convention (see cmake/targets/
# dolphin.cmake) of avoiding PUBLIC library visibility, which has tripped
# up the PPC linker for other dependencies in the past.
target_link_libraries(${DUSK_LIBRARY_TARGET_NAME} PRIVATE minimp3)
target_sources(${DUSK_LIBRARY_TARGET_NAME}
  PUBLIC
    "${DUSK_SOURCES_DIR}/dusk/audio/audiostreammp3decodersw.c"
)
