vcpkg/ports/libdeflate/portfile.cmake

49 lines
1.9 KiB
CMake
Raw Permalink Normal View History

2023-03-03 04:07:40 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ebiggers/libdeflate
REF "v${VERSION}"
2024-10-09 03:54:58 +08:00
SHA512 ca3ec7eb3e44da13164f33e56c856dbffc4ccc7b86d995afca6a23fa3f201b766d08a047871407e14a7964dd3da843be23c316e51d981cdd98f25166092de3a9
2023-03-03 04:07:40 +08:00
HEAD_REF master
PATCHES
remove_wrong_c_flags_modification.diff
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
compression LIBDEFLATE_COMPRESSION_SUPPORT
decompression LIBDEFLATE_DECOMPRESSION_SUPPORT
gzip LIBDEFLATE_GZIP_SUPPORT
zlib LIBDEFLATE_ZLIB_SUPPORT
2023-03-03 04:07:40 +08:00
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LIBDEFLATE_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LIBDEFLATE_BUILD_SHARED)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DLIBDEFLATE_BUILD_SHARED_LIB=${LIBDEFLATE_BUILD_SHARED}
-DLIBDEFLATE_BUILD_STATIC_LIB=${LIBDEFLATE_BUILD_STATIC}
-DLIBDEFLATE_BUILD_GZIP=OFF
${FEATURE_OPTIONS}
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/libdeflate")
vcpkg_fixup_pkgconfig()
2023-12-05 09:30:52 +08:00
if(VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libdeflate.h" "defined(LIBDEFLATE_DLL)" "1")
elseif(NOT VCPKG_TARGET_IS_MINGW)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libdeflate.pc" " -ldeflate" " -ldeflatestatic")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libdeflate.pc" " -ldeflate" " -ldeflatestatic")
endif()
endif()
endif()
2023-03-03 04:07:40 +08:00
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")