Skip to content

Commit

Permalink
Select os.
Browse files Browse the repository at this point in the history
  • Loading branch information
BYVoid committed Aug 6, 2024
1 parent dd8e1a7 commit 512b1d8
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 8 deletions.
35 changes: 31 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
config_setting(
name = "linux",
constraint_values = [
"@platforms//os:linux",
],
)

config_setting(
name = "mac",
constraint_values = [
"@platforms//os:osx",
],
)

cc_library(
name = "libzmq_headers_only",
hdrs = [
Expand All @@ -9,8 +23,15 @@ cc_library(
)

cc_library(
name = "platform",
hdrs = ["platform.hpp"],
name = "platform_mac",
hdrs = ["mac/platform.hpp"],
strip_include_prefix = "mac",
)

cc_library(
name = "platform_linux",
hdrs = ["linux/platform.hpp"],
strip_include_prefix = "linux",
)

cc_library(
Expand Down Expand Up @@ -268,6 +289,12 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
":libzmq_headers_only",
":platform",
],
] + select({
":linux": [
":platform_linux",
],
":mac": [
":platform_mac",
],
}),
)
2 changes: 2 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ module(
version = "4.3.5.bcr.2",
compatibility_level = 4,
)

bazel_dep(name = "platforms", version = "0.0.10")
5 changes: 3 additions & 2 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

147 changes: 147 additions & 0 deletions linux/platform.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
#ifndef __ZMQ_PLATFORM_HPP_INCLUDED__
#define __ZMQ_PLATFORM_HPP_INCLUDED__

#define ZMQ_USE_CV_IMPL_STL11
/* #undef ZMQ_USE_CV_IMPL_WIN32API */
/* #undef ZMQ_USE_CV_IMPL_PTHREADS */
/* #undef ZMQ_USE_CV_IMPL_NONE */

/* #undef ZMQ_IOTHREAD_POLLER_USE_KQUEUE */
#define ZMQ_IOTHREAD_POLLER_USE_EPOLL
#define ZMQ_IOTHREAD_POLLER_USE_EPOLL_CLOEXEC
/* #undef ZMQ_IOTHREAD_POLLER_USE_DEVPOLL */
/* #undef ZMQ_IOTHREAD_POLLER_USE_POLLSET */
/* #undef ZMQ_IOTHREAD_POLLER_USE_POLL */
/* #undef ZMQ_IOTHREAD_POLLER_USE_SELECT */
#define ZMQ_HAVE_PPOLL

/* #undef ZMQ_POLL_BASED_ON_SELECT */
#define ZMQ_POLL_BASED_ON_POLL

#define HAVE_POSIX_MEMALIGN 1
#define ZMQ_CACHELINE_SIZE 64

/* #undef ZMQ_FORCE_MUTEXES */

#define HAVE_FORK
#define HAVE_CLOCK_GETTIME
/* #undef HAVE_GETHRTIME */
#define HAVE_MKDTEMP
#define ZMQ_HAVE_UIO

#define ZMQ_HAVE_NOEXCEPT

#define ZMQ_HAVE_EVENTFD
#define ZMQ_HAVE_EVENTFD_CLOEXEC
#define ZMQ_HAVE_IFADDRS
#define ZMQ_HAVE_SO_BINDTODEVICE

#define ZMQ_HAVE_SO_PEERCRED
/* #undef ZMQ_HAVE_LOCAL_PEERCRED */
#define ZMQ_HAVE_BUSY_POLL

#define ZMQ_HAVE_O_CLOEXEC

