2017-05-05 18:10:49 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO facebook/zstd
|
2022-01-19 04:28:16 +08:00
|
|
|
REF f4a552a3fa24d9078f84157bd40e4f1bad49c488 #v1.5.2
|
|
|
|
SHA512 5e0343cfc06d756c3f09647df39f1c15b39707c0b9b6d343b1be8f1e99d567b52f5b9228925c2190d1600a5b54822c2a4546b2443b13f43eb9a75f97e7fa41f5
|
2018-11-27 07:41:37 +08:00
|
|
|
HEAD_REF dev
|
2020-04-14 03:39:29 +08:00
|
|
|
PATCHES
|
2021-10-27 13:58:36 +08:00
|
|
|
install_pkgpc.patch
|
2018-11-27 07:41:37 +08:00
|
|
|
)
|
2017-05-05 18:10:49 +08:00
|
|
|
|
2021-08-26 12:08:51 +08:00
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ZSTD_BUILD_STATIC)
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ZSTD_BUILD_SHARED)
|
2016-11-23 08:00:31 +08:00
|
|
|
|
2020-04-14 14:54:22 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
2018-06-13 11:15:27 +08:00
|
|
|
# Enable multithreaded mode. CMake build doesn't provide a multithreaded
|
|
|
|
# library target, but it is the default in Makefile and VS projects.
|
|
|
|
set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -DZSTD_MULTITHREAD")
|
|
|
|
set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS}")
|
|
|
|
endif()
|
2017-08-21 04:06:20 +08:00
|
|
|
|
2021-08-26 12:08:51 +08:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}/build/cmake"
|
2017-05-05 18:10:49 +08:00
|
|
|
OPTIONS
|
2021-08-26 12:08:51 +08:00
|
|
|
-DZSTD_BUILD_SHARED=${ZSTD_BUILD_SHARED}
|
|
|
|
-DZSTD_BUILD_STATIC=${ZSTD_BUILD_STATIC}
|
2017-05-05 18:10:49 +08:00
|
|
|
-DZSTD_LEGACY_SUPPORT=1
|
|
|
|
-DZSTD_BUILD_PROGRAMS=0
|
|
|
|
-DZSTD_BUILD_TESTS=0
|
2018-05-11 18:31:12 +08:00
|
|
|
-DZSTD_BUILD_CONTRIB=0
|
|
|
|
OPTIONS_DEBUG
|
2020-11-13 06:28:59 +08:00
|
|
|
-DCMAKE_DEBUG_POSTFIX=d) # this is against the maintainer guidelines.
|
|
|
|
# Removing it probably requires a vcpkg-cmake-wrapper.cmake to correct downstreams FindZSTD.cmake
|
2017-05-05 18:10:49 +08:00
|
|
|
|
2021-08-26 12:08:51 +08:00
|
|
|
vcpkg_cmake_install()
|
2017-05-05 18:10:49 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2021-08-26 12:08:51 +08:00
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/zstd)
|
2020-11-13 06:28:59 +08:00
|
|
|
|
|
|
|
# This enables find_package(ZSTD) and find_package(zstd) to find zstd on Linux(case sensitive filesystems)
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/share/${PORT}/zstdConfig.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/zstd-config.cmake")
|
2021-10-27 13:58:36 +08:00
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/share/${PORT}/zstdConfigVersion.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/zstd-config-version.cmake")
|
2020-11-13 06:28:59 +08:00
|
|
|
|
2021-10-27 13:58:36 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
2020-11-13 06:28:59 +08:00
|
|
|
set(static_suffix "_static")
|
|
|
|
else()
|
2021-10-27 13:58:36 +08:00
|
|
|
set(static_suffix "")
|
2020-11-13 06:28:59 +08:00
|
|
|
endif()
|
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libzstd.pc")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libzstd.pc" "-lzstd" "-lzstd${static_suffix}")
|
|
|
|
endif()
|
2020-07-15 05:40:43 +08:00
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libzstd.pc")
|
2020-11-13 06:28:59 +08:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libzstd.pc" "-lzstd" "-lzstd${static_suffix}d")
|
2020-07-15 05:40:43 +08:00
|
|
|
endif()
|
2020-11-13 06:28:59 +08:00
|
|
|
|
2020-07-15 05:40:43 +08:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2020-04-14 03:39:29 +08:00
|
|
|
|
2021-08-26 12:08:51 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
|
2017-05-05 18:10:49 +08:00
|
|
|
|
2020-04-14 14:54:22 +08:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
2017-07-12 22:46:57 +08:00
|
|
|
foreach(HEADER zdict.h zstd.h zstd_errors.h)
|
2021-08-26 12:08:51 +08:00
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/${HEADER}" "defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)" "1" )
|
2017-05-05 18:10:49 +08:00
|
|
|
endforeach()
|
2016-11-23 08:00:31 +08:00
|
|
|
endif()
|
|
|
|
|
2021-08-26 12:08:51 +08:00
|
|
|
file(COPY "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
|
|
file(COPY "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
|
|
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "ZSTD is dual licensed - see LICENSE and COPYING files\n")
|