2022-12-05 21:19:33 +01:00
|
|
|
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
|
2017-05-05 12:10:49 +02:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO facebook/zstd
|
2022-12-05 21:19:33 +01:00
|
|
|
REF "v${VERSION}"
|
|
|
|
SHA512 e107508a41fca50845cc2494e64adaba93efb95a2fa486fc962510a8ba4b2180d93067cae9870f119e88e5e8b28a046bc2240b0b23cdd8933d1fb1a6a9668c1e
|
2018-11-27 00:41:37 +01:00
|
|
|
HEAD_REF dev
|
2020-04-13 21:39:29 +02:00
|
|
|
PATCHES
|
2021-10-27 07:58:36 +02:00
|
|
|
install_pkgpc.patch
|
2022-02-16 02:20:21 +01:00
|
|
|
no-static-suffix.patch
|
2018-11-27 00:41:37 +01:00
|
|
|
)
|
2017-05-05 12:10:49 +02: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 11:00:31 +11:00
|
|
|
|
2021-08-26 12:08:51 +08:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}/build/cmake"
|
2017-05-05 12:10:49 +02: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 12:10:49 +02:00
|
|
|
-DZSTD_LEGACY_SUPPORT=1
|
|
|
|
-DZSTD_BUILD_PROGRAMS=0
|
|
|
|
-DZSTD_BUILD_TESTS=0
|
2018-05-11 13:31:12 +03:00
|
|
|
-DZSTD_BUILD_CONTRIB=0
|
2022-02-16 02:20:21 +01:00
|
|
|
-DZSTD_MULTITHREAD_SUPPORT=1
|
|
|
|
)
|
2017-05-05 12:10:49 +02:00
|
|
|
|
2021-08-26 12:08:51 +08:00
|
|
|
vcpkg_cmake_install()
|
2017-05-05 12:10:49 +02:00
|
|
|
vcpkg_copy_pdbs()
|
2021-08-26 12:08:51 +08:00
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/zstd)
|
2022-02-16 02:20:21 +01:00
|
|
|
vcpkg_fixup_pkgconfig()
|
2020-11-12 23:28:59 +01:00
|
|
|
|
2022-02-16 02:20:21 +01:00
|
|
|
file(READ "${CURRENT_PACKAGES_DIR}/share/zstd/zstdTargets.cmake" targets)
|
|
|
|
if(targets MATCHES "-pthread")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libzstd.pc" " -lzstd" " -lzstd -pthread")
|
|
|
|
if(NOT VCPKG_BUILD_TYPE)
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libzstd.pc" " -lzstd" " -lzstd -pthread")
|
|
|
|
endif()
|
2020-11-12 23:28:59 +01:00
|
|
|
endif()
|
2020-04-13 21:39:29 +02: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 12:10:49 +02:00
|
|
|
|
2020-04-14 08:54:22 +02:00
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
2022-02-16 02:20:21 +01:00
|
|
|
foreach(HEADER IN ITEMS 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 12:10:49 +02:00
|
|
|
endforeach()
|
2016-11-23 11:00:31 +11:00
|
|
|
endif()
|
|
|
|
|
2022-02-16 02:20:21 +01:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
set(missing_target zstd::libzstd_static)
|
|
|
|
set(existing_target zstd::libzstd_shared)
|
|
|
|
else()
|
|
|
|
set(existing_target zstd::libzstd_static)
|
|
|
|
set(missing_target zstd::libzstd_shared)
|
|
|
|
endif()
|
|
|
|
file(WRITE "${CURRENT_PACKAGES_DIR}/share/zstd/zstdTargets-interface.cmake" "
|
|
|
|
add_library(${missing_target} IMPORTED INTERFACE)
|
|
|
|
set_target_properties(${missing_target} PROPERTIES INTERFACE_LINK_LIBRARIES ${existing_target})
|
|
|
|
")
|
|
|
|
|
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
2022-12-05 21:19:33 +01:00
|
|
|
vcpkg_install_copyright(
|
|
|
|
COMMENT "ZSTD is dual licensed under BSD and GPLv2."
|
|
|
|
FILE_LIST
|
|
|
|
"${SOURCE_PATH}/LICENSE"
|
|
|
|
"${SOURCE_PATH}/COPYING"
|
|
|
|
)
|