# SPDX-License-Identifier: GPL-2.0-or-later
# SPDX-FileCopyrightText: Copyright (C) 2026 Max A. Vilkki a.k.a. codise
#
# core/library: the tune library (DESIGN §3): PSID/RSID headers and the HVSC MD5 that
# identifies tunes (§4.1), HVSC's song length database (§4.3), STIL.txt and BUGlist.txt,
# the collection's scan and its index cache, the index and its search (§5.4), and the
# service that runs them on background threads for the app. No SDL, ImGui or libsidplayfp:
# the index reads 61k headers on background threads, and the player isn't needed for that.
# Songlengths.md5, STIL.txt and BUGlist.txt each work on their own, without the rest of
# the collection (DESIGN §1 goal 6).

add_library(flipsid_library STATIC
    buglist.cpp
    catalog.cpp
    library_index.cpp
    library_service.cpp
    md5.cpp
    scanner.cpp
    search.cpp
    song_lengths.cpp
    stil.cpp
    text_fold.cpp
    tree_filter.cpp
    tune_info.cpp
    user_song_lengths.cpp
)
add_library(flipsid::library ALIAS flipsid_library)

target_include_directories(flipsid_library PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")

find_package(Threads REQUIRED)
# common for fileio (the cache's atomic writes), log for the service's report.
target_link_libraries(flipsid_library PRIVATE flipsid::common flipsid::log Threads::Threads)

flipsid_configure_target(flipsid_library)
