Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions ports/redis-plus-plus/fix-dependency-libuv.patch
Original file line number Diff line number Diff line change
@@ -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()
10 changes: 10 additions & 0 deletions ports/redis-plus-plus/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand All @@ -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()
Expand Down
20 changes: 20 additions & 0 deletions ports/redis-plus-plus/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
{
Expand All @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6202,7 +6202,7 @@
},
"redis-plus-plus": {
"baseline": "1.3.2",
"port-version": 0
"port-version": 1
},
"refl-cpp": {
"baseline": "0.12.3",
Expand Down
5 changes: 5 additions & 0 deletions versions/r-/redis-plus-plus.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "bfb560234e651a06204f44976997b21466ba6a9d",
"version-semver": "1.3.2",
"port-version": 1
},
{
"git-tree": "a58c88604be6da2e638127442cc413c0504e2f51",
"version-semver": "1.3.2",
Expand Down