mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 07:07:13 +02:00
Initial ZMQ bindings.
This commit is contained in:
41
vendor/ZMQ/builds/cmake/Modules/ClangFormat.cmake
vendored
Normal file
41
vendor/ZMQ/builds/cmake/Modules/ClangFormat.cmake
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
# additional target to perform clang-format run, requires clang-format
|
||||
|
||||
# get all project files
|
||||
file(GLOB_RECURSE ALL_SOURCE_FILES
|
||||
RELATIVE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/src/*.cpp ${CMAKE_SOURCE_DIR}/src/*.h ${CMAKE_SOURCE_DIR}/src/*.hpp
|
||||
${CMAKE_SOURCE_DIR}/tests/*.cpp ${CMAKE_SOURCE_DIR}/tests/*.h ${CMAKE_SOURCE_DIR}/tests/*.hpp
|
||||
${CMAKE_SOURCE_DIR}/perf/*.cpp ${CMAKE_SOURCE_DIR}/perf/*.h ${CMAKE_SOURCE_DIR}/perf/*.hpp
|
||||
${CMAKE_SOURCE_DIR}/tools/*.cpp ${CMAKE_SOURCE_DIR}/tools/*.h ${CMAKE_SOURCE_DIR}/tools/*.hpp
|
||||
${CMAKE_SOURCE_DIR}/include/*.h
|
||||
)
|
||||
|
||||
if("${CLANG_FORMAT}" STREQUAL "")
|
||||
set(CLANG_FORMAT "clang-format")
|
||||
endif()
|
||||
|
||||
add_custom_target(
|
||||
clang-format
|
||||
COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES}
|
||||
)
|
||||
|
||||
function(JOIN VALUES GLUE OUTPUT)
|
||||
string (REPLACE ";" "${GLUE}" _TMP_STR "${VALUES}")
|
||||
set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
configure_file(builds/cmake/clang-format-check.sh.in clang-format-check.sh @ONLY)
|
||||
|
||||
add_custom_target(
|
||||
clang-format-check
|
||||
COMMAND chmod +x clang-format-check.sh
|
||||
COMMAND ./clang-format-check.sh
|
||||
COMMENT "Checking correct formatting according to .clang-format file using ${CLANG_FORMAT}"
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
clang-format-diff
|
||||
COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES}
|
||||
COMMAND git diff ${ALL_SOURCE_FILES}
|
||||
COMMENT "Formatting with clang-format (using ${CLANG_FORMAT}) and showing differences with latest commit"
|
||||
)
|
26
vendor/ZMQ/builds/cmake/Modules/FindAsciiDoc.cmake
vendored
Normal file
26
vendor/ZMQ/builds/cmake/Modules/FindAsciiDoc.cmake
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
# - Find Asciidoc
|
||||
# this module looks for asciidoc and a2x
|
||||
#
|
||||
# ASCIIDOC_EXECUTABLE - the full path to asciidoc
|
||||
# ASCIIDOC_FOUND - If false, don't attempt to use asciidoc.
|
||||
# A2X_EXECUTABLE - the full path to a2x
|
||||
# A2X_FOUND - If false, don't attempt to use a2x.
|
||||
|
||||
set (PROGRAMFILESX86 "PROGRAMFILES(X86)")
|
||||
|
||||
find_program(ASCIIDOC_EXECUTABLE asciidoc asciidoc.py
|
||||
PATHS "$ENV{ASCIIDOC_ROOT}"
|
||||
"$ENV{PROGRAMW6432}/asciidoc"
|
||||
"$ENV{PROGRAMFILES}/asciidoc"
|
||||
"$ENV{${PROGRAMFILESX86}}/asciidoc")
|
||||
|
||||
find_program(A2X_EXECUTABLE a2x
|
||||
PATHS "$ENV{ASCIIDOC_ROOT}"
|
||||
"$ENV{PROGRAMW6432}/asciidoc"
|
||||
"$ENV{PROGRAMFILES}/asciidoc"
|
||||
"$ENV{${PROGRAMFILESX86}}/asciidoc")
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_ARGS(AsciiDoc REQUIRED_VARS ASCIIDOC_EXECUTABLE)
|
||||
mark_as_advanced(ASCIIDOC_EXECUTABLE A2X_EXECUTABLE)
|
8
vendor/ZMQ/builds/cmake/Modules/FindNSS3.cmake
vendored
Normal file
8
vendor/ZMQ/builds/cmake/Modules/FindNSS3.cmake
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if (NOT MSVC)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(NSS3 "nss>=3.19")
|
||||
find_package_handle_standard_args(NSS3 DEFAULT_MSG NSS3_LIBRARIES NSS3_CFLAGS)
|
||||
endif()
|
||||
|
48
vendor/ZMQ/builds/cmake/Modules/FindSodium.cmake
vendored
Normal file
48
vendor/ZMQ/builds/cmake/Modules/FindSodium.cmake
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
################################################################################
|
||||
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
||||
# Please refer to the README for information about making permanent changes. #
|
||||
################################################################################
|
||||
|
||||
if (NOT MSVC)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(PC_SODIUM "libsodium")
|
||||
if (PC_SODIUM_FOUND)
|
||||
set(pkg_config_names_private "${pkg_config_names_private} libsodium")
|
||||
endif()
|
||||
if (NOT PC_SODIUM_FOUND)
|
||||
pkg_check_modules(PC_SODIUM "sodium")
|
||||
if (PC_SODIUM_FOUND)
|
||||
set(pkg_config_names_private "${pkg_config_names_private} sodium")
|
||||
endif()
|
||||
endif (NOT PC_SODIUM_FOUND)
|
||||
if (PC_SODIUM_FOUND)
|
||||
set(SODIUM_INCLUDE_HINTS ${PC_SODIUM_INCLUDE_DIRS} ${PC_SODIUM_INCLUDE_DIRS}/*)
|
||||
set(SODIUM_LIBRARY_HINTS ${PC_SODIUM_LIBRARY_DIRS} ${PC_SODIUM_LIBRARY_DIRS}/*)
|
||||
else()
|
||||
set(pkg_config_libs_private "${pkg_config_libs_private} -lsodium")
|
||||
endif()
|
||||
endif (NOT MSVC)
|
||||
|
||||
# some libraries install the headers is a subdirectory of the include dir
|
||||
# returned by pkg-config, so use a wildcard match to improve chances of finding
|
||||
# headers and libraries.
|
||||
find_path(
|
||||
SODIUM_INCLUDE_DIRS
|
||||
NAMES sodium.h
|
||||
HINTS ${SODIUM_INCLUDE_HINTS}
|
||||
)
|
||||
|
||||
find_library(
|
||||
SODIUM_LIBRARIES
|
||||
NAMES libsodium sodium
|
||||
HINTS ${SODIUM_LIBRARY_HINTS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(sodium DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
|
||||
mark_as_advanced(SODIUM_FOUND SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
|
||||
|
||||
################################################################################
|
||||
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
||||
# Please refer to the README for information about making permanent changes. #
|
||||
################################################################################
|
8
vendor/ZMQ/builds/cmake/Modules/TestZMQVersion.cmake
vendored
Normal file
8
vendor/ZMQ/builds/cmake/Modules/TestZMQVersion.cmake
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
file(READ "${PROJECT_SOURCE_DIR}/include/zmq.h" _ZMQ_H_CONTENTS)
|
||||
string(REGEX REPLACE ".*#define ZMQ_VERSION_MAJOR ([0-9]+).*" "\\1" ZMQ_VERSION_MAJOR "${_ZMQ_H_CONTENTS}")
|
||||
string(REGEX REPLACE ".*#define ZMQ_VERSION_MINOR ([0-9]+).*" "\\1" ZMQ_VERSION_MINOR "${_ZMQ_H_CONTENTS}")
|
||||
string(REGEX REPLACE ".*#define ZMQ_VERSION_PATCH ([0-9]+).*" "\\1" ZMQ_VERSION_PATCH "${_ZMQ_H_CONTENTS}")
|
||||
set(ZMQ_VERSION "${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}")
|
||||
|
||||
message(STATUS "Detected ZMQ Version - ${ZMQ_VERSION}")
|
332
vendor/ZMQ/builds/cmake/Modules/ZMQSourceRunChecks.cmake
vendored
Normal file
332
vendor/ZMQ/builds/cmake/Modules/ZMQSourceRunChecks.cmake
vendored
Normal file
@ -0,0 +1,332 @@
|
||||
|
||||
|
||||
macro(zmq_check_sock_cloexec)
|
||||
message(STATUS "Checking whether SOCK_CLOEXEC is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
int s = socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
return(s == -1);
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_SOCK_CLOEXEC)
|
||||
endmacro()
|
||||
|
||||
macro(zmq_check_efd_cloexec)
|
||||
message(STATUS "Checking whether EFD_CLOEXEC is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/eventfd.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
int s = eventfd (0, EFD_CLOEXEC);
|
||||
return(s == -1);
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_EVENTFD_CLOEXEC)
|
||||
endmacro()
|
||||
|
||||
macro(zmq_check_o_cloexec)
|
||||
message(STATUS "Checking whether O_CLOEXEC is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
int s = open (\"/dev/null\", O_CLOEXEC | O_RDONLY);
|
||||
return s == -1;
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_O_CLOEXEC)
|
||||
endmacro()
|
||||
|
||||
macro(zmq_check_so_bindtodevice)
|
||||
message(STATUS "Checking whether SO_BINDTODEVICE is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/socket.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
/* Actually making the setsockopt() call requires CAP_NET_RAW */
|
||||
#ifndef SO_BINDTODEVICE
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_SO_BINDTODEVICE)
|
||||
endmacro()
|
||||
|
||||
# TCP keep-alives Checks.
|
||||
|
||||
macro(zmq_check_so_keepalive)
|
||||
message(STATUS "Checking whether SO_KEEPALIVE is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
int s, rc, opt = 1;
|
||||
return(
|
||||
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
|
||||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1)
|
||||
);
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_SO_KEEPALIVE)
|
||||
endmacro()
|
||||
|
||||
macro(zmq_check_tcp_keepcnt)
|
||||
message(STATUS "Checking whether TCP_KEEPCNT is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
int s, rc, opt = 1;
|
||||
return(
|
||||
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
|
||||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
|
||||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPCNT,(char*) &opt, sizeof(int))) == -1)
|
||||
);
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_TCP_KEEPCNT)
|
||||
endmacro()
|
||||
|
||||
macro(zmq_check_tcp_keepidle)
|
||||
message(STATUS "Checking whether TCP_KEEPIDLE is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
int s, rc, opt = 1;
|
||||
return(
|
||||
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
|
||||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
|
||||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPIDLE,(char*) &opt, sizeof(int))) == -1)
|
||||
);
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_TCP_KEEPIDLE)
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(zmq_check_tcp_keepintvl)
|
||||
message(STATUS "Checking whether TCP_KEEPINTVL is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
int s, rc, opt = 1;
|
||||
return(
|
||||
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
|
||||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
|
||||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPINTVL,(char*) &opt, sizeof(int))) == -1)
|
||||
);
|
||||
}
|
||||
|
||||
"
|
||||
ZMQ_HAVE_TCP_KEEPINTVL)
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(zmq_check_tcp_keepalive)
|
||||
message(STATUS "Checking whether TCP_KEEPALIVE is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
int s, rc, opt = 1;
|
||||
return(
|
||||
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
|
||||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
|
||||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPALIVE,(char*) &opt, sizeof(int))) == -1)
|
||||
);
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_TCP_KEEPALIVE)
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(zmq_check_tcp_tipc)
|
||||
message(STATUS "Checking whether TIPC is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/tipc.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
struct sockaddr_tipc topsrv;
|
||||
int sd = socket(AF_TIPC, SOCK_SEQPACKET, 0);
|
||||
memset(&topsrv, 0, sizeof(topsrv));
|
||||
topsrv.family = AF_TIPC;
|
||||
topsrv.addrtype = TIPC_ADDR_NAME;
|
||||
topsrv.addr.name.name.type = TIPC_TOP_SRV;
|
||||
topsrv.addr.name.name.instance = TIPC_TOP_SRV;
|
||||
fcntl(sd, F_SETFL, O_NONBLOCK);
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_TIPC)
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(zmq_check_pthread_setname)
|
||||
message(STATUS "Checking pthread_setname signature")
|
||||
set(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS "-D_GNU_SOURCE -Werror -pthread")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <pthread.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
pthread_setname_np (\"foo\");
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_PTHREAD_SETNAME_1)
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <pthread.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
pthread_setname_np (pthread_self(), \"foo\");
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_PTHREAD_SETNAME_2)
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <pthread.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
pthread_setname_np (pthread_self(), \"foo\", (void *)0);
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_PTHREAD_SETNAME_3)
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <pthread.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
pthread_set_name_np (pthread_self(), \"foo\");
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_PTHREAD_SET_NAME)
|
||||
set(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS})
|
||||
endmacro()
|
||||
|
||||
macro(zmq_check_pthread_setaffinity)
|
||||
message(STATUS "Checking pthread_setaffinity signature")
|
||||
set(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS "-D_GNU_SOURCE -Werror -pthread")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <pthread.h>
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
cpu_set_t test;
|
||||
pthread_setaffinity_np (pthread_self(), sizeof(cpu_set_t), &test);
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_PTHREAD_SET_AFFINITY)
|
||||
set(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS})
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(zmq_check_getrandom)
|
||||
message(STATUS "Checking whether getrandom is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/random.h>
|
||||
|
||||
int main (int argc, char *argv [])
|
||||
{
|
||||
char buf[4];
|
||||
int rc = getrandom(buf, 4, 0);
|
||||
return rc == -1 ? 1 : 0;
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_GETRANDOM)
|
||||
endmacro()
|
||||
|
||||
macro(zmq_check_noexcept)
|
||||
message(STATUS "Checking whether noexcept is supported")
|
||||
check_cxx_source_compiles(
|
||||
"
|
||||
struct X
|
||||
{
|
||||
X(int i) noexcept {}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv [])
|
||||
{
|
||||
X x(5);
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_NOEXCEPT)
|
||||
endmacro()
|
||||
|
||||
macro(zmq_check_so_priority)
|
||||
message(STATUS "Checking whether SO_PRIORITY is supported")
|
||||
check_c_source_runs(
|
||||
"
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int main (int argc, char *argv [])
|
||||
{
|
||||
int s, rc, opt = 1;
|
||||
return (
|
||||
((s = socket (PF_INET, SOCK_STREAM, 0)) == -1) ||
|
||||
((rc = setsockopt (s, SOL_SOCKET, SO_PRIORITY, (char*) &opt, sizeof (int))) == -1)
|
||||
);
|
||||
}
|
||||
"
|
||||
ZMQ_HAVE_SO_PRIORITY)
|
||||
endmacro()
|
5
vendor/ZMQ/builds/cmake/Modules/ZMQSupportMacros.cmake
vendored
Normal file
5
vendor/ZMQ/builds/cmake/Modules/ZMQSupportMacros.cmake
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
macro (zmq_set_with_default var value)
|
||||
if (NOT ${var})
|
||||
set(${var} "${value}")
|
||||
endif ()
|
||||
endmacro ()
|
Reference in New Issue
Block a user