Skip to content

Commit 512b1d8

Browse files
committed
Select os.
1 parent dd8e1a7 commit 512b1d8

File tree

5 files changed

+185
-8
lines changed

5 files changed

+185
-8
lines changed

BUILD.bazel

+31-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
config_setting(
2+
name = "linux",
3+
constraint_values = [
4+
"@platforms//os:linux",
5+
],
6+
)
7+
8+
config_setting(
9+
name = "mac",
10+
constraint_values = [
11+
"@platforms//os:osx",
12+
],
13+
)
14+
115
cc_library(
216
name = "libzmq_headers_only",
317
hdrs = [
@@ -9,8 +23,15 @@ cc_library(
923
)
1024

1125
cc_library(
12-
name = "platform",
13-
hdrs = ["platform.hpp"],
26+
name = "platform_mac",
27+
hdrs = ["mac/platform.hpp"],
28+
strip_include_prefix = "mac",
29+
)
30+
31+
cc_library(
32+
name = "platform_linux",
33+
hdrs = ["linux/platform.hpp"],
34+
strip_include_prefix = "linux",
1435
)
1536

1637
cc_library(
@@ -268,6 +289,12 @@ cc_library(
268289
visibility = ["//visibility:public"],
269290
deps = [
270291
":libzmq_headers_only",
271-
":platform",
272-
],
292+
] + select({
293+
":linux": [
294+
":platform_linux",
295+
],
296+
":mac": [
297+
":platform_mac",
298+
],
299+
}),
273300
)

MODULE.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ module(
99
version = "4.3.5.bcr.2",
1010
compatibility_level = 4,
1111
)
12+
13+
bazel_dep(name = "platforms", version = "0.0.10")

MODULE.bazel.lock

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

linux/platform.hpp

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
#ifndef __ZMQ_PLATFORM_HPP_INCLUDED__
2+
#define __ZMQ_PLATFORM_HPP_INCLUDED__
3+
4+
#define ZMQ_USE_CV_IMPL_STL11
5+
/* #undef ZMQ_USE_CV_IMPL_WIN32API */
6+
/* #undef ZMQ_USE_CV_IMPL_PTHREADS */
7+
/* #undef ZMQ_USE_CV_IMPL_NONE */
8+
9+
/* #undef ZMQ_IOTHREAD_POLLER_USE_KQUEUE */
10+
#define ZMQ_IOTHREAD_POLLER_USE_EPOLL
11+
#define ZMQ_IOTHREAD_POLLER_USE_EPOLL_CLOEXEC
12+
/* #undef ZMQ_IOTHREAD_POLLER_USE_DEVPOLL */
13+
/* #undef ZMQ_IOTHREAD_POLLER_USE_POLLSET */
14+
/* #undef ZMQ_IOTHREAD_POLLER_USE_POLL */
15+
/* #undef ZMQ_IOTHREAD_POLLER_USE_SELECT */
16+
#define ZMQ_HAVE_PPOLL
17+
18+
/* #undef ZMQ_POLL_BASED_ON_SELECT */
19+
#define ZMQ_POLL_BASED_ON_POLL
20+
21+
#define HAVE_POSIX_MEMALIGN 1
22+
#define ZMQ_CACHELINE_SIZE 64
23+
24+
/* #undef ZMQ_FORCE_MUTEXES */
25+
26+
#define HAVE_FORK
27+
#define HAVE_CLOCK_GETTIME
28+
/* #undef HAVE_GETHRTIME */
29+
#define HAVE_MKDTEMP
30+
#define ZMQ_HAVE_UIO
31+
32+
#define ZMQ_HAVE_NOEXCEPT
33+
34+
#define ZMQ_HAVE_EVENTFD
35+
#define ZMQ_HAVE_EVENTFD_CLOEXEC
36+
#define ZMQ_HAVE_IFADDRS
37+
#define ZMQ_HAVE_SO_BINDTODEVICE
38+
39+
#define ZMQ_HAVE_SO_PEERCRED
40+
/* #undef ZMQ_HAVE_LOCAL_PEERCRED */
41+
#define ZMQ_HAVE_BUSY_POLL
42+
43+
#define ZMQ_HAVE_O_CLOEXEC
44+
45+
#define ZMQ_HAVE_SOCK_CLOEXEC
46+
#define ZMQ_HAVE_SO_KEEPALIVE
47+
#define ZMQ_HAVE_SO_PRIORITY
48+
#define ZMQ_HAVE_TCP_KEEPCNT
49+
#define ZMQ_HAVE_TCP_KEEPIDLE
50+
#define ZMQ_HAVE_TCP_KEEPINTVL
51+
/* #undef ZMQ_HAVE_TCP_KEEPALIVE */
52+
/* #undef ZMQ_HAVE_PTHREAD_SETNAME_1 */
53+
#define ZMQ_HAVE_PTHREAD_SETNAME_2
54+
/* #undef ZMQ_HAVE_PTHREAD_SETNAME_3 */
55+
/* #undef ZMQ_HAVE_PTHREAD_SET_NAME */
56+
#define ZMQ_HAVE_PTHREAD_SET_AFFINITY
57+
#define HAVE_ACCEPT4
58+
#define HAVE_STRNLEN
59+
/* #undef ZMQ_HAVE_STRLCPY */
60+
#define ZMQ_HAVE_LIBBSD
61+
62+
#define ZMQ_HAVE_IPC
63+
#define ZMQ_HAVE_STRUCT_SOCKADDR_UN
64+
65+
#define ZMQ_USE_BUILTIN_SHA1
66+
/* #undef ZMQ_USE_NSS */
67+
#define ZMQ_HAVE_WS
68+
/* #undef ZMQ_HAVE_WSS */
69+
#define ZMQ_HAVE_TIPC
70+
71+
/* #undef ZMQ_HAVE_OPENPGM */
72+
/* #undef ZMQ_HAVE_NORM */
73+
/* #undef ZMQ_HAVE_VMCI */
74+
75+
/* #undef ZMQ_MAKE_VALGRIND_HAPPY */
76+
77+
/* #undef ZMQ_HAVE_CURVE */
78+
/* #undef ZMQ_USE_LIBSODIUM */
79+
/* #undef SODIUM_STATIC */
80+
/* #undef HAVE_LIBGSSAPI_KRB5 */
81+
/* #undef ZMQ_USE_GNUTLS */
82+
#define ZMQ_USE_RADIX_TREE
83+
#define HAVE_IF_NAMETOINDEX
84+
85+
#ifdef _AIX
86+
#define ZMQ_HAVE_AIX
87+
#endif
88+
89+
#if defined __ANDROID__
90+
#define ZMQ_HAVE_ANDROID
91+
#endif
92+
93+
#if defined __CYGWIN__
94+
#define ZMQ_HAVE_CYGWIN
95+
#endif
96+
97+
#if defined __MINGW32__
98+
#define ZMQ_HAVE_MINGW32
99+
#endif
100+
101+
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
102+
#define ZMQ_HAVE_FREEBSD
103+
#endif
104+
105+
#if defined(__DragonFly__)
106+
#define ZMQ_HAVE_FREEBSD
107+
#define ZMQ_HAVE_DRAGONFLY
108+
#endif
109+
110+
#if defined __hpux
111+
#define ZMQ_HAVE_HPUX
112+
#endif
113+
114+
#if defined __linux__
115+
#define ZMQ_HAVE_LINUX
116+
#endif
117+
118+
#if defined __NetBSD__
119+
#define ZMQ_HAVE_NETBSD
120+
#endif
121+
122+
#if defined __OpenBSD__
123+
#define ZMQ_HAVE_OPENBSD
124+
#endif
125+
126+
// TODO better move OS-specific defines to the automake files, and check for availability of IPC with an explicit test there
127+
#if defined __VMS
128+
#define ZMQ_HAVE_OPENVMS
129+
#undef ZMQ_HAVE_IPC
130+
#endif
131+
132+
#if defined __APPLE__
133+
#define ZMQ_HAVE_OSX
134+
#endif
135+
136+
#if defined __QNXNTO__
137+
#define ZMQ_HAVE_QNXNTO
138+
#endif
139+
140+
#if defined(sun) || defined(__sun)
141+
#define ZMQ_HAVE_SOLARIS
142+
#endif
143+
144+
/* #undef ZMQ_HAVE_WINDOWS */
145+
/* #undef ZMQ_HAVE_WINDOWS_UWP */
146+
147+
#endif

platform.hpp mac/platform.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
#define ZMQ_USE_BUILTIN_SHA1
6666
/* #undef ZMQ_USE_NSS */
67-
/* #undef ZMQ_HAVE_WS */
67+
#define ZMQ_HAVE_WS
6868
/* #undef ZMQ_HAVE_WSS */
6969
/* #undef ZMQ_HAVE_TIPC */
7070

@@ -79,7 +79,7 @@
7979
/* #undef SODIUM_STATIC */
8080
/* #undef HAVE_LIBGSSAPI_KRB5 */
8181
/* #undef ZMQ_USE_GNUTLS */
82-
/* #undef ZMQ_USE_RADIX_TREE */
82+
#define ZMQ_USE_RADIX_TREE
8383
#define HAVE_IF_NAMETOINDEX
8484

8585
#ifdef _AIX

0 commit comments

Comments
 (0)