forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin#29723: depends: build zeromq with CMake
0388ad0 depends: switch zmq to CMake (Cory Fields) fefb3bb depends: add zeromq no librt patch (fanquake) a522ef1 depends: add zeromq cmake minimum patch (fanquake) cbbc229 depends: add zeromq windows usage patch (fanquake) 2de68d6 depends: add zeromq builtin sha1 patch (fanquake) 0c86052 depends: add zeromq mktemp macos patch (fanquake) Pull request description: This picks up a change, which is a switch to building zeromq with CMake. It includes a number of patches, some which have already been upstreamed (see each patch for details). ACKs for top commit: hebasto: ACK 0388ad0. Tree-SHA512: 5567e432b4e4e0446c41d502bd61810a80b329dea2399b5d9d9f6e79acc450d1c6ba861c8238ba895de98338cfc5dc44ad2bf86ee8c222ecb3fbf47d6eb60da4
- Loading branch information
1 parent
685b7a7
commit e2b2446
Showing
6 changed files
with
181 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Don't use builtin sha1 if not using ws | ||
|
||
The builtin SHA1 (ZMQ_USE_BUILTIN_SHA1) is only used in the websocket | ||
engine (ws_engine.cpp). | ||
Upstreamed in https://github.com/zeromq/libzmq/pull/4670. | ||
|
||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -234,7 +234,7 @@ if(NOT ZMQ_USE_GNUTLS) | ||
endif() | ||
endif() | ||
endif() | ||
- if(NOT ZMQ_USE_NSS) | ||
+ if(ENABLE_WS AND NOT ZMQ_USE_NSS) | ||
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.h) | ||
message(STATUS "Using builtin sha1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Set a more sane cmake_minimum_required. | ||
|
||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -1,12 +1,7 @@ | ||
# CMake build script for ZeroMQ | ||
+cmake_minimum_required(VERSION 3.16) | ||
project(ZeroMQ) | ||
|
||
-if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin) | ||
- cmake_minimum_required(VERSION 3.0.2) | ||
-else() | ||
- cmake_minimum_required(VERSION 2.8.12) | ||
-endif() | ||
- | ||
include(CheckIncludeFiles) | ||
include(CheckCCompilerFlag) | ||
include(CheckCXXCompilerFlag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
This fixes several instances where _MSC_VER was | ||
used to determine whether to use afunix.h or not. | ||
|
||
See https://github.com/zeromq/libzmq/pull/4678. | ||
--- a/src/ipc_address.hpp | ||
+++ b/src/ipc_address.hpp | ||
@@ -7,7 +7,7 @@ | ||
|
||
#include <string> | ||
|
||
-#if defined _MSC_VER | ||
+#if defined ZMQ_HAVE_WINDOWS | ||
#include <afunix.h> | ||
#else | ||
#include <sys/socket.h> | ||
diff --git a/src/ipc_connecter.cpp b/src/ipc_connecter.cpp | ||
index 3f988745..ed2a0645 100644 | ||
--- a/src/ipc_connecter.cpp | ||
+++ b/src/ipc_connecter.cpp | ||
@@ -16,7 +16,7 @@ | ||
#include "ipc_address.hpp" | ||
#include "session_base.hpp" | ||
|
||
-#ifdef _MSC_VER | ||
+#if defined ZMQ_HAVE_WINDOWS | ||
#include <afunix.h> | ||
#else | ||
#include <unistd.h> | ||
diff --git a/src/ipc_listener.cpp b/src/ipc_listener.cpp | ||
index 50126040..5428579b 100644 | ||
--- a/src/ipc_listener.cpp | ||
+++ b/src/ipc_listener.cpp | ||
@@ -17,7 +17,7 @@ | ||
#include "socket_base.hpp" | ||
#include "address.hpp" | ||
|
||
-#ifdef _MSC_VER | ||
+#ifdef ZMQ_HAVE_WINDOWS | ||
#ifdef ZMQ_IOTHREAD_POLLER_USE_SELECT | ||
#error On Windows, IPC does not work with POLLER=select, use POLLER=epoll instead, or disable IPC transport | ||
#endif | ||
diff --git a/tests/testutil.cpp b/tests/testutil.cpp | ||
index bdc80283..6f21e8f6 100644 | ||
--- a/tests/testutil.cpp | ||
+++ b/tests/testutil.cpp | ||
@@ -7,7 +7,7 @@ | ||
|
||
#if defined _WIN32 | ||
#include "../src/windows.hpp" | ||
-#if defined _MSC_VER | ||
+#if defined ZMQ_HAVE_WINDOWS | ||
#if defined ZMQ_HAVE_IPC | ||
#include <direct.h> | ||
#include <afunix.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
build: fix mkdtemp check on macOS | ||
|
||
On macOS, mkdtemp is in unistd.h. Fix the CMake check so that is works. | ||
Upstreamed in https://github.com/zeromq/libzmq/pull/4668. | ||
|
||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -599,7 +599,7 @@ if(NOT MSVC) | ||
|
||
check_cxx_symbol_exists(fork unistd.h HAVE_FORK) | ||
check_cxx_symbol_exists(gethrtime sys/time.h HAVE_GETHRTIME) | ||
- check_cxx_symbol_exists(mkdtemp stdlib.h HAVE_MKDTEMP) | ||
+ check_cxx_symbol_exists(mkdtemp "stdlib.h;unistd.h" HAVE_MKDTEMP) | ||
check_cxx_symbol_exists(accept4 sys/socket.h HAVE_ACCEPT4) | ||
check_cxx_symbol_exists(strnlen string.h HAVE_STRNLEN) | ||
else() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
We don't use librt, so don't try and link against it. | ||
|
||
Related to: https://github.com/zeromq/libzmq/pull/4702. | ||
|
||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 03462271..87ceab3c 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -564,13 +564,6 @@ else() | ||
check_cxx_symbol_exists(SO_BUSY_POLL sys/socket.h ZMQ_HAVE_BUSY_POLL) | ||
endif() | ||
|
||
-if(NOT MINGW) | ||
- find_library(RT_LIBRARY rt) | ||
- if(RT_LIBRARY) | ||
- set(pkg_config_libs_private "${pkg_config_libs_private} -lrt") | ||
- endif() | ||
-endif() | ||
- | ||
find_package(Threads) | ||
|
||
if(WIN32 AND NOT CYGWIN) | ||
@@ -588,9 +581,7 @@ if(WIN32 AND NOT CYGWIN) | ||
endif() | ||
|
||
if(NOT MSVC) | ||
- set(CMAKE_REQUIRED_LIBRARIES rt) | ||
check_cxx_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME) | ||
- set(CMAKE_REQUIRED_LIBRARIES) | ||
|
||
check_cxx_symbol_exists(fork unistd.h HAVE_FORK) | ||
check_cxx_symbol_exists(gethrtime sys/time.h HAVE_GETHRTIME) | ||
@@ -1503,10 +1494,6 @@ if(BUILD_SHARED) | ||
target_link_libraries(libzmq iphlpapi) | ||
endif() | ||
|
||
- if(RT_LIBRARY) | ||
- target_link_libraries(libzmq -lrt) | ||
- endif() | ||
- | ||
if(norm_FOUND) | ||
target_link_libraries(libzmq norm::norm) | ||
endif() | ||
@@ -1553,10 +1540,6 @@ if(BUILD_STATIC) | ||
target_link_libraries(libzmq-static iphlpapi) | ||
endif() | ||
|
||
- if(RT_LIBRARY) | ||
- target_link_libraries(libzmq-static -lrt) | ||
- endif() | ||
- | ||
if(CMAKE_SYSTEM_NAME MATCHES "QNX") | ||
add_definitions(-DUNITY_EXCLUDE_MATH_H) | ||
endif() |