# SPDX-License-Identifier: GPL-2.0-or-later
# SPDX-FileCopyrightText: Copyright (C) 2026 Max A. Vilkki a.k.a. codise
#
# hvsc: getting HVSC onto the disk (DESIGN §8.1). `download` fetches a release over plain
# HTTP with ultimate's client (resumable), `unpack` turns its 7z archive into a folder
# through libarchive's 7z reader, `install` puts that folder in place of the collection
# and keeps the user's own folders, and `update` is the three in a row. `updater` is the
# worker thread an app runs them on.

add_library(flipsid_hvsc STATIC
    download.cpp
    install.cpp
    unpack.cpp
    update.cpp
    updater.cpp
)
add_library(flipsid::hvsc ALIAS flipsid_hvsc)

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

# ultimate for its HTTP client (download.h takes its CancelToken and Timeouts): the client
# lives there because the Ultimate needed it first. libarchive stays private: no libarchive
# type is in a header.
target_link_libraries(flipsid_hvsc
    PUBLIC flipsid::common flipsid::ultimate
    PRIVATE ext::archive ext::lzma
)

flipsid_configure_target(flipsid_hvsc)
