Skip to content

Commit

Permalink
Fix hiredis_cluster_ssl build on Windows (#253)
Browse files Browse the repository at this point in the history
* Export all symbols for both libraries on Windows
* Remove reference to deleted .def file
* Enable non-const connect callback API on Windows
  • Loading branch information
ffratila authored Jan 15, 2025
1 parent 647fce3 commit 5ac51f4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 73 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ SET(hiredis_cluster_sources

if(WIN32 OR MINGW)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN)
set(hiredis_cluster_sources
${hiredis_cluster_sources}
hiredis_cluster.def)
endif()

add_library(hiredis_cluster
Expand All @@ -73,6 +70,7 @@ endif()

set_target_properties(hiredis_cluster
PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
VERSION "${HIREDIS_CLUSTER_SONAME}")

if(DOWNLOAD_HIREDIS)
Expand Down Expand Up @@ -167,7 +165,9 @@ if(ENABLE_SSL)
add_library(hiredis_cluster_ssl
SHARED hircluster_ssl.c)
set_target_properties(hiredis_cluster_ssl
PROPERTIES VERSION "${HIREDIS_CLUSTER_SONAME}")
PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
VERSION "${HIREDIS_CLUSTER_SONAME}")
target_link_libraries(hiredis_cluster_ssl
PRIVATE hiredis_cluster
PUBLIC hiredis::hiredis_ssl)
Expand Down
4 changes: 0 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ tests using printouts, try `make CTEST_OUTPUT_ON_FAILURE=1 test` or call `ctest`
directly with your prefered args, such as `-V` (check the manpage for ctest), in
your CMake build directory.

If you have problems with the linker not finding certain functions in the
Windows builds, try adding those functions to the file `hiredis_cluster.def`.
All functions called from the tests need to be in this file.

## Submitting changes

* Run the formatter before committing when contributing to this project (`make format`).
Expand Down
6 changes: 3 additions & 3 deletions hircluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
#define HIRCLUSTER_EVENT_FREE_CONTEXT 3

/* The non-const connect callback API is not available when:
* - using hiredis prior v.1.1.0; or
* - built on Windows since hiredis_cluster.def can't have conditional definitions. */
#if !(HIREDIS_MAJOR >= 1 && HIREDIS_MINOR >= 1) || _WIN32
* - using hiredis prior v.1.1.0;
*/
#if !(HIREDIS_MAJOR >= 1 && HIREDIS_MINOR >= 1)
#define HIRCLUSTER_NO_NONCONST_CONNECT_CB
#endif

Expand Down
62 changes: 0 additions & 62 deletions hiredis_cluster.def

This file was deleted.

0 comments on commit 5ac51f4

Please sign in to comment.