#define ZMQ_HAVE_SOCK_CLOEXEC
#define ZMQ_HAVE_SO_KEEPALIVE
#define ZMQ_HAVE_SO_PRIORITY
#define ZMQ_HAVE_TCP_KEEPCNT
#define ZMQ_HAVE_TCP_KEEPIDLE
#define ZMQ_HAVE_TCP_KEEPINTVL
/* #undef ZMQ_HAVE_TCP_KEEPALIVE */
/* #undef ZMQ_HAVE_PTHREAD_SETNAME_1 */
#define ZMQ_HAVE_PTHREAD_SETNAME_2
/* #undef ZMQ_HAVE_PTHREAD_SETNAME_3 */
/* #undef ZMQ_HAVE_PTHREAD_SET_NAME */
#define ZMQ_HAVE_PTHREAD_SET_AFFINITY
#define HAVE_ACCEPT4
#define HAVE_STRNLEN
/* #undef ZMQ_HAVE_STRLCPY */
#define ZMQ_HAVE_LIBBSD

#define ZMQ_HAVE_IPC
#define ZMQ_HAVE_STRUCT_SOCKADDR_UN

#define ZMQ_USE_BUILTIN_SHA1
/* #undef ZMQ_USE_NSS */
#define ZMQ_HAVE_WS
/* #undef ZMQ_HAVE_WSS */
#define ZMQ_HAVE_TIPC

/* #undef ZMQ_HAVE_OPENPGM */
/* #undef ZMQ_HAVE_NORM */
/* #undef ZMQ_HAVE_VMCI */

/* #undef ZMQ_MAKE_VALGRIND_HAPPY */

/* #undef ZMQ_HAVE_CURVE */
/* #undef ZMQ_USE_LIBSODIUM */
/* #undef SODIUM_STATIC */
/* #undef HAVE_LIBGSSAPI_KRB5 */
/* #undef ZMQ_USE_GNUTLS */
#define ZMQ_USE_RADIX_TREE
#define HAVE_IF_NAMETOINDEX

#ifdef _AIX
#define ZMQ_HAVE_AIX
#endif

#if defined __ANDROID__
#define ZMQ_HAVE_ANDROID
#endif

#if defined __CYGWIN__
#define ZMQ_HAVE_CYGWIN
#endif

#if defined __MINGW32__
#define ZMQ_HAVE_MINGW32
#endif

#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#define ZMQ_HAVE_FREEBSD
#endif

#if defined(__DragonFly__)
#define ZMQ_HAVE_FREEBSD
#define ZMQ_HAVE_DRAGONFLY
#endif

#if defined __hpux
#define ZMQ_HAVE_HPUX
#endif

#if defined __linux__
#define ZMQ_HAVE_LINUX
#endif

#if defined __NetBSD__
#define ZMQ_HAVE_NETBSD
#endif

#if defined __OpenBSD__
#define ZMQ_HAVE_OPENBSD
#endif

// TODO better move OS-specific defines to the automake files, and check for availability of IPC with an explicit test there
#if defined __VMS
#define ZMQ_HAVE_OPENVMS
#undef ZMQ_HAVE_IPC
#endif

#if defined __APPLE__
#define ZMQ_HAVE_OSX
#endif

#if defined __QNXNTO__
#define ZMQ_HAVE_QNXNTO
#endif

#if defined(sun) || defined(__sun)
#define ZMQ_HAVE_SOLARIS
#endif

/* #undef ZMQ_HAVE_WINDOWS */
/* #undef ZMQ_HAVE_WINDOWS_UWP */

#endif
4 changes: 2 additions & 2 deletions platform.hpp → mac/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

#define ZMQ_USE_BUILTIN_SHA1
/* #undef ZMQ_USE_NSS */
/* #undef ZMQ_HAVE_WS */
#define ZMQ_HAVE_WS
/* #undef ZMQ_HAVE_WSS */
/* #undef ZMQ_HAVE_TIPC */

Expand All @@ -79,7 +79,7 @@
/* #undef SODIUM_STATIC */
/* #undef HAVE_LIBGSSAPI_KRB5 */
/* #undef ZMQ_USE_GNUTLS */
/* #undef ZMQ_USE_RADIX_TREE */
#define ZMQ_USE_RADIX_TREE
#define HAVE_IF_NAMETOINDEX

#ifdef _AIX
Expand Down

0 comments on commit 512b1d8

Please sign in to comment.