mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-22 18:47:09 +01:00
[hiredis] Fix feature ssl build error on windows (#12354)
* [hiredis] Fix feature ssl build error on windows * Fix feature example build error on windows
This commit is contained in:
parent
85a5acfd3c
commit
fc761ebb72
@ -1,5 +1,6 @@
|
|||||||
Source: hiredis
|
Source: hiredis
|
||||||
Version: 2019-11-2-1
|
Version: 2019-11-2
|
||||||
|
Port-Version: 2
|
||||||
Homepage: https://github.com/redis/hiredis
|
Homepage: https://github.com/redis/hiredis
|
||||||
Description: Hiredis is a minimalistic C client library for the Redis database.
|
Description: Hiredis is a minimalistic C client library for the Redis database.
|
||||||
|
|
||||||
@ -9,4 +10,4 @@ Build-Depends: openssl
|
|||||||
|
|
||||||
Feature: example
|
Feature: example
|
||||||
Description: Build example
|
Description: Build example
|
||||||
Build-Depends: libevent, pthread
|
Build-Depends: libevent, pthread, libuv
|
@ -1,8 +1,8 @@
|
|||||||
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
|
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
|
||||||
index dd3a313..0df75d5 100644
|
index dd3a313..8c69d3a 100644
|
||||||
--- a/examples/CMakeLists.txt
|
--- a/examples/CMakeLists.txt
|
||||||
+++ b/examples/CMakeLists.txt
|
+++ b/examples/CMakeLists.txt
|
||||||
@@ -19,10 +19,17 @@ if (LIBEV)
|
@@ -19,16 +19,30 @@ if (LIBEV)
|
||||||
TARGET_LINK_LIBRARIES(example-libev hiredis ev)
|
TARGET_LINK_LIBRARIES(example-libev hiredis ev)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@ -22,8 +22,22 @@ index dd3a313..0df75d5 100644
|
|||||||
+ TARGET_INCLUDE_DIRECTORIES(example-libevent PRIVATE ${LIBEVENT_INCLUDES})
|
+ TARGET_INCLUDE_DIRECTORIES(example-libevent PRIVATE ${LIBEVENT_INCLUDES})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
+FIND_LIBRARY(UV_LIBRARY libuv)
|
||||||
FIND_PATH(LIBUV uv.h)
|
FIND_PATH(LIBUV uv.h)
|
||||||
@@ -38,9 +45,17 @@ IF (APPLE)
|
IF (LIBUV)
|
||||||
|
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})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (APPLE)
|
||||||
|
@@ -38,9 +52,21 @@ IF (APPLE)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (ENABLE_SSL)
|
IF (ENABLE_SSL)
|
||||||
@ -37,13 +51,30 @@ index dd3a313..0df75d5 100644
|
|||||||
+ ENDIF()
|
+ ENDIF()
|
||||||
ADD_EXECUTABLE(example-ssl example-ssl.c)
|
ADD_EXECUTABLE(example-ssl example-ssl.c)
|
||||||
- TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl)
|
- TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl)
|
||||||
|
+ if(WIN32)
|
||||||
|
+ TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl OpenSSL::SSL OpenSSL::Crypto ${THREADS_LIBS} crypt32.lib)
|
||||||
|
+ else()
|
||||||
+ TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl OpenSSL::SSL OpenSSL::Crypto ${THREADS_LIBS})
|
+ TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl OpenSSL::SSL OpenSSL::Crypto ${THREADS_LIBS})
|
||||||
|
+ endif()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ADD_EXECUTABLE(example example.c)
|
ADD_EXECUTABLE(example example.c)
|
||||||
-TARGET_LINK_LIBRARIES(example hiredis)
|
-TARGET_LINK_LIBRARIES(example hiredis)
|
||||||
+TARGET_LINK_LIBRARIES(example hiredis ${LIBEVENT_LIBS})
|
+TARGET_LINK_LIBRARIES(example hiredis ${LIBEVENT_LIBS})
|
||||||
\ No newline at end of file
|
diff --git a/examples/example-libuv.c b/examples/example-libuv.c
|
||||||
|
index a5462d4..9b7ca3e 100644
|
||||||
|
--- a/examples/example-libuv.c
|
||||||
|
+++ b/examples/example-libuv.c
|
||||||
|
@@ -33,7 +33,9 @@ void disconnectCallback(const redisAsyncContext *c, int status) {
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (int argc, char **argv) {
|
||||||
|
+#ifndef _WIN32
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
+#endif
|
||||||
|
uv_loop_t* loop = uv_default_loop();
|
||||||
|
|
||||||
|
redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379);
|
||||||
diff --git a/examples/example-ssl.c b/examples/example-ssl.c
|
diff --git a/examples/example-ssl.c b/examples/example-ssl.c
|
||||||
index 81f4648..9f42923 100644
|
index 81f4648..9f42923 100644
|
||||||
--- a/examples/example-ssl.c
|
--- a/examples/example-ssl.c
|
||||||
|
16
ports/hiredis/fix-pthread.h-not-found-on-windows.patch
Normal file
16
ports/hiredis/fix-pthread.h-not-found-on-windows.patch
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
diff --git a/ssl.c b/ssl.c
|
||||||
|
index 78ab9e4..768f304 100644
|
||||||
|
--- a/ssl.c
|
||||||
|
+++ b/ssl.c
|
||||||
|
@@ -34,7 +34,11 @@
|
||||||
|
#include "async.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
+#ifdef _WIN32
|
||||||
|
+#include <windows.h>
|
||||||
|
+#else
|
||||||
|
#include <pthread.h>
|
||||||
|
+#endif
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
@ -12,6 +12,7 @@ vcpkg_from_github(
|
|||||||
fix-feature-example.patch
|
fix-feature-example.patch
|
||||||
support-static-in-win.patch
|
support-static-in-win.patch
|
||||||
fix-timeval.patch
|
fix-timeval.patch
|
||||||
|
fix-pthread.h-not-found-on-windows.patch
|
||||||
)
|
)
|
||||||
|
|
||||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user