mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-01 11:19:04 +08:00
2f3fccd1e7
- [X] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [X] SHA512s are updated for each updated download. - [ ] The "supports" clause reflects platforms that may be fixed by this new version. - [ ] Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file. - [ ] Any patches that are no longer applied are deleted from the port's directory. - [X] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [X] Only one version is added to each modified port's versions file. --------- Co-authored-by: Jim wang (BEYONDSOFT CONSULTING INC) <v-wangjim@microsoft.com>
69 lines
2.3 KiB
CMake
69 lines
2.3 KiB
CMake
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO facebook/zstd
|
|
REF "v${VERSION}"
|
|
SHA512 ca12dffd86618ca008e1ecc79056c1129cb4e61668bf13a3cd5b2fa5c93bc9c92c80f64c1870c68b9c20009d9b3a834eac70db72242d5106125a1c53cccf8de8
|
|
HEAD_REF dev
|
|
PATCHES
|
|
no-static-suffix.patch
|
|
fix-emscripten-and-clang-cl.patch
|
|
fix-windows-rc-compile.patch
|
|
)
|
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ZSTD_BUILD_STATIC)
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ZSTD_BUILD_SHARED)
|
|
|
|
if("tools" IN_LIST FEATURES)
|
|
set(ZSTD_BUILD_PROGRAMS 1)
|
|
else()
|
|
set(ZSTD_BUILD_PROGRAMS 0)
|
|
endif()
|
|
|
|
vcpkg_cmake_configure(
|
|
SOURCE_PATH "${SOURCE_PATH}/build/cmake"
|
|
OPTIONS
|
|
-DZSTD_BUILD_SHARED=${ZSTD_BUILD_SHARED}
|
|
-DZSTD_BUILD_STATIC=${ZSTD_BUILD_STATIC}
|
|
-DZSTD_LEGACY_SUPPORT=1
|
|
-DZSTD_BUILD_TESTS=0
|
|
-DZSTD_BUILD_CONTRIB=0
|
|
-DZSTD_MULTITHREAD_SUPPORT=1
|
|
OPTIONS_RELEASE
|
|
-DZSTD_BUILD_PROGRAMS=${ZSTD_BUILD_PROGRAMS}
|
|
OPTIONS_DEBUG
|
|
-DZSTD_BUILD_PROGRAMS=OFF
|
|
)
|
|
|
|
vcpkg_cmake_install()
|
|
vcpkg_copy_pdbs()
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/zstd)
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
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()
|
|
endif()
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
foreach(HEADER IN ITEMS zdict.h zstd.h zstd_errors.h)
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/${HEADER}" "defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)" "1" )
|
|
endforeach()
|
|
endif()
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND ZSTD_BUILD_PROGRAMS)
|
|
vcpkg_copy_tools(TOOL_NAMES zstd AUTO_CLEAN)
|
|
endif()
|
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
vcpkg_install_copyright(
|
|
COMMENT "ZSTD is dual licensed under BSD and GPLv2."
|
|
FILE_LIST
|
|
"${SOURCE_PATH}/LICENSE"
|
|
"${SOURCE_PATH}/COPYING"
|
|
)
|