2016-11-23 08:00:31 +08:00
|
|
|
include(vcpkg_common_functions)
|
2017-05-05 18:10:49 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO facebook/zstd
|
2019-05-22 12:00:24 +08:00
|
|
|
REF v1.4.0
|
|
|
|
SHA512 8614934e25eb1e82b554c483bc9d2d055f51344697295e83b22a8d726321b12068cfa7f7d2a9fe28a2de7c9edda59733826277efc7046e13674d6f7f02af5671
|
2018-11-27 07:41:37 +08:00
|
|
|
HEAD_REF dev
|
|
|
|
PATCHES enable-debug-mode.patch
|
|
|
|
)
|
2017-05-05 18:10:49 +08:00
|
|
|
|
2018-06-13 11:15:27 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
2017-05-05 18:10:49 +08:00
|
|
|
set(ZSTD_STATIC 1)
|
|
|
|
set(ZSTD_SHARED 0)
|
|
|
|
else()
|
|
|
|
set(ZSTD_STATIC 0)
|
|
|
|
set(ZSTD_SHARED 1)
|
|
|
|
endif()
|
2016-11-23 08:00:31 +08:00
|
|
|
|
2018-06-13 11:15:27 +08:00
|
|
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME)
|
|
|
|
# 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
|
|
|
|
2016-11-23 08:00:31 +08:00
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}/build/cmake
|
2017-05-05 18:10:49 +08:00
|
|
|
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
|
2018-05-11 18:31:12 +08:00
|
|
|
-DZSTD_BUILD_CONTRIB=0
|
|
|
|
OPTIONS_DEBUG
|
|
|
|
-DCMAKE_DEBUG_POSTFIX=d)
|
2017-05-05 18:10:49 +08:00
|
|
|
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
vcpkg_copy_pdbs()
|
2018-03-22 03:27:29 +08:00
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
|
2017-05-05 18:10:49 +08:00
|
|
|
|
2019-05-21 01:24:51 +08:00
|
|
|
if((VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME) AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
2017-07-12 22:46:57 +08:00
|
|
|
foreach(HEADER zdict.h zstd.h zstd_errors.h)
|
2017-05-05 18:10:49 +08:00
|
|
|
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()
|
2016-11-23 08:00:31 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zstd)
|
2017-08-21 04:06:20 +08:00
|
|
|
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/zstd)
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/zstd/copyright "ZSTD is dual licensed - see LICENSE and COPYING files\n")
|