# SPDX-FileCopyrightText: 2026 Jérôme SONRIER <jsid@emor3j.fr.eu.org>
# SPDX-License-Identifier: GPL-2.0-or-later

# The Qt part of the Qt/KDE front-end: the audio driver, the play list and
# the controller which runs the emulation core in a thread. It needs Qt, but
# nothing from KDE, so it can be built and tested on its own.
#
# This is an object library: the audio driver (driver_init() and friends)
# is called by the core, which does not reference it. Its objects must be
# linked into the executable itself, before the core, which a static
# library would not do reliably.

find_package(Qt6 6.4 REQUIRED COMPONENTS Core Multimedia)

add_library(taylet-qt OBJECT
  audiooutput.cpp
  audiooutput.h
  playercontroller.cpp
  playercontroller.h
  playlist.cpp
  playlist.h
  ringbuffer.cpp
  ringbuffer.h)

set_target_properties(taylet-qt PROPERTIES
  AUTOMOC ON
  CXX_STANDARD 17
  CXX_STANDARD_REQUIRED ON
  POSITION_INDEPENDENT_CODE ON)

target_include_directories(taylet-qt PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(taylet-qt PUBLIC taylet-core Qt6::Core Qt6::Multimedia)

if(TAYLET_WARNINGS AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
  target_compile_options(taylet-qt PRIVATE -Wall -Wextra)
endif()
