mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 03:09:00 +08:00
[lz4] Update to 1.10.0, use official CMake build system (#40052)
Co-authored-by: Theodore Tsirpanis <theodore.tsirpanis@tiledb.com>
This commit is contained in:
parent
6474628c4e
commit
853e515b2b
@ -1,28 +1,27 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -152,7 +152,7 @@ # LZ4 {
|
||||
option(ENABLE_LZ4_EXT "Enable external LZ4 library support" ON)
|
||||
set(WITH_LZ4_EXT OFF)
|
||||
-if(ENABLE_LZ4_EXT)
|
||||
- find_package(LZ4)
|
||||
- if(LZ4_FOUND)
|
||||
+if(1)
|
||||
+ find_package(lz4 CONFIG REQUIRED)
|
||||
+ if(1)
|
||||
set(WITH_LZ4_EXT ON)
|
||||
list(APPEND BUILT_WITH "LZ4_EXT")
|
||||
@@ -248,4 +248,4 @@ # LZ4 {
|
||||
install(
|
||||
- FILES "${project_config}" "${project_version}" "packaging/cmake/Modules/FindLZ4.cmake"
|
||||
+ FILES "${project_config}" "${project_version}"
|
||||
DESTINATION "${config_install_dir}"
|
||||
)
|
||||
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -241,4 +241,3 @@
|
||||
if(WITH_LZ4_EXT)
|
||||
- target_include_directories(rdkafka PRIVATE ${LZ4_INCLUDE_DIRS})
|
||||
- target_link_libraries(rdkafka PUBLIC LZ4::LZ4)
|
||||
+ target_link_libraries(rdkafka PUBLIC lz4::lz4)
|
||||
endif()
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 7f3dd0f..168742c 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -169,7 +169,8 @@ endif()
|
||||
option(ENABLE_LZ4_EXT "Enable external LZ4 library support" ON)
|
||||
set(WITH_LZ4_EXT OFF)
|
||||
if(ENABLE_LZ4_EXT)
|
||||
- find_package(LZ4)
|
||||
+ find_package(LZ4 NAMES lz4 REQUIRED)
|
||||
+ add_library(LZ4::LZ4 ALIAS lz4::lz4)
|
||||
if(LZ4_FOUND)
|
||||
set(WITH_LZ4_EXT ON)
|
||||
list(APPEND BUILT_WITH "LZ4_EXT")
|
||||
diff --git a/packaging/cmake/Config.cmake.in b/packaging/cmake/Config.cmake.in
|
||||
index 8a6522b..5f0bf25 100644
|
||||
--- a/packaging/cmake/Config.cmake.in
|
||||
+++ b/packaging/cmake/Config.cmake.in
|
||||
@@ -28,7 +28,7 @@ if(@WITH_SSL@)
|
||||
endif()
|
||||
|
||||
if(@WITH_LZ4_EXT@)
|
||||
- find_dependency(LZ4)
|
||||
+ find_dependency(LZ4 NAMES lz4)
|
||||
endif()
|
||||
|
||||
find_dependency(Threads)
|
||||
|
@ -2,7 +2,7 @@ vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO confluentinc/librdkafka
|
||||
REF "v${VERSION}"
|
||||
SHA512 a68b7382ec5a9afc0eb8513e97d8563c599021d774f7790a61af80565600678a497e4957dcdd823f8b9a426a19b9c5392cacd42d02d70493d993319f3343fe96
|
||||
SHA512 a68b7382ec5a9afc0eb8513e97d8563c599021d774f7790a61af80565600678a497e4957dcdd823f8b9a426a19b9c5392cacd42d02d70493d993319f3343fe96
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
lz4.patch
|
||||
@ -47,14 +47,12 @@ vcpkg_cmake_install()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_cmake_config_fixup(
|
||||
PACKAGE_NAME RdKafka
|
||||
CONFIG_PATH lib/cmake/RdKafka
|
||||
)
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/RdKafka" PACKAGE_NAME "rdkafka")
|
||||
|
||||
file(REMOVE_RECURSE
|
||||
"${CURRENT_PACKAGES_DIR}/debug/include"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/share"
|
||||
"${CURRENT_PACKAGES_DIR}/share/rdkafka/FindLZ4.cmake"
|
||||
)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "librdkafka",
|
||||
"version": "2.3.0",
|
||||
"port-version": 3,
|
||||
"port-version": 4,
|
||||
"description": "The Apache Kafka C/C++ library",
|
||||
"homepage": "https://github.com/confluentinc/librdkafka",
|
||||
"license": null,
|
||||
|
@ -1,58 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(lz4 C)
|
||||
|
||||
if(MSVC AND BUILD_SHARED_LIBS)
|
||||
add_definitions(-DLZ4_DLL_EXPORT)
|
||||
endif()
|
||||
add_definitions(-DXXH_NAMESPACE=LZ4_)
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Install prefix")
|
||||
set(INSTALL_BIN_DIR "bin" CACHE PATH "Path where exe and dll will be installed")
|
||||
set(INSTALL_LIB_DIR "lib" CACHE PATH "Path where lib will be installed")
|
||||
set(INSTALL_INCLUDE_DIR "include" CACHE PATH "Path where headers will be installed")
|
||||
set(INSTALL_CMAKE_DIR "share/lz4" CACHE PATH "Path where cmake configs will be installed")
|
||||
|
||||
file(GLOB LZ4_HEADERS lib/*.h)
|
||||
list(REMOVE_ITEM LZ4_HEADERS "${CMAKE_CURRENT_LIST_DIR}/lib/xxhash.h")
|
||||
|
||||
add_library(lz4
|
||||
${LZ4_HEADERS}
|
||||
lib/lz4.c
|
||||
lib/lz4frame.c
|
||||
lib/lz4hc.c
|
||||
lib/xxhash.c
|
||||
)
|
||||
|
||||
target_include_directories(lz4 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/lib> $<INSTALL_INTERFACE:include>)
|
||||
set_target_properties(lz4 PROPERTIES PUBLIC_HEADER "${LZ4_HEADERS}")
|
||||
|
||||
install(TARGETS lz4
|
||||
EXPORT lz4Config
|
||||
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
|
||||
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}"
|
||||
PRIVATE_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}"
|
||||
COMPONENT dev
|
||||
)
|
||||
|
||||
FILE(GLOB lz4h "${CMAKE_CURRENT_LIST_DIR}/lib/*.h")
|
||||
list(REMOVE_ITEM lz4h "${CMAKE_CURRENT_LIST_DIR}/lib/xxhash.h")
|
||||
INSTALL(FILES ${lz4h} DESTINATION "${INSTALL_INCLUDE_DIR}")
|
||||
|
||||
install(EXPORT lz4Config
|
||||
FILE lz4-config.cmake
|
||||
NAMESPACE lz4::
|
||||
DESTINATION "${INSTALL_CMAKE_DIR}"
|
||||
)
|
||||
|
||||
# Export the package for use from the build-tree (this registers the build-tree with a global CMake-registry)
|
||||
export(PACKAGE lz4)
|
||||
|
||||
# Create pkgconfig module file
|
||||
file(STRINGS "lib/lz4.h" LZ4_H REGEX "^#define LZ4_VERSION_(MAJOR|MINOR|RELEASE) ")
|
||||
string(REGEX REPLACE "^.*MAJOR +([0-9]+).*MINOR +([0-9]+).*RELEASE +([0-9]+).*$" "\\1.\\2.\\3" VERSION "${LZ4_H}")
|
||||
set(INCLUDEDIR [[${prefix}/include]])
|
||||
set(LIBDIR [[${prefix}/lib]])
|
||||
configure_file(lib/liblz4.pc.in lib/liblz4.pc @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib/liblz4.pc" DESTINATION "lib/pkgconfig")
|
@ -1,15 +1,22 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO lz4/lz4
|
||||
REF v1.9.4
|
||||
SHA512 043a9acb2417624019d73db140d83b80f1d7c43a6fd5be839193d68df8fd0b3f610d7ed4d628c2a9184f7cde9a0fd1ba9d075d8251298e3eb4b3a77f52736684
|
||||
REF v${VERSION}
|
||||
SHA512 8c4ceb217e6dc8e7e0beba99adc736aca8963867bcf9f970d621978ba11ce92855912f8b66138037a1d2ae171e8e17beb7be99281fea840106aa60373c455b28
|
||||
HEAD_REF dev
|
||||
PATCHES
|
||||
target-lz4-lz4.diff
|
||||
)
|
||||
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
tools LZ4_BUILD_CLI
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
SOURCE_PATH "${SOURCE_PATH}/build/cmake"
|
||||
OPTIONS
|
||||
${FEATURE_OPTIONS}
|
||||
OPTIONS_DEBUG
|
||||
-DCMAKE_DEBUG_POSTFIX=d
|
||||
)
|
||||
@ -17,6 +24,13 @@ vcpkg_cmake_configure(
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
if("tools" IN_LIST FEATURES)
|
||||
vcpkg_copy_tools(
|
||||
TOOL_NAMES lz4
|
||||
AUTO_CLEAN
|
||||
)
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
set(DLL_IMPORT "1 && defined(_MSC_VER)")
|
||||
else()
|
||||
@ -29,12 +43,20 @@ foreach(FILE lz4.h lz4frame.h)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
vcpkg_cmake_config_fixup()
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/lz4")
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/liblz4.pc" " -llz4" " -llz4d")
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
|
||||
file(INSTALL "${SOURCE_PATH}/lib/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
|
||||
set(LICENSE_FILES "${SOURCE_PATH}/lib/LICENSE")
|
||||
if("tools" IN_LIST FEATURES)
|
||||
list(APPEND LICENSE_FILES "${SOURCE_PATH}/programs/COPYING")
|
||||
endif()
|
||||
vcpkg_install_copyright(FILE_LIST ${LICENSE_FILES})
|
||||
|
17
ports/lz4/target-lz4-lz4.diff
Normal file
17
ports/lz4/target-lz4-lz4.diff
Normal file
@ -0,0 +1,17 @@
|
||||
diff --git a/build/cmake/lz4Config.cmake.in b/build/cmake/lz4Config.cmake.in
|
||||
index e9c9473..4b48032 100644
|
||||
--- a/build/cmake/lz4Config.cmake.in
|
||||
+++ b/build/cmake/lz4Config.cmake.in
|
||||
@@ -1,2 +1,10 @@
|
||||
@PACKAGE_INIT@
|
||||
-include( "${CMAKE_CURRENT_LIST_DIR}/lz4Targets.cmake" )
|
||||
\ No newline at end of file
|
||||
+include( "${CMAKE_CURRENT_LIST_DIR}/lz4Targets.cmake" )
|
||||
+if(NOT TARGET lz4::lz4)
|
||||
+ add_library(lz4::lz4 INTERFACE IMPORTED)
|
||||
+ if("@BUILD_SHARED_LIBS@")
|
||||
+ set_target_properties(lz4::lz4 PROPERTIES INTERFACE_LINK_LIBRARIES LZ4::lz4_shared)
|
||||
+ else()
|
||||
+ set_target_properties(lz4::lz4 PROPERTIES INTERFACE_LINK_LIBRARIES LZ4::lz4_static)
|
||||
+ endif()
|
||||
+endif()
|
8
ports/lz4/usage
Normal file
8
ports/lz4/usage
Normal file
@ -0,0 +1,8 @@
|
||||
lz4 provides CMake targets:
|
||||
|
||||
find_package(lz4 CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE lz4::lz4)
|
||||
|
||||
lz4 provides pkg-config modules:
|
||||
|
||||
liblz4
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "lz4",
|
||||
"version": "1.9.4",
|
||||
"port-version": 2,
|
||||
"version": "1.10.0",
|
||||
"description": "Lossless compression algorithm, providing compression speed at 400 MB/s per core.",
|
||||
"homepage": "https://github.com/lz4/lz4",
|
||||
"license": "BSD-2-Clause",
|
||||
@ -14,5 +13,11 @@
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"features": {
|
||||
"tools": {
|
||||
"description": "Build lz4 binary",
|
||||
"license": "GPL-2.0-or-later"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ index 8c94e3bcd..ade3f9451 100644
|
||||
- INTERFACE_INCLUDE_DIRECTORIES "${LZ4_INCLUDE_DIR}")
|
||||
- endif ()
|
||||
-endif ()
|
||||
+find_package(LZ4 CONFIG REQUIRED)
|
||||
+find_package(LZ4 NAMES lz4 REQUIRED)
|
||||
+if(NOT TARGET LZ4::LZ4)
|
||||
+ add_library(LZ4::LZ4 INTERFACE IMPORTED)
|
||||
+ target_link_libraries(LZ4::LZ4 INTERFACE lz4::lz4)
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vtk",
|
||||
"version-semver": "9.3.0-pv5.12.1",
|
||||
"port-version": 2,
|
||||
"port-version": 3,
|
||||
"description": "Software system for 3D computer graphics, image processing, and visualization",
|
||||
"homepage": "https://github.com/Kitware/VTK",
|
||||
"license": "BSD-3-Clause",
|
||||
|
@ -4934,7 +4934,7 @@
|
||||
},
|
||||
"librdkafka": {
|
||||
"baseline": "2.3.0",
|
||||
"port-version": 3
|
||||
"port-version": 4
|
||||
},
|
||||
"libredwg": {
|
||||
"baseline": "0.13.3",
|
||||
@ -5577,8 +5577,8 @@
|
||||
"port-version": 1
|
||||
},
|
||||
"lz4": {
|
||||
"baseline": "1.9.4",
|
||||
"port-version": 2
|
||||
"baseline": "1.10.0",
|
||||
"port-version": 0
|
||||
},
|
||||
"lzav": {
|
||||
"baseline": "3.13",
|
||||
@ -9338,7 +9338,7 @@
|
||||
},
|
||||
"vtk": {
|
||||
"baseline": "9.3.0-pv5.12.1",
|
||||
"port-version": 2
|
||||
"port-version": 3
|
||||
},
|
||||
"vtk-dicom": {
|
||||
"baseline": "0.8.14",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "fbdd447367d1830499368d2c005ce991e7a52fa4",
|
||||
"version": "2.3.0",
|
||||
"port-version": 4
|
||||
},
|
||||
{
|
||||
"git-tree": "43fbb6abd2228252734e70f03890aba159c4d45c",
|
||||
"version": "2.3.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "4f01eec10f515a428e914107c5188366380f8dd9",
|
||||
"version": "1.10.0",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "1517cb497fc9cac35e932097022365a553732c8c",
|
||||
"version": "1.9.4",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "dbdb5ecd3e43e28d167883d384b471f65eb59012",
|
||||
"version-semver": "9.3.0-pv5.12.1",
|
||||
"port-version": 3
|
||||
},
|
||||
{
|
||||
"git-tree": "0c230cc0e6003a34330671080a7c00f3618c23e4",
|
||||
"version-semver": "9.3.0-pv5.12.1",
|
||||
|
Loading…
Reference in New Issue
Block a user