[ls-qpack] Add cmake export (#40652)

This commit is contained in:
talregev 2024-08-29 10:05:03 +03:00 committed by GitHub
parent 41739525b6
commit 89685cc5d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 75 additions and 17 deletions

View File

@ -0,0 +1,46 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ff26bc3..6df9654 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,10 @@ option(LSQPACK_XXH "Include XXH" ON)
# Use `cmake -DBUILD_SHARED_LIBS=OFF` to build a static library.
add_library(ls-qpack "")
-target_include_directories(ls-qpack PUBLIC .)
+target_include_directories(ls-qpack PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:include>
+)
target_sources(ls-qpack PRIVATE lsqpack.c)
if(LSQPACK_XXH)
@@ -30,7 +33,10 @@ else()
endif()
if(WIN32)
- target_include_directories(ls-qpack PUBLIC wincompat)
+ target_include_directories(ls-qpack PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/wincompat>
+ $<INSTALL_INTERFACE:include>
+ )
endif()
if(MSVC)
@@ -106,7 +112,16 @@ if(LSQPACK_BIN)
add_subdirectory(bin)
endif()
-install(TARGETS ls-qpack)
+install(TARGETS ls-qpack EXPORT unofficial-ls-qpack-config
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+install(
+ EXPORT unofficial-ls-qpack-config
+ NAMESPACE unofficial::ls-qpack::
+ DESTINATION share/unofficial-ls-qpack
+)
install(FILES lsqpack.h lsxpack_header.h DESTINATION include)
if(WIN32)
install(DIRECTORY wincompat/sys DESTINATION include)

View File

@ -10,6 +10,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
xxhash.patch
cmake-export.patch
)
vcpkg_find_acquire_program(PKGCONFIG)
@ -26,8 +27,18 @@ vcpkg_cmake_configure(
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-ls-qpack)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
file(READ "${CURRENT_PACKAGES_DIR}/share/unofficial-ls-qpack/unofficial-ls-qpack-config.cmake" cmake_config)
file(WRITE "${CURRENT_PACKAGES_DIR}/share/unofficial-ls-qpack/unofficial-ls-qpack-config.cmake"
"include(CMakeFindDependencyMacro)
find_dependency(xxhash CONFIG)
${cmake_config}
")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

View File

@ -1,7 +0,0 @@
The package ls-qpack can be used via CMake:
find_path(LSQPACK_INCLUDE_DIRS "lsqpack.h")
find_library(LSQPACK_LIBRARY ls-qpack REQUIRED)
target_include_directories(main PRIVATE ${LSQPACK_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${LSQPACK_LIBRARY})

View File

@ -1,6 +1,7 @@
{
"name": "ls-qpack",
"version": "2.5.4",
"port-version": 1,
"description": "QPACK compression library for use with HTTP/3",
"homepage": "https://github.com/litespeedtech/ls-qpack",
"license": "MIT",
@ -10,6 +11,10 @@
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"xxhash"
]
}

View File

@ -1,19 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a1f8e9..949d7f1 100644
index 1a1f8e9..cf207d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,9 +20,14 @@ add_library(ls-qpack "")
@@ -20,9 +20,12 @@ add_library(ls-qpack "")
target_include_directories(ls-qpack PUBLIC .)
target_sources(ls-qpack PRIVATE lsqpack.c)
-target_include_directories(ls-qpack PRIVATE deps/xxhash/)
+# target_include_directories(ls-qpack PRIVATE deps/xxhash/)
if(LSQPACK_XXH)
target_sources(ls-qpack PRIVATE deps/xxhash/xxhash.c)
+else()
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(XXH REQUIRED IMPORTED_TARGET libxxhash)
+ target_link_libraries(ls-qpack PUBLIC PkgConfig::XXH)
+ find_package(xxHash CONFIG REQUIRED)
+ target_link_libraries(ls-qpack PUBLIC xxHash::xxhash)
+ set(LSQPACK_DEPENDS "libxxhash")
endif()

View File

@ -5514,7 +5514,7 @@
},
"ls-qpack": {
"baseline": "2.5.4",
"port-version": 0
"port-version": 1
},
"ltla-aarand": {
"baseline": "2023-03-19",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1740a9928aea7bdf09afeb0abf677ecb83151309",
"version": "2.5.4",
"port-version": 1
},
{
"git-tree": "6b05f64e6b3116005c25b7b9b585e8770abcdae7",
"version": "2.5.4",