include(vcpkg_common_functions)

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO google/astc-codec
    REF 9757befb64db6662aad45de09ca87cd6f599ac02
    SHA512 a34fe103e3170bdef246e8f75caf412f2831a8b4cc729ba3bb2c25e9be0374f032b8de8dd2b77db60e700d5b9d3ba774d7cc9ab3a18d61780fd836192e45518b
    HEAD_REF master
    PATCHES
        0001-fix-cmake-install.patch
)

vcpkg_configure_cmake(
    SOURCE_PATH ${SOURCE_PATH}
    PREFER_NINJA
    OPTIONS
        -DOPTION_ASTC_TESTS=OFF
    OPTIONS_DEBUG
        -DSKIP_INSTALL_HEADERS=ON
)

vcpkg_install_cmake()

vcpkg_fixup_cmake_targets()

vcpkg_copy_pdbs()

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

