[redis-plus-plus] Add feature async-std and fix dependency libuv (#25272)

* [redis-plus-plus] Add feature async-std and fix dependency libuv

* Re-generate patch

* version

* Add license

* version

* Apply suggestion

* version
This commit is contained in:
Jack·Boos·Yu 2022-06-17 19:47:31 +00:00 committed by GitHub
parent f2606af170
commit 945e171c8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,23 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e85a158..e67681c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,8 +30,8 @@ if(REDIS_PLUS_PLUS_BUILD_ASYNC)
message(STATUS "redis-plus-plus build async interface with libuv")
# libuv dependency
- find_path(REDIS_PLUS_PLUS_ASYNC_LIB_HEADER NAMES uv.h)
- find_library(REDIS_PLUS_PLUS_ASYNC_LIB uv)
+ find_package(unofficial-libuv CONFIG REQUIRED)
+ set(REDIS_PLUS_PLUS_ASYNC_LIB unofficial::libuv::libuv)
else()
message(FATAL_ERROR "invalid REDIS_PLUS_PLUS_BUILD_ASYNC")
endif()
@@ -150,7 +150,6 @@ if(REDIS_PLUS_PLUS_BUILD_STATIC)
if(REDIS_PLUS_PLUS_BUILD_ASYNC)
target_include_directories(${STATIC_LIB} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${REDIS_PLUS_PLUS_ASYNC_FUTURE_HEADER}>)
- target_include_directories(${STATIC_LIB} PUBLIC $<BUILD_INTERFACE:${REDIS_PLUS_PLUS_ASYNC_LIB_HEADER}>)
if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost")
target_include_directories(${STATIC_LIB} SYSTEM PUBLIC $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}>)
endif()

View File

@ -7,6 +7,7 @@ vcpkg_from_github(
PATCHES
fix-ws2-linking-windows.patch
fix-conversion.patch
fix-dependency-libuv.patch
)
if("cxx17" IN_LIST FEATURES)
@ -15,6 +16,14 @@ else()
set(REDIS_PLUS_PLUS_CXX_STANDARD 11)
endif()
set(EXTRA_OPT "")
if ("async" IN_LIST FEATURES)
list(APPEND EXTRA_OPT -DREDIS_PLUS_PLUS_BUILD_ASYNC="libuv")
endif()
if ("async-std" IN_LIST FEATURES)
list(APPEND EXTRA_OPT -DREDIS_PLUS_PLUS_ASYNC_FUTURE="std")
endif()
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" REDIS_PLUS_PLUS_BUILD_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" REDIS_PLUS_PLUS_BUILD_SHARED)
@ -26,6 +35,7 @@ vcpkg_cmake_configure(
-DREDIS_PLUS_PLUS_BUILD_SHARED=${REDIS_PLUS_PLUS_BUILD_SHARED}
-DREDIS_PLUS_PLUS_BUILD_TEST=OFF
-DREDIS_PLUS_PLUS_CXX_STANDARD=${REDIS_PLUS_PLUS_CXX_STANDARD}
${EXTRA_OPT}
)
vcpkg_cmake_install()

View File

@ -1,8 +1,10 @@
{
"name": "redis-plus-plus",
"version-semver": "1.3.2",
"port-version": 1,
"description": "This is a C++ client for Redis. It's based on hiredis, and written in C++ 11",
"homepage": "https://github.com/sewenew/redis-plus-plus",
"license": "Apache-2.0",
"dependencies": [
"hiredis",
{
@ -15,6 +17,24 @@
}
],
"features": {
"async": {
"description": "Build with async",
"dependencies": [
"libuv"
]
},
"async-std": {
"description": "Build async with std::future",
"dependencies": [
{
"name": "redis-plus-plus",
"default-features": false,
"features": [
"async"
]
}
]
},
"cxx17": {
"description": "Build redis-plus-plus with cxx 17 standard"
}

View File

@ -6206,7 +6206,7 @@
},
"redis-plus-plus": {
"baseline": "1.3.2",
"port-version": 0
"port-version": 1
},
"refl-cpp": {
"baseline": "0.12.3",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "bfb560234e651a06204f44976997b21466ba6a9d",
"version-semver": "1.3.2",
"port-version": 1
},
{
"git-tree": "a58c88604be6da2e638127442cc413c0504e2f51",
"version-semver": "1.3.2",