[libarchive] expose zstd as a build feature (#11044)

* [libarchive] add zlib and zstd to wrapper and expose zstd as a build feature.

* bump control
This commit is contained in:
Alexander Neumann 2020-04-27 15:56:50 +02:00 committed by GitHub
parent 657becf609
commit f05560d812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 8 deletions

View File

@ -1,15 +1,19 @@
Source: libarchive Source: libarchive
Version: 3.4.1-1 Version: 3.4.1-2
Homepage: https://github.com/libarchive/libarchive Homepage: https://github.com/libarchive/libarchive
Description: Library for reading and writing streaming archives Description: Library for reading and writing streaming archives
Build-Depends: zlib Build-Depends: zlib
Default-Features: bzip2, libxml2, lz4, lzma, lzo, openssl Default-Features: bzip2, libxml2, lz4, lzma, lzo, openssl, zstd
Supports: !uwp Supports: !uwp
Feature: bzip2 Feature: bzip2
Build-Depends: bzip2 Build-Depends: bzip2
Description: BZip2 support Description: BZip2 support
Feature: zstd
Build-Depends: zstd
Description: zstd support
Feature: libxml2 Feature: libxml2
Build-Depends: libxml2 Build-Depends: libxml2
Description: Libxml2 support Description: Libxml2 support

View File

@ -21,18 +21,20 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
lzma ENABLE_LZMA lzma ENABLE_LZMA
lzo ENABLE_LZO lzo ENABLE_LZO
openssl ENABLE_OPENSSL openssl ENABLE_OPENSSL
zstd ENABLE_ZSTD
# The below features should be added to CONTROL # The below features should be added to CONTROL
#pcre ENABLE_PCREPOSIX #pcre ENABLE_PCREPOSIX
#nettle ENABLE_NETTLE #nettle ENABLE_NETTLE
#expat ENABLE_EXPAT #expat ENABLE_EXPAT
#libgcc ENABLE_LibGCC #libgcc ENABLE_LibGCC
#cng ENABLE_CNG #cng ENABLE_CNG
#tar ENABLE_TAR #tar ENABLE_TAR # Tool build option?
#cpio ENABLE_CPIO #cpio ENABLE_CPIO # Tool build option?
#cat ENABLE_CAT #cat ENABLE_CAT # Tool build option?
#xattr ENABLE_XATTR #xattr ENABLE_XATTR # Tool support option?
#acl ENABLE_ACL #acl ENABLE_ACL # Tool support option?
#iconv ENABLE_ICONV #iconv ENABLE_ICONV # iconv support option?
#libb2 ENABLE_LIBB2
) )
if(FEATURES MATCHES "pcre") if(FEATURES MATCHES "pcre")
@ -40,6 +42,8 @@ else()
list(APPEND FEATURE_OPTIONS -DPOSIX_REGEX_LIB=NONE) list(APPEND FEATURE_OPTIONS -DPOSIX_REGEX_LIB=NONE)
endif() endif()
list(APPEND FEATURE_OPTIONS -DENABLE_ZLIB=ON)
vcpkg_configure_cmake( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA PREFER_NINJA

View File

@ -1,6 +1,10 @@
_find_package(${ARGS}) _find_package(${ARGS})
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
if(@ENABLE_ZLIB@)
find_package(ZLIB REQUIRED)
list(APPEND LibArchive_LIBRARIES ZLIB::ZLIB)
endif()
if(@ENABLE_BZip2@) if(@ENABLE_BZip2@)
find_package(BZip2 REQUIRED) find_package(BZip2 REQUIRED)
list(APPEND LibArchive_LIBRARIES BZip2::BZip2) list(APPEND LibArchive_LIBRARIES BZip2::BZip2)
@ -27,6 +31,16 @@ if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
list(APPEND LibArchive_LIBRARIES debug ${LZO_LIBRARY_DEBUG}) list(APPEND LibArchive_LIBRARIES debug ${LZO_LIBRARY_DEBUG})
endif() endif()
endif() endif()
if(@ENABLE_ZSTD@)
find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd zstd NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH)
find_library(ZSTD_LIBRARY_RELEASE NAMES zstd NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
if(ZSTD_LIBRARY_RELEASE)
list(APPEND LibArchive_LIBRARIES optimized ${ZSTD_LIBRARY_RELEASE})
endif()
if(ZSTD_LIBRARY_DEBUG)
list(APPEND LibArchive_LIBRARIES debug ${ZSTD_LIBRARY_DEBUG})
endif()
endif()
if(@ENABLE_OPENSSL@) if(@ENABLE_OPENSSL@)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
list(APPEND LibArchive_LIBRARIES OpenSSL::Crypto) list(APPEND LibArchive_LIBRARIES OpenSSL::Crypto)
@ -36,6 +50,9 @@ if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
if(@ENABLE_BZip2@) if(@ENABLE_BZip2@)
target_link_libraries(LibArchive::LibArchive INTERFACE BZip2::BZip2) target_link_libraries(LibArchive::LibArchive INTERFACE BZip2::BZip2)
endif() endif()
if(@ENABLE_ZLIB@)
target_link_libraries(LibArchive::LibArchive INTERFACE ZLIB::ZLIB)
endif()
if(@ENABLE_LIBXML2@) if(@ENABLE_LIBXML2@)
target_link_libraries(LibArchive::LibArchive INTERFACE LibXml2::LibXml2) target_link_libraries(LibArchive::LibArchive INTERFACE LibXml2::LibXml2)
endif() endif()
@ -54,6 +71,15 @@ if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
endif() endif()
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${interface_lib}) set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${interface_lib})
endif() endif()
if(@ENABLE_ZSTD@)
if(ZSTD_LIBRARY_RELEASE)
list(APPEND interface_lib \$<\$<NOT:\$<CONFIG:DEBUG>>:${ZSTD_LIBRARY_RELEASE}>)
endif()
if(ZSTD_LIBRARY_DEBUG)
list(APPEND interface_lib \$<\$<CONFIG:DEBUG>:${ZSTD_LIBRARY_DEBUG}>)
endif()
set_property(TARGET LibArchive::LibArchive APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${interface_lib})
endif()
if(@ENABLE_OPENSSL@) if(@ENABLE_OPENSSL@)
target_link_libraries(LibArchive::LibArchive INTERFACE OpenSSL::Crypto) target_link_libraries(LibArchive::LibArchive INTERFACE OpenSSL::Crypto)
endif() endif()