mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-26 07:09:06 +08:00
45 lines
1.5 KiB
CMake
45 lines
1.5 KiB
CMake
include(vcpkg_common_functions)
|
|
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO facebook/zstd
|
|
REF v1.2.0
|
|
SHA512 b21910c6bdcfad3199c07b9f70f7c049062ebd1cce9249dd33c36153e29f24dd9e796ddbc2f37846b9f508c14b0d0f67651fd8d2bdce558128f20bdfff50a7df
|
|
HEAD_REF dev)
|
|
|
|
vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH}
|
|
PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-buildsystem.diff)
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
|
set(ZSTD_STATIC 1)
|
|
set(ZSTD_SHARED 0)
|
|
else()
|
|
set(ZSTD_STATIC 0)
|
|
set(ZSTD_SHARED 1)
|
|
endif()
|
|
|
|
vcpkg_configure_cmake(
|
|
SOURCE_PATH ${SOURCE_PATH}/build/cmake
|
|
PREFER_NINJA
|
|
OPTIONS
|
|
-DZSTD_BUILD_SHARED=${ZSTD_SHARED}
|
|
-DZSTD_BUILD_STATIC=${ZSTD_STATIC}
|
|
-DZSTD_LEGACY_SUPPORT=1
|
|
-DZSTD_BUILD_PROGRAMS=0
|
|
-DZSTD_BUILD_TESTS=0
|
|
-DZSTD_BUILD_CONTRIB=0)
|
|
|
|
vcpkg_install_cmake()
|
|
vcpkg_copy_pdbs()
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
|
foreach(HEADER zdict.h zstd.h)
|
|
file(READ ${CURRENT_PACKAGES_DIR}/include/${HEADER} HEADER_CONTENTS)
|
|
string(REPLACE "defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)" "1" HEADER_CONTENTS "${HEADER_CONTENTS}")
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/include/${HEADER} "${HEADER_CONTENTS}")
|
|
endforeach()
|
|
endif()
|
|
|
|
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zstd)
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/zstd/LICENSE ${CURRENT_PACKAGES_DIR}/share/zstd/copyright)
|