Skip to content

Commit

Permalink
[hiredis] fix examples (microsoft#31130)
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort authored May 2, 2023
1 parent a5d91f7 commit 845b321
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
25 changes: 9 additions & 16 deletions ports/hiredis/fix-feature-example.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,26 @@ diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index dd3a313..8c69d3a 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -19,16 +19,25 @@ if (LIBEV)
@@ -19,16 +19,16 @@ if (LIBEV)
TARGET_LINK_LIBRARIES(example-libev hiredis ev)
ENDIF()

-FIND_PATH(LIBEVENT event.h)
-if (LIBEVENT)
+FIND_PACKAGE(Libevent CONFIG REQUIRED)
+FIND_PATH(LIBEVENT_INCLUDES evutil.h)
+if (UNIX)
+find_package(Libevent CONFIG REQUIRED)
+if (1)
ADD_EXECUTABLE(example-libevent example-libevent)
- TARGET_LINK_LIBRARIES(example-libevent hiredis event)
+ TARGET_LINK_LIBRARIES(example-libevent hiredis ${LIBEVENT_LIBRARIES})
+ TARGET_INCLUDE_DIRECTORIES(example-libevent PRIVATE ${LIBEVENT_INCLUDES})
+ TARGET_LINK_LIBRARIES(example-libevent hiredis libevent::core)
ENDIF()

+FIND_LIBRARY(UV_LIBRARY libuv)
FIND_PATH(LIBUV uv.h)
IF (LIBUV)
-FIND_PATH(LIBUV uv.h)
-IF (LIBUV)
+find_package(libuv CONFIG REQUIRED)
+IF (1)
ADD_EXECUTABLE(example-libuv example-libuv.c)
- TARGET_LINK_LIBRARIES(example-libuv hiredis uv)
+ if(WIN32)
+ set(LIB_LISTS Iphlpapi.lib Psapi.lib Userenv.lib)
+ else()
+ set(LIB_LISTS)
+ endif()
+ TARGET_LINK_LIBRARIES(example-libuv hiredis ${UV_LIBRARY} ${LIB_LISTS})
+ TARGET_INCLUDE_DIRECTORIES(example-libuv PRIVATE ${LIBUV})
+ TARGET_LINK_LIBRARIES(example-libuv hiredis $<IF:$<TARGET_EXISTS:uv_a>,uv_a,uv>)
ENDIF()

IF (APPLE)
Expand Down
2 changes: 1 addition & 1 deletion ports/hiredis/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hiredis",
"version": "1.0.2",
"port-version": 4,
"port-version": 5,
"description": "Hiredis is a minimalistic C client library for the Redis database.",
"homepage": "https://github.com/redis/hiredis",
"license": "BSD-3-Clause",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3118,7 +3118,7 @@
},
"hiredis": {
"baseline": "1.0.2",
"port-version": 4
"port-version": 5
},
"hnswlib": {
"baseline": "0.7.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/h-/hiredis.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "413b1dbea0dd87e4a12a646ba12411d319e5bf38",
"version": "1.0.2",
"port-version": 5
},
{
"git-tree": "448374fa990c04aa7964508d32817a6d7868600b",
"version": "1.0.2",
Expand Down

0 comments on commit 845b321

Please sign in to comment.