Unverified Commit 718ad8ab authored by grmt's avatar grmt Committed by GitHub

add wss transport and fix tipc tests when building using cmake on linux (#3857)

* Allow CMAKE to generate ws and wss transports
I guess there is little use of just ws transport, so by default
GnuTLS (and libsodium) are enabled

* cmake libzmq including wss transport (ubuntu 19.10 and ubuntu 19.10 + wsl 1.0)
test_security_fails (libsodium assert !?)

* updated relicense

* make external libs gnutls nss sodium optional

* #ifdef WSS classes and functions, build test*ws* only if correct libs are included, warning if libs not present

* make libsodium optional

* cmake fix tests TIPC transport

* clang-format pointed out a wrongly placed #ifdef

* GnuTLS before 3.6.7 is not safe

* msvc doesn't agree with strlen in array declaration, test_socks now at least compiles on windows

* windows: libsodium build fails, missing include dirs set by env var

* ws transport test only works when GnuTLS is found

* Fixed condition to use NSS / built in SHA1, so that test_ws_transport should now pass, also when GnuTLS is not found
parent 7276b680
......@@ -26,6 +26,8 @@ build/
builds/android/prefix
## IntelliJ
.idea/
## Visual Code
.vscode/
## other results-like folders
bin/
lib/
......
......@@ -35,18 +35,21 @@ option(ENABLE_ASAN "Build with address sanitizer" OFF)
if(ENABLE_ASAN)
message(STATUS "Instrumenting with Address Sanitizer")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope")
endif()
option (ENABLE_INTRINSICS "Build using compiler intrinsics for atomic ops" OFF)
if (ENABLE_INTRINSICS)
message(STATUS "Using compiler intrinsics for atomic ops")
add_definitions(-DZMQ_HAVE_ATOMIC_INTRINSICS)
option(ENABLE_INTRINSICS "Build using compiler intrinsics for atomic ops" OFF)
if(ENABLE_INTRINSICS)
message(STATUS "Using compiler intrinsics for atomic ops")
add_definitions(-DZMQ_HAVE_ATOMIC_INTRINSICS)
endif()
set (ZMQ_OUTPUT_BASENAME "zmq" CACHE STRING "Output zmq library base name")
set(ZMQ_OUTPUT_BASENAME
"zmq"
CACHE STRING "Output zmq library base name")
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
# Find more information: https://cmake.org/Wiki/CMake_RPATH_handling
......@@ -64,18 +67,18 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
check_cxx_compiler_flag("-std=gnu++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif()
check_c_compiler_flag("-std=gnu11" COMPILER_SUPPORTS_C11)
if(COMPILER_SUPPORTS_C11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
endif()
if (NOT MSVC)
check_cxx_compiler_flag("-std=gnu++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif()
check_c_compiler_flag("-std=gnu11" COMPILER_SUPPORTS_C11)
if(COMPILER_SUPPORTS_C11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
endif()
if(NOT MSVC)
# clang 6 has a warning that does not make sense on multi-platform code
check_cxx_compiler_flag("-Wno-tautological-constant-compare" CXX_HAS_TAUT_WARNING)
if(CXX_HAS_TAUT_WARNING)
......@@ -98,192 +101,229 @@ if(APPLE)
option(ZMQ_BUILD_FRAMEWORK "Build as OS X framework" OFF)
endif()
# Enable webSocket transport
if (ENABLE_DRAFTS)
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
message(STATUS "Build and install draft classes and methods")
option(ENABLE_DRAFTS "Build and install draft classes and methods" ON)
else()
message(STATUS "Not building draft classes and methods")
option(ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
endif()
# Enable WebSocket transport and RadixTree
if(ENABLE_DRAFTS)
set(ZMQ_BUILD_DRAFT_API 1)
option(ENABLE_WS "Enable WebSocket transport" ON)
option(ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" ON)
else()
option(ENABLE_WS "Enable WebSocket transport" OFF)
endif()
option(WITH_NSS "Use NSS instead of builtin sha1" OFF)
if (ENABLE_WS)
list(APPEND sources
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_address.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/wss_address.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_connecter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_decoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_encoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_engine.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_listener.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_address.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/wss_address.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_connecter.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_decoder.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_encoder.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_engine.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_listener.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_protocol.hpp)
option(ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" OFF)
endif()
if(ENABLE_RADIX_TREE)
message(STATUS "Using radix tree implementation to manage subscriptions")
set(ZMQ_USE_RADIX_TREE 1)
endif()
if(ENABLE_WS)
list(
APPEND
sources
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_address.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_connecter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_decoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_encoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_engine.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_listener.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_address.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_connecter.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_decoder.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_encoder.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_engine.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_listener.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/ws_protocol.hpp)
set(ZMQ_HAVE_WS 1)
if (WITH_NSS)
message(STATUS "Enable WebSocket transport")
option(WITH_TLS "Use TLS for WSS support" ON)
option(WITH_NSS "Use NSS instead of builtin sha1" OFF)
if(WITH_TLS)
find_package("GnuTLS" 3.6.7)
if(GNUTLS_FOUND)
set(pkg_config_names_private "${pkg_config_names_private} gnutls")
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/wss_address.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/wss_address.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/wss_engine.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/wss_engine.cpp)
message(STATUS "Enable WSS transport")
set(ZMQ_USE_GNUTLS 1)
set(ZMQ_HAVE_WSS 1)
else()
message(WARNING "No WSS support, you may want to install GnuTLS and run cmake again")
endif()
endif()
endif()
if(NOT ZMQ_USE_GNUTLS)
if(WITH_NSS)
pkg_check_modules(NSS3 "nss")
if (NSS3_FOUND)
if(NSS3_FOUND)
set(pkg_config_names_private "${pkg_config_names_private} nss")
message(STATUS "Using NSS")
set(ZMQ_USE_NSS 1)
else()
find_package("NSS3")
if (NSS3_FOUND)
if(NSS3_FOUND)
set(pkg_config_libs_private "${pkg_config_libs_private} -lnss3")
message(STATUS "Using NSS")
set(ZMQ_USE_NSS 1)
else()
message(FATAL_ERROR
"nss is not installed. Install it, then run CMake again")
message(WARNING "No nss installed, if you don't want builtin SHA1, install NSS or GnuTLS")
endif()
endif()
message(STATUS "Using NSS")
include_directories(${NSS3_INCLUDE_DIRS})
link_directories(${NSS3_LIBRARY_DIRS})
set(OPTIONAL_LIBRARIES ${NSS3_LIBRARIES})
set(ZMQ_USE_NSS 1)
else()
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.c ${CMAKE_CURRENT_SOURCE_DIR}/external/sha1/sha1.h)
message("Using builtin sha1")
endif()
if(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")
set(ZMQ_USE_BUILTIN_SHA1 1)
endif()
endif()
if(NOT MSVC)
option(WITH_LIBBSD "Use libbsd instead of builtin strlcpy" ON)
if (WITH_LIBBSD)
if(WITH_LIBBSD)
pkg_check_modules(LIBBSD "libbsd")
if (LIBBSD_FOUND)
if(LIBBSD_FOUND)
message(STATUS "Using libbsd")
include_directories(${LIBBSD_INCLUDE_DIRS})
set(pkg_config_names_private "${pkg_config_names_private} libbsd")
set(ZMQ_HAVE_LIBBSD 1)
link_directories(${LIBBSD_LIBRARY_DIRS})
set(OPTIONAL_LIBRARIES ${LIBBSD_LIBRARIES})
endif()
endif()
if (NOT WITH_LIBBSD OR NOT LIBBSD_FOUND)
if(NOT WITH_LIBBSD OR NOT LIBBSD_FOUND)
check_cxx_symbol_exists(strlcpy string.h ZMQ_HAVE_STRLCPY)
endif()
endif()
# Select curve encryption library, defaults to tweetnacl To use libsodium instead, use --with-libsodium(must be
# installed) To disable curve, use --disable-curve
# Select curve encryption library, defaults to tweetnacl
# To use libsodium instead, use --with-libsodium(must be installed)
# To disable curve, use --disable-curve
option(WITH_LIBSODIUM "Use libsodium instead of built-in tweetnacl" OFF)
option(WITH_LIBSODIUM "Use libsodium instead of built-in tweetnacl" ON)
option(WITH_LIBSODIUM_STATIC "Use static libsodium library" OFF)
option(ENABLE_CURVE "Enable CURVE security" ON)
if(NOT ENABLE_CURVE)
message(STATUS "CURVE security is disabled")
elseif(WITH_LIBSODIUM)
find_package(Sodium)
if(SODIUM_FOUND)
message(STATUS "Using libsodium for CURVE security")
include_directories(${SODIUM_INCLUDE_DIRS})
if(WITH_LIBSODIUM_STATIC)
add_compile_definitions(SODIUM_STATIC)
if(ENABLE_CURVE)
if(WITH_LIBSODIUM)
find_package("Sodium")
if(SODIUM_FOUND)
message(STATUS "Using libsodium for CURVE security")
include_directories(${SODIUM_INCLUDE_DIRS})
if(WITH_LIBSODIUM_STATIC)
add_compile_definitions(SODIUM_STATIC)
endif()
set(ZMQ_USE_LIBSODIUM 1)
set(ZMQ_HAVE_CURVE 1)
else()
message(
WARNING
"libsodium not installed, instead using builtin tweetnacl, you may want to install libsodium and run cmake again"
)
endif()
set(ZMQ_USE_LIBSODIUM 1)
endif()
if(NOT ZMQ_HAVE_CURVE)
message(STATUS "Using tweetnacl for CURVE security")
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/tweetnacl.c)
set(ZMQ_USE_TWEETNACL 1)
set(ZMQ_HAVE_CURVE 1)
else()
message(FATAL_ERROR
"libsodium is not installed. Install it, then run CMake again")
endif()
else()
message(STATUS "Using tweetnacl for CURVE security")
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/tweetnacl.c)
set(ZMQ_USE_TWEETNACL 1)
set(ZMQ_HAVE_CURVE 1)
message(STATUS "CURVE security is disabled")
endif()
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
if(EXISTS "${SOURCE_DIR}/.git")
option(ENABLE_DRAFTS "Build and install draft classes and methods" ON)
else()
option(ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
endif()
if(ENABLE_DRAFTS)
option (ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" ON)
add_definitions(-DZMQ_BUILD_DRAFT_API)
set(pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1")
else()
option (ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" OFF)
set(pkg_config_defines "")
endif()
if (ENABLE_RADIX_TREE)
message(STATUS "Using radix tree implementation to manage subscriptions")
add_definitions(-DZMQ_USE_RADIX_TREE)
endif()
option(WITH_MILITANT "Enable militant assertions" OFF)
if(WITH_MILITANT)
add_definitions(-DZMQ_ACT_MILITANT)
endif()
set(API_POLLER "" CACHE STRING "Choose polling system for zmq_poll(er)_*. valid values are
set(API_POLLER
""
CACHE STRING "Choose polling system for zmq_poll(er)_*. valid values are
poll or select [default=poll unless POLLER=select]")
set(POLLER "" CACHE STRING "Choose polling system for I/O threads. valid values are
set(POLLER
""
CACHE STRING "Choose polling system for I/O threads. valid values are
kqueue, epoll, devpoll, pollset, poll or select [default=autodetect]")
if (WIN32)
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND CMAKE_SYSTEM_VERSION MATCHES "^10.0")
set(ZMQ_HAVE_WINDOWS_UWP ON)
set(ZMQ_HAVE_IPC OFF)
# to remove compile warninging "D9002 ignoring unknown option"
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} CACHE STRING "" FORCE)
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} CACHE STRING "" FORCE)
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
endif()
# from https://stackoverflow.com/a/40217291/2019765
macro(get_WIN32_WINNT version)
if (CMAKE_SYSTEM_VERSION)
set(ver ${CMAKE_SYSTEM_VERSION})
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
if ("${verMajor}" MATCHES "10")
set(verMajor "A")
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
endif ("${verMajor}" MATCHES "10")
# Remove all remaining '.' characters.
string(REPLACE "." "" ver ${ver})
# Prepend each digit with a zero.
string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
set(${version} "0x${ver}")
endif(CMAKE_SYSTEM_VERSION)
endmacro(get_WIN32_WINNT)
get_WIN32_WINNT(ZMQ_WIN32_WINNT_DEFAULT)
message(STATUS "Detected _WIN32_WINNT from CMAKE_SYSTEM_VERSION: ${ZMQ_WIN32_WINNT_DEFAULT}")
# TODO limit _WIN32_WINNT to the actual Windows SDK version, which might be different from the default version installed with Visual Studio
if(MSVC_VERSION STREQUAL "1500" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.0")
set(ZMQ_WIN32_WINNT_LIMIT "0x0600")
elseif(MSVC_VERSION STREQUAL "1600" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.1")
set(ZMQ_WIN32_WINNT_LIMIT "0x0601")
elseif(MSVC_VERSION STREQUAL "1700" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.1")
set(ZMQ_WIN32_WINNT_LIMIT "0x0601")
elseif(MSVC_VERSION STREQUAL "1800" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.2")
set(ZMQ_WIN32_WINNT_LIMIT "0x0602")
endif()
if(ZMQ_WIN32_WINNT_LIMIT)
message(STATUS "Mismatch of Visual Studio Version (${MSVC_VERSION}) and CMAKE_SYSTEM_VERSION (${CMAKE_SYSTEM_VERSION}), limiting _WIN32_WINNT to ${ZMQ_WIN32_WINNT_LIMIT}, you may override this by setting ZMQ_WIN32_WINNT")
set(ZMQ_WIN32_WINNT_DEFAULT "${ZMQ_WIN32_WINNT_LIMIT}")
endif()
set(ZMQ_WIN32_WINNT "${ZMQ_WIN32_WINNT_DEFAULT}" CACHE STRING "Value to set _WIN32_WINNT to for building [default=autodetect from build environment]")
if(WIN32)
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND CMAKE_SYSTEM_VERSION MATCHES "^10.0")
set(ZMQ_HAVE_WINDOWS_UWP ON)
set(ZMQ_HAVE_IPC OFF)
# to remove compile warninging "D9002 ignoring unknown option"
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS_DEBUG
${CMAKE_CXX_FLAGS_DEBUG}
CACHE STRING "" FORCE)
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
CACHE STRING "" FORCE)
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
endif()
# from https://stackoverflow.com/a/40217291/2019765
macro(get_WIN32_WINNT version)
if(CMAKE_SYSTEM_VERSION)
set(ver ${CMAKE_SYSTEM_VERSION})
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
if("${verMajor}" MATCHES "10")
set(verMajor "A")
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
endif("${verMajor}" MATCHES "10")
# Remove all remaining '.' characters.
string(REPLACE "." "" ver ${ver})
# Prepend each digit with a zero.
string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
set(${version} "0x${ver}")
endif(CMAKE_SYSTEM_VERSION)
endmacro(get_WIN32_WINNT)
get_win32_winnt(ZMQ_WIN32_WINNT_DEFAULT)
message(STATUS "Detected _WIN32_WINNT from CMAKE_SYSTEM_VERSION: ${ZMQ_WIN32_WINNT_DEFAULT}")
# TODO limit _WIN32_WINNT to the actual Windows SDK version, which might be different from the default version
# installed with Visual Studio
if(MSVC_VERSION STREQUAL "1500" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.0")
set(ZMQ_WIN32_WINNT_LIMIT "0x0600")
elseif(MSVC_VERSION STREQUAL "1600" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.1")
set(ZMQ_WIN32_WINNT_LIMIT "0x0601")
elseif(MSVC_VERSION STREQUAL "1700" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.1")
set(ZMQ_WIN32_WINNT_LIMIT "0x0601")
elseif(MSVC_VERSION STREQUAL "1800" AND CMAKE_SYSTEM_VERSION VERSION_GREATER "6.2")
set(ZMQ_WIN32_WINNT_LIMIT "0x0602")
endif()
if(ZMQ_WIN32_WINNT_LIMIT)
message(
STATUS
"Mismatch of Visual Studio Version (${MSVC_VERSION}) and CMAKE_SYSTEM_VERSION (${CMAKE_SYSTEM_VERSION}), limiting _WIN32_WINNT to ${ZMQ_WIN32_WINNT_LIMIT}, you may override this by setting ZMQ_WIN32_WINNT"
)
set(ZMQ_WIN32_WINNT_DEFAULT "${ZMQ_WIN32_WINNT_LIMIT}")
endif()
set(ZMQ_WIN32_WINNT
"${ZMQ_WIN32_WINNT_DEFAULT}"
CACHE STRING "Value to set _WIN32_WINNT to for building [default=autodetect from build environment]")
# On Windows Vista or greater, with MSVC 2013 or greater, default to epoll (which is required on Win 10 for ipc support)
if (ZMQ_WIN32_WINNT GREATER "0x05FF" AND MSVC_VERSION GREATER 1799 AND POLLER STREQUAL "" AND NOT ZMQ_HAVE_WINDOWS_UWP)
# On Windows Vista or greater, with MSVC 2013 or greater, default to epoll (which is required on Win 10 for ipc
# support)
if(ZMQ_WIN32_WINNT GREATER "0x05FF"
AND MSVC_VERSION GREATER 1799
AND POLLER STREQUAL ""
AND NOT ZMQ_HAVE_WINDOWS_UWP)
set(POLLER "epoll")
endif()
......@@ -342,17 +382,16 @@ if(POLLER STREQUAL "")
if(HAVE_SELECT)
set(POLLER "select")
else()
message(FATAL_ERROR
"Could not autodetect polling method")
message(FATAL_ERROR "Could not autodetect polling method")
endif()
endif()
if(POLLER STREQUAL "kqueue"
OR POLLER STREQUAL "epoll"
OR POLLER STREQUAL "devpoll"
OR POLLER STREQUAL "pollset"
OR POLLER STREQUAL "poll"
OR POLLER STREQUAL "select")
OR POLLER STREQUAL "epoll"
OR POLLER STREQUAL "devpoll"
OR POLLER STREQUAL "pollset"
OR POLLER STREQUAL "poll"
OR POLLER STREQUAL "select")
message(STATUS "Using polling method in I/O threads: ${POLLER}")
string(TOUPPER ${POLLER} UPPER_POLLER)
set(ZMQ_IOTHREAD_POLLER_USE_${UPPER_POLLER} 1)
......@@ -362,7 +401,8 @@ endif()
if(POLLER STREQUAL "epoll" AND WIN32)
message(STATUS "Including wepoll")
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/wepoll/wepoll.c ${CMAKE_CURRENT_SOURCE_DIR}/external/wepoll/wepoll.h)
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/external/wepoll/wepoll.c
${CMAKE_CURRENT_SOURCE_DIR}/external/wepoll/wepoll.h)
endif()
if(API_POLLER STREQUAL "")
......@@ -377,8 +417,13 @@ message(STATUS "Using polling method in zmq_poll(er)_* API: ${API_POLLER}")
string(TOUPPER ${API_POLLER} UPPER_API_POLLER)
set(ZMQ_POLL_BASED_ON_${UPPER_API_POLLER} 1)
execute_process(COMMAND getconf LEVEL1_DCACHE_LINESIZE OUTPUT_VARIABLE CACHELINE_SIZE ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CACHELINE_SIZE STREQUAL "" OR CACHELINE_SIZE EQUAL 0 OR CACHELINE_SIZE EQUAL -1)
execute_process(
COMMAND getconf LEVEL1_DCACHE_LINESIZE
OUTPUT_VARIABLE CACHELINE_SIZE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CACHELINE_SIZE STREQUAL ""
OR CACHELINE_SIZE EQUAL 0
OR CACHELINE_SIZE EQUAL -1)
set(ZMQ_CACHELINE_SIZE 64)
else()
set(ZMQ_CACHELINE_SIZE ${CACHELINE_SIZE})
......@@ -391,47 +436,49 @@ if(NOT CYGWIN)
endif()
if(NOT WIN32)
set(ZMQ_HAVE_IPC 1)
set(ZMQ_HAVE_IPC 1)
else()
check_include_files("winsock2.h;afunix.h" ZMQ_HAVE_IPC)
check_include_files("winsock2.h;afunix.h" ZMQ_HAVE_IPC)
endif()
###################### BEGIN condition_variable_t selection
# ##################### BEGIN condition_variable_t selection
if(NOT ZMQ_CV_IMPL)
# prefer C++11 STL std::condition_variable implementation, if available
check_include_files(condition_variable ZMQ_HAVE_STL_CONDITION_VARIABLE LANGUAGE CXX)
# prefer C++11 STL std::condition_variable implementation, if available
check_include_files(condition_variable ZMQ_HAVE_STL_CONDITION_VARIABLE LANGUAGE CXX)
if (ZMQ_HAVE_STL_CONDITION_VARIABLE)
set(ZMQ_CV_IMPL_DEFAULT "stl11")
if(ZMQ_HAVE_STL_CONDITION_VARIABLE)
set(ZMQ_CV_IMPL_DEFAULT "stl11")
else()
if(WIN32 AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS "6.0")
# Win32API CONDITION_VARIABLE is supported from Windows Vista only
set(ZMQ_CV_IMPL_DEFAULT "win32api")
elseif(CMAKE_USE_PTHREADS_INIT)
set(ZMQ_CV_IMPL_DEFAULT "pthreads")
else()
if(WIN32 AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS "6.0")
# Win32API CONDITION_VARIABLE is supported from Windows Vista only
set(ZMQ_CV_IMPL_DEFAULT "win32api")
elseif(CMAKE_USE_PTHREADS_INIT)
set(ZMQ_CV_IMPL_DEFAULT "pthreads")
else()
set(ZMQ_CV_IMPL_DEFAULT "none")
endif()
set(ZMQ_CV_IMPL_DEFAULT "none")
endif()
endif()
# TODO a vxworks implementation also exists, but vxworks is not currently supported with cmake at all
set(ZMQ_CV_IMPL "${ZMQ_CV_IMPL_DEFAULT}" CACHE STRING "Choose condition_variable_t implementation. Valid values are
# TODO a vxworks implementation also exists, but vxworks is not currently supported with cmake at all
set(ZMQ_CV_IMPL
"${ZMQ_CV_IMPL_DEFAULT}"
CACHE STRING "Choose condition_variable_t implementation. Valid values are
stl11, win32api, pthreads, none [default=autodetect]")
endif()
message(STATUS "Using condition_variable_t implementation: ${ZMQ_CV_IMPL}")
if(ZMQ_CV_IMPL STREQUAL "stl11")
set(ZMQ_USE_CV_IMPL_STL11 1)
set(ZMQ_USE_CV_IMPL_STL11 1)
elseif(ZMQ_CV_IMPL STREQUAL "win32api")
set(ZMQ_USE_CV_IMPL_WIN32API 1)
set(ZMQ_USE_CV_IMPL_WIN32API 1)
elseif(ZMQ_CV_IMPL STREQUAL "pthreads")
set(ZMQ_USE_CV_IMPL_PTHREADS 1)
set(ZMQ_USE_CV_IMPL_PTHREADS 1)
elseif(ZMQ_CV_IMPL STREQUAL "none")
set(ZMQ_USE_CV_IMPL_NONE 1)
set(ZMQ_USE_CV_IMPL_NONE 1)
else()
message(ERROR "Unknown value for ZMQ_CV_IMPL: ${ZMQ_CV_IMPL}")
message(ERROR "Unknown value for ZMQ_CV_IMPL: ${ZMQ_CV_IMPL}")
endif()
###################### END condition_variable_t selection
# ##################### END condition_variable_t selection
if(NOT MSVC)
check_include_files(ifaddrs.h ZMQ_HAVE_IFADDRS)
......@@ -521,18 +568,22 @@ if(MSVC)
# C++11/14/17-specific, but maybe possible via conditional defines
zmq_check_cxx_flag_prepend("/wd26440") # Function '...' can be declared 'noexcept'
zmq_check_cxx_flag_prepend("/wd26432") # If you define or delete any default operation in the type '...', define or delete them all
zmq_check_cxx_flag_prepend("/wd26432") # If you define or delete any default operation in the type '...', define or
# delete them all
zmq_check_cxx_flag_prepend("/wd26439") # This kind of function may not throw. Declare it 'noexcept'
zmq_check_cxx_flag_prepend("/wd26447") # The function is declared 'noexcept' but calls function '...' which may throw exceptions
zmq_check_cxx_flag_prepend("/wd26447") # The function is declared 'noexcept' but calls function '...' which may
# throw exceptions
zmq_check_cxx_flag_prepend("/wd26433") # Function '...' should be marked with 'override'
zmq_check_cxx_flag_prepend("/wd26409") # Avoid calling new and delete explicitly, use std::make_unique<T> instead
# Requires GSL
zmq_check_cxx_flag_prepend("/wd26429") # Symbol '...' is never tested for nullness, it can be marked as not_null
zmq_check_cxx_flag_prepend("/wd26446") # Prefer to use gsl::at()
zmq_check_cxx_flag_prepend("/wd26481") # Don't use pointer arithmetic. Use span instead
zmq_check_cxx_flag_prepend("/wd26472") # Don't use a static_cast for arithmetic conversions. Use brace initialization, gsl::narrow_cast or gsl::narow
zmq_check_cxx_flag_prepend("/wd26472") # Don't use a static_cast for arithmetic conversions. Use brace
# initialization, gsl::narrow_cast or gsl::narow
zmq_check_cxx_flag_prepend("/wd26448") # Consider using gsl::finally if final action is intended
zmq_check_cxx_flag_prepend("/wd26400") # Do not assign the result of an allocation or a function call with an owner<T> return value to a raw pointer, use owner<T> instead
zmq_check_cxx_flag_prepend("/wd26400") # Do not assign the result of an allocation or a function call with an
# owner<T> return value to a raw pointer, use owner<T> instead
zmq_check_cxx_flag_prepend("/wd26485") # Expression '...': No array to pointer decay(bounds.3)
else()
zmq_check_cxx_flag_prepend("/W3")
......@@ -591,10 +642,12 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
zmq_check_cxx_flag_prepend("-features=zla")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "SunOS" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR CMAKE_SYSTEM_NAME MATCHES "QNX")
if(CMAKE_SYSTEM_NAME MATCHES "SunOS"
OR CMAKE_SYSTEM_NAME MATCHES "NetBSD"
OR CMAKE_SYSTEM_NAME MATCHES "QNX")
message(STATUS "Checking whether atomic operations can be used")
check_c_source_compiles(
"\
"\
#include <atomic.h> \
\
int main() \
......@@ -604,7 +657,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "SunOS" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR CM
return 0; \
} \
"
HAVE_ATOMIC_H)
HAVE_ATOMIC_H)
if(NOT HAVE_ATOMIC_H)
set(ZMQ_FORCE_MUTEXES 1)
......@@ -612,10 +665,10 @@ if(CMAKE_SYSTEM_NAME MATCHES "SunOS" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR CM
endif()
if(NOT ANDROID)
zmq_check_noexcept()
zmq_check_noexcept()
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
if(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
zmq_check_sock_cloexec()
zmq_check_o_cloexec()
......@@ -632,9 +685,9 @@ if(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux"
OR CMAKE_SYSTEM_NAME MATCHES "GNU/kFreeBSD"
OR CMAKE_SYSTEM_NAME MATCHES "GNU/Hurd"
OR CYGWIN)
OR CMAKE_SYSTEM_NAME MATCHES "GNU/kFreeBSD"
OR CMAKE_SYSTEM_NAME MATCHES "GNU/Hurd"
OR CYGWIN)
add_definitions(-D_GNU_SOURCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_definitions(-D__BSD_VISIBLE)
......@@ -653,24 +706,26 @@ endif()
find_package(AsciiDoc)
cmake_dependent_option(WITH_DOC "Build Reference Guide documentation(requires DocBook)" ON
"ASCIIDOC_FOUND;NOT WIN32" OFF) # Do not build docs on Windows due to issues with symlinks
cmake_dependent_option(WITH_DOC "Build Reference Guide documentation(requires DocBook)" ON "ASCIIDOC_FOUND;NOT WIN32"
OFF) # Do not build docs on Windows due to issues with symlinks
if(MSVC)
if(WITH_OPENPGM)
#set(OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM")
# set(OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM")
set(OPENPGM_VERSION_MAJOR 5)
set(OPENPGM_VERSION_MINOR 2)
set(OPENPGM_VERSION_MICRO 122)
if(CMAKE_CL_64)
find_path(OPENPGM_ROOT include/pgm/pgm.h
PATHS
find_path(
OPENPGM_ROOT include/pgm/pgm.h
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
NO_DEFAULT_PATH)
NO_DEFAULT_PATH)
message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
else()
find_path(OPENPGM_ROOT include/pgm/pgm.h
PATHS
find_path(
OPENPGM_ROOT include/pgm/pgm.h
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
NO_DEFAULT_PATH)
......@@ -679,29 +734,32 @@ if(MSVC)
set(OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include)
set(OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib)
set(OPENPGM_LIBRARIES
optimized libpgm${MSVC_TOOLSET}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib
debug libpgm${MSVC_TOOLSET}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
optimized
libpgm${MSVC_TOOLSET}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib debug
libpgm${MSVC_TOOLSET}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
endif()
else()
if(WITH_OPENPGM)
# message(FATAL_ERROR "WITH_OPENPGM not implemented")
# message(FATAL_ERROR "WITH_OPENPGM not implemented")
if(NOT OPENPGM_PKGCONFIG_NAME)
set(OPENPGM_PKGCONFIG_NAME "openpgm-5.2")
endif()
set(OPENPGM_PKGCONFIG_NAME ${OPENPGM_PKGCONFIG_NAME} CACHE STRING
"Name pkg-config shall use to find openpgm libraries and include paths"
FORCE)
set(OPENPGM_PKGCONFIG_NAME
${OPENPGM_PKGCONFIG_NAME}
CACHE STRING "Name pkg-config shall use to find openpgm libraries and include paths" FORCE)
pkg_check_modules(OPENPGM ${OPENPGM_PKGCONFIG_NAME})
pkg_check_modules(OPENPGM ${OPENPGM_PKGCONFIG_NAME})
if(OPENPGM_FOUND)
message(STATUS ${OPENPGM_PKGCONFIG_NAME}" found")
set(pkg_config_names_private "${pkg_config_names_private} ${OPENPGM_PKGCONFIG_NAME}")
else()
message(FATAL_ERROR
${OPENPGM_PKGCONFIG_NAME}" not found. openpgm is searchd via `pkg-config ${OPENPGM_PKGCONFIG_NAME}`. Consider providing a valid OPENPGM_PKGCONFIG_NAME")
message(
FATAL_ERROR
${OPENPGM_PKGCONFIG_NAME}" not found. openpgm is searchd via `pkg-config ${OPENPGM_PKGCONFIG_NAME}`. Consider providing a valid OPENPGM_PKGCONFIG_NAME"
)
endif()
# DSO symbol visibility for openpgm
......@@ -713,12 +771,13 @@ else()
endif()
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# force off-tree build
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
message(FATAL_ERROR "CMake generation is not allowed within the source directory! \
message(
FATAL_ERROR
"CMake generation is not allowed within the source directory! \
Remove the CMakeCache.txt file and try again from another folder, e.g.: \
\
rm CMakeCache.txt \
......@@ -727,18 +786,18 @@ if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
cmake ..")
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# default to Release build
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
# CMAKE_BUILD_TYPE is not used for multi-configuration generators like Visual Studio/XCode
# which instead use CMAKE_CONFIGURATION_TYPES
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
# CMAKE_BUILD_TYPE is not used for multi-configuration generators like Visual Studio/XCode which instead use
# CMAKE_CONFIGURATION_TYPES
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# output directories
zmq_set_with_default(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/bin")
......@@ -750,7 +809,7 @@ endif()
zmq_set_with_default(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/${zmq_library_directory}")
zmq_set_with_default(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${ZeroMQ_BINARY_DIR}/lib")
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# platform specifics
if(WIN32)
......@@ -765,13 +824,12 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
# Compile the static lib with debug information included
# note: we assume here that the default flags contain some /Z flag
# Compile the static lib with debug information included note: we assume here that the default flags contain some /Z
# flag
string(REGEX REPLACE "/Z.[^:]" "/Z7 " CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REGEX REPLACE "/Z.[^:]" "/Z7 " CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
# Optimization flags.
# http://msdn.microsoft.com/en-us/magazine/cc301698.aspx
# Optimization flags. http://msdn.microsoft.com/en-us/magazine/cc301698.aspx
if(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GL")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG")
......@@ -780,253 +838,251 @@ if(MSVC)
endif()
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# source files
set(cxx-sources
precompiled.cpp
address.cpp
client.cpp
clock.cpp
ctx.cpp
curve_mechanism_base.cpp
curve_client.cpp
curve_server.cpp
dealer.cpp
devpoll.cpp
dgram.cpp
dist.cpp
endpoint.cpp
epoll.cpp
err.cpp
fq.cpp
io_object.cpp
io_thread.cpp
ip.cpp
ipc_address.cpp
ipc_connecter.cpp
ipc_listener.cpp
kqueue.cpp
lb.cpp
mailbox.cpp
mailbox_safe.cpp
mechanism.cpp
mechanism_base.cpp
metadata.cpp
msg.cpp
mtrie.cpp
norm_engine.cpp
object.cpp
options.cpp
own.cpp
null_mechanism.cpp
pair.cpp
peer.cpp
pgm_receiver.cpp
pgm_sender.cpp
pgm_socket.cpp
pipe.cpp
plain_client.cpp
plain_server.cpp
poll.cpp
poller_base.cpp
polling_util.cpp
pollset.cpp
proxy.cpp
pub.cpp
pull.cpp
push.cpp
random.cpp
raw_encoder.cpp
raw_decoder.cpp
raw_engine.cpp
reaper.cpp
rep.cpp
req.cpp
router.cpp
select.cpp
server.cpp
session_base.cpp
signaler.cpp
socket_base.cpp
socks.cpp
socks_connecter.cpp
stream.cpp
stream_engine_base.cpp
sub.cpp
tcp.cpp
tcp_address.cpp
tcp_connecter.cpp
tcp_listener.cpp
thread.cpp
trie.cpp
radix_tree.cpp
v1_decoder.cpp
v1_encoder.cpp
v2_decoder.cpp
v2_encoder.cpp
v3_1_encoder.cpp
xpub.cpp
xsub.cpp
zmq.cpp
zmq_utils.cpp
decoder_allocators.cpp
socket_poller.cpp
timers.cpp
config.hpp
radio.cpp
dish.cpp
udp_engine.cpp
udp_address.cpp
scatter.cpp
gather.cpp
ip_resolver.cpp
zap_client.cpp
zmtp_engine.cpp
# at least for VS, the header files must also be listed
address.hpp
array.hpp
atomic_counter.hpp
atomic_ptr.hpp
blob.hpp
client.hpp
clock.hpp
command.hpp
condition_variable.hpp
config.hpp
ctx.hpp
curve_client.hpp
curve_client_tools.hpp
curve_mechanism_base.hpp
curve_server.hpp
dbuffer.hpp
dealer.hpp
decoder.hpp
decoder_allocators.hpp
devpoll.hpp
dgram.hpp
dish.hpp
dist.hpp
encoder.hpp
endpoint.hpp
epoll.hpp
err.hpp
fd.hpp
fq.hpp
gather.hpp
generic_mtrie.hpp
generic_mtrie_impl.hpp
gssapi_client.hpp
gssapi_mechanism_base.hpp
gssapi_server.hpp
i_decoder.hpp
i_encoder.hpp
i_engine.hpp
i_mailbox.hpp
i_poll_events.hpp
io_object.hpp
io_thread.hpp
ip.hpp
ipc_address.hpp
ipc_connecter.hpp
ipc_listener.hpp
kqueue.hpp
lb.hpp
likely.hpp
macros.hpp
mailbox.hpp
mailbox_safe.hpp
mechanism.hpp
mechanism_base.hpp
metadata.hpp
msg.hpp
mtrie.hpp
mutex.hpp
norm_engine.hpp
null_mechanism.hpp
object.hpp
options.hpp
own.hpp
pair.hpp
peer.hpp
pgm_receiver.hpp
pgm_sender.hpp
pgm_socket.hpp
pipe.hpp
plain_client.hpp
plain_common.hpp
plain_server.hpp
poll.hpp
poller.hpp
poller_base.hpp
polling_util.hpp
pollset.hpp
precompiled.hpp
proxy.hpp
pub.hpp
pull.hpp
push.hpp
radio.hpp
random.hpp
raw_decoder.hpp
raw_encoder.hpp
raw_engine.hpp
reaper.hpp
rep.hpp
req.hpp
router.hpp
scatter.hpp
secure_allocator.hpp
select.hpp
server.hpp
session_base.hpp
signaler.hpp
socket_base.hpp
socket_poller.hpp
socks.hpp
socks_connecter.hpp
stdint.hpp
stream.hpp
stream_engine_base.hpp
stream_connecter_base.hpp
stream_connecter_base.cpp
stream_listener_base.hpp
stream_listener_base.cpp
sub.hpp
tcp.hpp
tcp_address.hpp
tcp_connecter.hpp
tcp_listener.hpp
thread.hpp
timers.hpp
tipc_address.hpp
tipc_connecter.hpp
tipc_listener.hpp
trie.hpp
udp_address.hpp
udp_engine.hpp
v1_decoder.hpp
v1_encoder.hpp
v2_decoder.hpp
v2_encoder.hpp
v3_1_encoder.hpp
v2_protocol.hpp
vmci.hpp
vmci_address.hpp
vmci_connecter.hpp
vmci_listener.hpp
windows.hpp
wire.hpp
xpub.hpp
xsub.hpp
ypipe.hpp
ypipe_base.hpp
ypipe_conflate.hpp
yqueue.hpp
zap_client.hpp
zmtp_engine.hpp
)
precompiled.cpp
address.cpp
client.cpp
clock.cpp
ctx.cpp
curve_mechanism_base.cpp
curve_client.cpp
curve_server.cpp
dealer.cpp
devpoll.cpp
dgram.cpp
dist.cpp
endpoint.cpp
epoll.cpp
err.cpp
fq.cpp
io_object.cpp
io_thread.cpp
ip.cpp
ipc_address.cpp
ipc_connecter.cpp
ipc_listener.cpp
kqueue.cpp
lb.cpp
mailbox.cpp
mailbox_safe.cpp
mechanism.cpp
mechanism_base.cpp
metadata.cpp
msg.cpp
mtrie.cpp
norm_engine.cpp
object.cpp
options.cpp
own.cpp
null_mechanism.cpp
pair.cpp
peer.cpp
pgm_receiver.cpp
pgm_sender.cpp
pgm_socket.cpp
pipe.cpp
plain_client.cpp
plain_server.cpp
poll.cpp
poller_base.cpp
polling_util.cpp
pollset.cpp
proxy.cpp
pub.cpp
pull.cpp
push.cpp
random.cpp
raw_encoder.cpp
raw_decoder.cpp
raw_engine.cpp
reaper.cpp
rep.cpp
req.cpp
router.cpp
select.cpp
server.cpp
session_base.cpp
signaler.cpp
socket_base.cpp
socks.cpp
socks_connecter.cpp
stream.cpp
stream_engine_base.cpp
sub.cpp
tcp.cpp
tcp_address.cpp
tcp_connecter.cpp
tcp_listener.cpp
thread.cpp
trie.cpp
radix_tree.cpp
v1_decoder.cpp
v1_encoder.cpp
v2_decoder.cpp
v2_encoder.cpp
v3_1_encoder.cpp
xpub.cpp
xsub.cpp
zmq.cpp
zmq_utils.cpp
decoder_allocators.cpp
socket_poller.cpp
timers.cpp
config.hpp
radio.cpp
dish.cpp
udp_engine.cpp
udp_address.cpp
scatter.cpp
gather.cpp
ip_resolver.cpp
zap_client.cpp
zmtp_engine.cpp
# at least for VS, the header files must also be listed
address.hpp
array.hpp
atomic_counter.hpp
atomic_ptr.hpp
blob.hpp
client.hpp
clock.hpp
command.hpp
condition_variable.hpp
config.hpp
ctx.hpp
curve_client.hpp
curve_client_tools.hpp
curve_mechanism_base.hpp
curve_server.hpp
dbuffer.hpp
dealer.hpp
decoder.hpp
decoder_allocators.hpp
devpoll.hpp
dgram.hpp
dish.hpp
dist.hpp
encoder.hpp
endpoint.hpp
epoll.hpp
err.hpp
fd.hpp
fq.hpp
gather.hpp
generic_mtrie.hpp
generic_mtrie_impl.hpp
gssapi_client.hpp
gssapi_mechanism_base.hpp
gssapi_server.hpp
i_decoder.hpp
i_encoder.hpp
i_engine.hpp
i_mailbox.hpp
i_poll_events.hpp
io_object.hpp
io_thread.hpp
ip.hpp
ipc_address.hpp
ipc_connecter.hpp
ipc_listener.hpp
kqueue.hpp
lb.hpp
likely.hpp
macros.hpp
mailbox.hpp
mailbox_safe.hpp
mechanism.hpp
mechanism_base.hpp
metadata.hpp
msg.hpp
mtrie.hpp
mutex.hpp
norm_engine.hpp
null_mechanism.hpp
object.hpp
options.hpp
own.hpp
pair.hpp
peer.hpp
pgm_receiver.hpp
pgm_sender.hpp
pgm_socket.hpp
pipe.hpp
plain_client.hpp
plain_common.hpp
plain_server.hpp
poll.hpp
poller.hpp
poller_base.hpp
polling_util.hpp
pollset.hpp
precompiled.hpp
proxy.hpp
pub.hpp
pull.hpp
push.hpp
radio.hpp
random.hpp
raw_decoder.hpp
raw_encoder.hpp
raw_engine.hpp
reaper.hpp
rep.hpp
req.hpp
router.hpp
scatter.hpp
secure_allocator.hpp
select.hpp
server.hpp
session_base.hpp
signaler.hpp
socket_base.hpp
socket_poller.hpp
socks.hpp
socks_connecter.hpp
stdint.hpp
stream.hpp
stream_engine_base.hpp
stream_connecter_base.hpp
stream_connecter_base.cpp
stream_listener_base.hpp
stream_listener_base.cpp
sub.hpp
tcp.hpp
tcp_address.hpp
tcp_connecter.hpp
tcp_listener.hpp
thread.hpp
timers.hpp
tipc_address.hpp
tipc_connecter.hpp
tipc_listener.hpp
trie.hpp
udp_address.hpp
udp_engine.hpp
v1_decoder.hpp
v1_encoder.hpp
v2_decoder.hpp
v2_encoder.hpp
v3_1_encoder.hpp
v2_protocol.hpp
vmci.hpp
vmci_address.hpp
vmci_connecter.hpp
vmci_listener.hpp
windows.hpp
wire.hpp
xpub.hpp
xsub.hpp
ypipe.hpp
ypipe_base.hpp
ypipe_conflate.hpp
yqueue.hpp
zap_client.hpp
zmtp_engine.hpp)
if(MINGW)
# Generate the right type when using -m32 or -m64
......@@ -1034,7 +1090,7 @@ if(MINGW)
set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC)
set(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> <FLAGS> -O coff --target=${rc_target} <DEFINES> -i <SOURCE> -o <OBJECT>")
"<CMAKE_RC_COMPILER> <FLAGS> -O coff --target=${rc_target} <DEFINES> -i <SOURCE> -o <OBJECT>")
endmacro()
if(NOT CMAKE_SYSTEM_PROCESSOR)
......@@ -1043,12 +1099,12 @@ if(MINGW)
# Also happens on x86_64 systems...what a worthless variable
if(CMAKE_SYSTEM_PROCESSOR MATCHES "i386"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i486"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i586"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i486"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i586"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set_rc_arch("pe-x86-64")
......@@ -1058,17 +1114,11 @@ if(MINGW)
endif()
endif()
set(public_headers
include/zmq.h
include/zmq_utils.h)
set(public_headers include/zmq.h include/zmq_utils.h)
set(readme-docs
AUTHORS
COPYING
COPYING.LESSER
NEWS)
set(readme-docs AUTHORS COPYING COPYING.LESSER NEWS)
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# optional modules
if(WITH_OPENPGM)
......@@ -1085,11 +1135,10 @@ if(WITH_VMCI)
endif()
if(ZMQ_HAVE_TIPC)
add_definitions(-DZMQ_HAVE_TIPC)
list(APPEND cxx-sources tipc_address.cpp tipc_connecter.cpp tipc_listener.cpp)
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# source generators
foreach(source ${cxx-sources})
......@@ -1098,7 +1147,7 @@ endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
# Delete any src/platform.hpp left by configure
# Delete any src/platform.hpp left by configure
file(REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/src/platform.hpp)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/platform.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp)
......@@ -1125,18 +1174,17 @@ if(MSVC)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
COMMAND ${CMAKE_COMMAND}
ARGS -E
copy
${nsis-template}
${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
COMMAND ${CMAKE_COMMAND} ARGS -E copy ${nsis-template} ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
DEPENDS ${nsis-template})
endif()
option (WITH_DOCS "Build html docs" ON)
if (WITH_DOCS)
option(WITH_DOCS "Build html docs" ON)
if(WITH_DOCS)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
file(GLOB docs RELATIVE ${CMAKE_CURRENT_BINARY_DIR}/ "${CMAKE_CURRENT_SOURCE_DIR}/doc/*.txt")
file(
GLOB docs
RELATIVE ${CMAKE_CURRENT_BINARY_DIR}/
"${CMAKE_CURRENT_SOURCE_DIR}/doc/*.txt")
set(html-docs)
foreach(txt ${docs})
string(REGEX REPLACE ".*/(.*)\\.txt" "\\1.html" html ${txt})
......@@ -1144,14 +1192,9 @@ if (WITH_DOCS)
set(dst doc/${html})
if(WITH_DOC)
add_custom_command(
OUTPUT ${dst}
COMMAND ${ASCIIDOC_EXECUTABLE}
-d manpage
-b xhtml11
-f ${CMAKE_CURRENT_SOURCE_DIR}/doc/asciidoc.conf
-azmq_version=${ZMQ_VERSION}
-o ${dst}
${src}
OUTPUT ${dst}
COMMAND ${ASCIIDOC_EXECUTABLE} -d manpage -b xhtml11 -f ${CMAKE_CURRENT_SOURCE_DIR}/doc/asciidoc.conf
-azmq_version=${ZMQ_VERSION} -o ${dst} ${src}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${src}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating ${html}")
......@@ -1162,11 +1205,11 @@ endif()
if(ZMQ_BUILD_FRAMEWORK)
add_custom_command(
TARGET libzmq
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E make_directory "${CMAKE_LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION}/MacOS"
COMMENT "Perf tools")
TARGET libzmq
POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E make_directory
"${CMAKE_LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION}/MacOS"
COMMENT "Perf tools")
endif()
option(ENABLE_PRECOMPILED "Enable precompiled headers, if possible" ON)
......@@ -1175,157 +1218,153 @@ if(MSVC AND ENABLE_PRECOMPILED)
foreach(source ${sources})
# C and C++ can not use the same precompiled header
if(${source} MATCHES ".cpp$" AND NOT ${source} STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/src/precompiled.cpp")
set_source_files_properties(${source}
PROPERTIES
COMPILE_FLAGS "/Yuprecompiled.hpp"
OBJECT_DEPENDS precompiled.hpp)
set_source_files_properties(${source} PROPERTIES COMPILE_FLAGS "/Yuprecompiled.hpp" OBJECT_DEPENDS
precompiled.hpp)
endif()
endforeach()
# create precompiled header
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/precompiled.cpp
PROPERTIES
COMPILE_FLAGS "/Ycprecompiled.hpp"
OBJECT_OUTPUTS precompiled.hpp)
PROPERTIES COMPILE_FLAGS "/Ycprecompiled.hpp" OBJECT_OUTPUTS precompiled.hpp)
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# output
option(BUILD_SHARED "Whether or not to build the shared object" ON)
option(BUILD_SHARED "Whether or not to build the shared object" ON)
option(BUILD_STATIC "Whether or not to build the static archive" ON)
list(APPEND target_outputs "")
if(BUILD_SHARED)
list(APPEND target_outputs "libzmq")
endif()
if(BUILD_STATIC)
list(APPEND target_outputs "libzmq-static")
endif()
if(MSVC)
# Suppress linker warnings caused by #ifdef omission
# of file content.
# Suppress linker warnings caused by #ifdef omission of file content.
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
set(PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(PDB_NAME "lib${ZMQ_OUTPUT_BASENAME}${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}")
set(PDB_NAME
"lib${ZMQ_OUTPUT_BASENAME}${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}")
function(enable_vs_guideline_checker target)
set_target_properties(${target} PROPERTIES
VS_GLOBAL_EnableCppCoreCheck true
VS_GLOBAL_CodeAnalysisRuleSet CppCoreCheckRules.ruleset
VS_GLOBAL_RunCodeAnalysis true)
set_target_properties(
${target} PROPERTIES VS_GLOBAL_EnableCppCoreCheck true VS_GLOBAL_CodeAnalysisRuleSet CppCoreCheckRules.ruleset
VS_GLOBAL_RunCodeAnalysis true)
endfunction()
if(BUILD_SHARED)
add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs}
${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
if(ENABLE_ANALYSIS)
enable_vs_guideline_checker(libzmq)
endif()
set_target_properties(libzmq PROPERTIES
PUBLIC_HEADER "${public_headers}"
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
RELWITHDEBINFO_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
MINSIZEREL_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
COMPILE_DEFINITIONS "DLL_EXPORT"
OUTPUT_NAME "lib${ZMQ_OUTPUT_BASENAME}")
if(ZMQ_HAVE_WINDOWS_UWP)
set_target_properties(libzmq PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF")
endif()
set_target_properties(
libzmq
PROPERTIES PUBLIC_HEADER "${public_headers}"
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
RELWITHDEBINFO_POSTFIX
"${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
MINSIZEREL_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
COMPILE_DEFINITIONS "DLL_EXPORT"
OUTPUT_NAME "lib${ZMQ_OUTPUT_BASENAME}")
if(ZMQ_HAVE_WINDOWS_UWP)
set_target_properties(libzmq PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF")
endif()
endif()
if(BUILD_STATIC)
add_library(libzmq-static STATIC ${sources} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
set_target_properties(libzmq-static PROPERTIES
PUBLIC_HEADER "${public_headers}"
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
RELWITHDEBINFO_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
MINSIZEREL_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-sgd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
COMPILE_FLAGS "/DZMQ_STATIC"
OUTPUT_NAME "lib${ZMQ_OUTPUT_BASENAME}")
set_target_properties(
libzmq-static
PROPERTIES PUBLIC_HEADER "${public_headers}"
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
RELWITHDEBINFO_POSTFIX
"${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
MINSIZEREL_POSTFIX
"${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-sgd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
COMPILE_FLAGS "/DZMQ_STATIC"
OUTPUT_NAME "lib${ZMQ_OUTPUT_BASENAME}")
endif()
else()
# avoid building everything twice for shared + static
# only on *nix, as Windows needs different preprocessor defines in static builds
# avoid building everything twice for shared + static only on *nix, as Windows needs different preprocessor defines in
# static builds
if(NOT MINGW)
add_library(objects OBJECT ${sources})
set_property(TARGET objects PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(objects
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>)
target_include_directories(
objects PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> $<INSTALL_INTERFACE:include>)
endif()
if(BUILD_SHARED)
if(MINGW)
add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig}
${CMAKE_CURRENT_BINARY_DIR}/version.rc)
else()
add_library(libzmq SHARED $<TARGET_OBJECTS:objects> ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
add_library(libzmq SHARED $<TARGET_OBJECTS:objects> ${public_headers} ${html-docs} ${readme-docs}
${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()
# NOTE: the SOVERSION and VERSION MUST be the same as the one generated by libtool! It is NOT the same as the version of the package.
set_target_properties(libzmq PROPERTIES
COMPILE_DEFINITIONS "DLL_EXPORT"
PUBLIC_HEADER "${public_headers}"
VERSION "5.2.3"
SOVERSION "5"
OUTPUT_NAME "${ZMQ_OUTPUT_BASENAME}"
PREFIX "lib")
# NOTE: the SOVERSION and VERSION MUST be the same as the one generated by libtool! It is NOT the same as the
# version of the package.
set_target_properties(
libzmq PROPERTIES COMPILE_DEFINITIONS "DLL_EXPORT" PUBLIC_HEADER "${public_headers}" VERSION "5.2.3"
SOVERSION "5" OUTPUT_NAME "${ZMQ_OUTPUT_BASENAME}" PREFIX "lib")
if(ZMQ_BUILD_FRAMEWORK)
set_target_properties(libzmq PROPERTIES
FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER "org.zeromq.libzmq"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${ZMQ_VERSION}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${ZMQ_VERSION})
set_source_files_properties(${html-docs} PROPERTIES
MACOSX_PACKAGE_LOCATION doc)
set_source_files_properties(${readme-docs} PROPERTIES
MACOSX_PACKAGE_LOCATION etc)
set_source_files_properties(${zmq-pkgconfig} PROPERTIES
MACOSX_PACKAGE_LOCATION lib/pkgconfig)
set_target_properties(
libzmq
PROPERTIES FRAMEWORK TRUE MACOSX_FRAMEWORK_IDENTIFIER "org.zeromq.libzmq" MACOSX_FRAMEWORK_SHORT_VERSION_STRING
${ZMQ_VERSION}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${ZMQ_VERSION})
set_source_files_properties(${html-docs} PROPERTIES MACOSX_PACKAGE_LOCATION doc)
set_source_files_properties(${readme-docs} PROPERTIES MACOSX_PACKAGE_LOCATION etc)
set_source_files_properties(${zmq-pkgconfig} PROPERTIES MACOSX_PACKAGE_LOCATION lib/pkgconfig)
endif()
endif()
if(BUILD_STATIC)
if(MINGW)
add_library(libzmq-static STATIC ${sources} ${public_headers} ${html-docs}
${readme-docs} ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
add_library(libzmq-static STATIC ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig}
${CMAKE_CURRENT_BINARY_DIR}/version.rc)
else()
add_library(libzmq-static STATIC $<TARGET_OBJECTS:objects> ${public_headers}
${html-docs} ${readme-docs} ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
add_library(libzmq-static STATIC $<TARGET_OBJECTS:objects> ${public_headers} ${html-docs} ${readme-docs}
${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "QNX")
target_link_libraries(libzmq-static m)
endif()
set_target_properties(libzmq-static PROPERTIES
PUBLIC_HEADER "${public_headers}"
OUTPUT_NAME "${ZMQ_OUTPUT_BASENAME}"
PREFIX "lib")
set_target_properties(
libzmq-static PROPERTIES PUBLIC_HEADER "${public_headers}" OUTPUT_NAME "${ZMQ_OUTPUT_BASENAME}" PREFIX "lib")
endif()
endif()
if(BUILD_STATIC)
target_compile_definitions(libzmq-static
PUBLIC ZMQ_STATIC)
target_compile_definitions(libzmq-static PUBLIC ZMQ_STATIC)
endif()
list(APPEND target_outputs "")
if(BUILD_SHARED)
list(APPEND target_outputs "libzmq")
endif()
if(BUILD_STATIC)
list(APPEND target_outputs "libzmq-static")
endif()
foreach(target ${target_outputs})
target_include_directories(${target}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>)
target_include_directories(
${target} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> $<INSTALL_INTERFACE:include>)
endforeach()
if(BUILD_SHARED)
target_link_libraries(libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})
if(GNUTLS_FOUND)
target_link_libraries(libzmq ${GNUTLS_LIBRARIES})
endif()
if(NSS3_FOUND)
target_link_libraries(libzmq ${NSS3_LIBRARIES})
endif()
if(LIBBSD_FOUND)
target_link_libraries(libzmq ${LIBBSD_LIBRARIES})
endif()
if(SODIUM_FOUND)
target_link_libraries(libzmq ${SODIUM_LIBRARIES})
# On Solaris, libsodium depends on libssp
......@@ -1354,7 +1393,14 @@ if(BUILD_SHARED)
endif()
if(BUILD_STATIC)
target_link_libraries(libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(libzmq-static ${CMAKE_THREAD_LIBS_INIT})
if(GNUTLS_FOUND)
target_link_libraries(libzmq-static ${GNUTLS_LIBRARIES})
endif()
if(LIBBSD_FOUND)
target_link_libraries(libzmq-static ${LIBBSD_LIBRARIES})
endif()
if(NSS3_FOUND)
target_link_libraries(libzmq-static ${NSS3_LIBRARIES})
......@@ -1393,13 +1439,13 @@ endif()
if(BUILD_SHARED)
set(perf-tools
local_lat
remote_lat
local_thr
remote_thr
inproc_lat
inproc_thr
proxy_thr)
local_lat
remote_lat
local_thr
remote_thr
inproc_lat
inproc_thr
proxy_thr)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # Why?
option(WITH_PERF_TOOL "Build with perf-tools" ON)
......@@ -1412,47 +1458,60 @@ if(BUILD_SHARED)
add_executable(${perf-tool} perf/${perf-tool}.cpp)
target_link_libraries(${perf-tool} libzmq)
if(GNUTLS_FOUND)
target_link_libraries(${perf-tool} ${GNUTLS_LIBRARIES})
endif()
if(LIBBSD_FOUND)
target_link_libraries(${perf-tool} ${LIBBSD_LIBRARIES})
endif()
if(NSS3_FOUND)
target_link_libraries(${perf-tool} ${NSS3_LIBRARIES})
endif()
if(SODIUM_FOUND)
target_link_libraries(${perf-tool} ${SODIUM_LIBRARIES})
endif()
if(ZMQ_BUILD_FRAMEWORK)
# Copy perf-tools binaries into Framework
add_custom_command(
TARGET libzmq ${perf-tool}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy "$<TARGET_FILE:${perf-tool}>" "${LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION_STRING}/MacOS/${perf-tool}"
TARGET libzmq
${perf-tool} POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E copy "$<TARGET_FILE:${perf-tool}>"
"${LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION_STRING}/MacOS/${perf-tool}"
VERBATIM
COMMENT "Perf tools")
else()
install(TARGETS ${perf-tool}
RUNTIME DESTINATION bin
COMPONENT PerfTools)
install(TARGETS ${perf-tool} RUNTIME DESTINATION bin COMPONENT PerfTools)
endif()
if(ZMQ_HAVE_WINDOWS_UWP)
set_target_properties(${perf-tool} PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF")
endif()
if(ZMQ_HAVE_WINDOWS_UWP)
set_target_properties(${perf-tool} PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF")
endif()
endforeach()
if(BUILD_STATIC)
add_executable(benchmark_radix_tree perf/benchmark_radix_tree.cpp)
target_link_libraries(benchmark_radix_tree libzmq-static)
target_include_directories(benchmark_radix_tree
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/src")
if(ZMQ_HAVE_WINDOWS_UWP)
set_target_properties(benchmark_radix_tree PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF")
endif()
target_include_directories(benchmark_radix_tree PUBLIC "${CMAKE_CURRENT_LIST_DIR}/src")
if(ZMQ_HAVE_WINDOWS_UWP)
set_target_properties(benchmark_radix_tree PROPERTIES LINK_FLAGS_DEBUG "/OPT:NOICF /OPT:NOREF")
endif()
endif()
elseif(WITH_PERF_TOOL)
message(FATAL_ERROR "Shared library disabled - perf-tools unavailable.")
endif()
elseif(WITH_PERF_TOOL)
message(FATAL_ERROR "Shared library disabled - perf-tools unavailable.")
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# tests
option(BUILD_TESTS "Whether or not to build the tests" ON)
set(ZMQ_BUILD_TESTS ${BUILD_TESTS} CACHE BOOL "Build the tests for ZeroMQ")
set(ZMQ_BUILD_TESTS
${BUILD_TESTS}
CACHE BOOL "Build the tests for ZeroMQ")
if(ZMQ_BUILD_TESTS)
enable_testing() # Enable testing only works in root scope
......@@ -1464,30 +1523,39 @@ if(ZMQ_BUILD_TESTS)
endif()
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# installer
if(MSVC AND(BUILD_SHARED OR BUILD_STATIC))
install(TARGETS ${target_outputs}
if(MSVC AND (BUILD_SHARED OR BUILD_STATIC))
install(
TARGETS ${target_outputs}
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT SDK)
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT SDK)
if(MSVC_IDE)
install(FILES ${PDB_OUTPUT_DIRECTORY}/\${CMAKE_INSTALL_CONFIG_NAME}/${PDB_NAME}.pdb DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT SDK OPTIONAL)
install(
FILES ${PDB_OUTPUT_DIRECTORY}/\${CMAKE_INSTALL_CONFIG_NAME}/${PDB_NAME}.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT SDK
OPTIONAL)
else()
install(FILES ${PDB_OUTPUT_DIRECTORY}/${PDB_NAME}.pdb DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT SDK OPTIONAL)
install(
FILES ${PDB_OUTPUT_DIRECTORY}/${PDB_NAME}.pdb
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT SDK
OPTIONAL)
endif()
if(BUILD_SHARED)
install(TARGETS libzmq
install(
TARGETS libzmq
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT Runtime)
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Runtime)
endif()
elseif(BUILD_SHARED OR BUILD_STATIC)
install(TARGETS ${target_outputs}
install(
TARGETS ${target_outputs}
EXPORT ${PROJECT_NAME}-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
......@@ -1506,35 +1574,43 @@ endforeach()
if(WITH_DOC)
if(NOT ZMQ_BUILD_FRAMEWORK)
install(FILES ${html-docs} DESTINATION doc/zmq COMPONENT RefGuide)
install(
FILES ${html-docs}
DESTINATION doc/zmq
COMPONENT RefGuide)
endif()
endif()
if(WIN32)
set(ZEROMQ_CMAKECONFIG_INSTALL_DIR "CMake" CACHE STRING "install path for ZeroMQConfig.cmake")
set(ZEROMQ_CMAKECONFIG_INSTALL_DIR
"CMake"
CACHE STRING "install path for ZeroMQConfig.cmake")
else()
# CMake search path wants either "share" (AKA GNUInstallDirs DATAROOTDIR)
# for arch-independent, or LIBDIR for arch-dependent, plus "cmake" as prefix
set(ZEROMQ_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE STRING "install path for ZeroMQConfig.cmake")
# CMake search path wants either "share" (AKA GNUInstallDirs DATAROOTDIR) for arch-independent, or LIBDIR for arch-
# dependent, plus "cmake" as prefix
set(ZEROMQ_CMAKECONFIG_INSTALL_DIR
"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
CACHE STRING "install path for ZeroMQConfig.cmake")
endif()
if((NOT CMAKE_VERSION VERSION_LESS 3.0) AND (BUILD_SHARED OR BUILD_STATIC))
export(EXPORT ${PROJECT_NAME}-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
export(EXPORT ${PROJECT_NAME}-targets FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
endif()
configure_package_config_file(builds/cmake/${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
configure_package_config_file(
builds/cmake/${PROJECT_NAME}Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}
COMPATIBILITY AnyNewerVersion)
if(BUILD_SHARED OR BUILD_STATIC)
install(EXPORT ${PROJECT_NAME}-targets
install(
EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}Targets.cmake
DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
endif()
option(ENABLE_CPACK "Enables cpack rules" ON)
......@@ -1555,24 +1631,18 @@ if(MSVC AND ENABLE_CPACK)
set(CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}(${arch_name})")
set(CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-${arch_name}")
# TODO: I think this part was intended to be used when running cpack
# separately from cmake but I don't know how that works.
# TODO: I think this part was intended to be used when running cpack separately from cmake but I don't know how that
# works.
#
# macro(add_crt_version version)
# set(rel_dir "${CMAKE_CURRENT_BINARY_DIR}/build/${arch_name}/${version};ZeroMQ;ALL;/")
# set(debug_dir "${CMAKE_CURRENT_BINARY_DIR}/debug/${arch_name}/${version};ZeroMQ;ALL;/")
# if(EXISTS ${rel_dir})
# list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir})
# endif()
# if(EXISTS ${debug_dir})
# list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir})
# endmacro()
# endmacro()
# add_crt_version(v110)
# add_crt_version(v100)
# add_crt_version(v90)
# macro(add_crt_version version) set(rel_dir
# "${CMAKE_CURRENT_BINARY_DIR}/build/${arch_name}/${version};ZeroMQ;ALL;/")
# set(debug_dir
# "${CMAKE_CURRENT_BINARY_DIR}/debug/${arch_name}/${version};ZeroMQ;ALL;/")
# if(EXISTS ${rel_dir}) list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir}) endif()
# if(EXISTS ${debug_dir}) list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir}) endmacro() endmacro()
# add_crt_version(v110) add_crt_version(v100) add_crt_version(v90)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR})
set(CPACK_GENERATOR "NSIS")
......@@ -1581,10 +1651,9 @@ if(MSVC AND ENABLE_CPACK)
set(CPACK_PACKAGE_VENDOR "Miru")
set(CPACK_NSIS_CONTACT "Steven McCoy <Steven.McCoy@miru.hk>")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}\\\\COPYING.txt")
# set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}\\\\README.txt")
# set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_BINARY_DIR}\\\\WELCOME.txt")
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four(4) backslashes.
# set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}\\\\README.txt") set(CPACK_RESOURCE_FILE_WELCOME
# "${CMAKE_CURRENT_BINARY_DIR}\\\\WELCOME.txt") There is a bug in NSI that does not handle full unix paths properly.
# Make sure there is at least one set of four(4) backslashes.
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico")
......@@ -1594,48 +1663,54 @@ if(MSVC AND ENABLE_CPACK)
set(CPACK_PACKAGE_VERSION_MAJOR ${ZMQ_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${ZMQ_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${ZMQ_VERSION_PATCH})
# set(CPACK_PACKAGE_INSTALL_DIRECTORY "ZMQ Install Directory")
# set(CPACK_TEMPORARY_DIRECTORY "ZMQ Temporary CPack Directory")
# set(CPACK_PACKAGE_INSTALL_DIRECTORY "ZMQ Install Directory") set(CPACK_TEMPORARY_DIRECTORY "ZMQ Temporary CPack
# Directory")
include(CPack)
cpack_add_component_group(Development
DISPLAY_NAME "ZeroMQ software development kit"
EXPANDED)
cpack_add_component(PerfTools
DISPLAY_NAME "ZeroMQ performance tools"
INSTALL_TYPES FullInstall DevInstall)
cpack_add_component(SourceCode
DISPLAY_NAME "ZeroMQ source code"
DISABLED
INSTALL_TYPES FullInstall)
cpack_add_component(SDK
DISPLAY_NAME "ZeroMQ headers and libraries"
INSTALL_TYPES FullInstall DevInstall
GROUP Development)
cpack_add_component_group(Development DISPLAY_NAME "ZeroMQ software development kit" EXPANDED)
cpack_add_component(PerfTools DISPLAY_NAME "ZeroMQ performance tools" INSTALL_TYPES FullInstall DevInstall)
cpack_add_component(SourceCode DISPLAY_NAME "ZeroMQ source code" DISABLED INSTALL_TYPES FullInstall)
cpack_add_component(
SDK
DISPLAY_NAME
"ZeroMQ headers and libraries"
INSTALL_TYPES
FullInstall
DevInstall
GROUP
Development)
if(WITH_DOC)
cpack_add_component(RefGuide
DISPLAY_NAME "ZeroMQ reference guide"
INSTALL_TYPES FullInstall DevInstall
GROUP Development)
cpack_add_component(
RefGuide
DISPLAY_NAME
"ZeroMQ reference guide"
INSTALL_TYPES
FullInstall
DevInstall
GROUP
Development)
endif()
cpack_add_component(Runtime
DISPLAY_NAME "ZeroMQ runtime files"
cpack_add_component(
Runtime
DISPLAY_NAME
"ZeroMQ runtime files"
REQUIRED
INSTALL_TYPES FullInstall DevInstall MinInstall)
cpack_add_install_type(FullInstall
DISPLAY_NAME "Full install, including source code")
cpack_add_install_type(DevInstall
DISPLAY_NAME "Developer install, headers and libraries")
cpack_add_install_type(MinInstall
DISPLAY_NAME "Minimal install, runtime only")
INSTALL_TYPES
FullInstall
DevInstall
MinInstall)
cpack_add_install_type(FullInstall DISPLAY_NAME "Full install, including source code")
cpack_add_install_type(DevInstall DISPLAY_NAME "Developer install, headers and libraries")
cpack_add_install_type(MinInstall DISPLAY_NAME "Minimal install, runtime only")
endif()
# Export this for library to help build this as a sub-project
set(ZEROMQ_LIBRARY libzmq CACHE STRING "ZeroMQ library")
set(ZEROMQ_LIBRARY
libzmq
CACHE STRING "ZeroMQ library")
# Workaround for MSVS10 to avoid the Dialog Hell
# FIXME: This could be removed with future version of CMake.
# Workaround for MSVS10 to avoid the Dialog Hell FIXME: This could be removed with future version of CMake.
if(MSVC_VERSION EQUAL 1600)
set(ZMQ_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/ZeroMQ.sln")
if(EXISTS "${ZMQ_SLN_FILENAME}")
......@@ -1646,11 +1721,13 @@ endif()
# this cannot be moved, as it does not only contain function/macro definitions
include(ClangFormat)
# fixes https://github.com/zeromq/libzmq/issues/3776
# The problem is, both libzmq-static libzmq try to use/generate precompiled.pch at the same time
# Add a dependency, so they run in order and so they dont get in each others way
# TODO still generates warning "build\x64-Debug\ninja : warning : multiple rules generate precompiled.hpp.
# builds involving this target will not be correct; continuing anyway [-w dupbuild=warn]"
if (MSVC AND ENABLE_PRECOMPILED AND BUILD_SHARED AND BUILD_STATIC)
add_dependencies(libzmq-static libzmq)
# fixes https://github.com/zeromq/libzmq/issues/3776 The problem is, both libzmq-static libzmq try to use/generate
# precompiled.pch at the same time Add a dependency, so they run in order and so they dont get in each others way TODO
# still generates warning "build\x64-Debug\ninja : warning : multiple rules generate precompiled.hpp. builds involving
# this target will not be correct; continuing anyway [-w dupbuild=warn]"
if(MSVC
AND ENABLE_PRECOMPILED
AND BUILD_SHARED
AND BUILD_STATIC)
add_dependencies(libzmq-static libzmq)
endif()
# Permission to Relicense under MPLv2
This is a statement by grmt.
that grants permission to relicense its copyrights in the libzmq C++
library (ZeroMQ) under the Mozilla Public License v2 (MPLv2).
A portion of the commits made by the Github handle "grmt", with
commit author "grmt", are copyright of grmt.
This document hereby grants the libzmq project team to relicense libzmq,
including all past, present and future contributions of the author listed above.
grmt (garmt.noname@gmail.com)
2020/05/04
......@@ -4,7 +4,7 @@
################################################################################
if (NOT MSVC)
include(FindPkgConfig)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_SODIUM "libsodium")
if (PC_SODIUM_FOUND)
set(pkg_config_names_private "${pkg_config_names_private} libsodium")
......@@ -39,7 +39,7 @@ find_library(
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SODIUM DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
find_package_handle_standard_args(sodium DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
mark_as_advanced(SODIUM_FOUND SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
################################################################################
......
......@@ -59,14 +59,19 @@
#cmakedefine ZMQ_USE_BUILTIN_SHA1
#cmakedefine ZMQ_USE_NSS
#cmakedefine ZMQ_HAVE_WS
#cmakedefine ZMQ_HAVE_WSS
#cmakedefine ZMQ_HAVE_TIPC
#cmakedefine ZMQ_HAVE_OPENPGM
#cmakedefine ZMQ_MAKE_VALGRIND_HAPPY
#cmakedefine ZMQ_BUILD_DRAFT_API
#cmakedefine ZMQ_HAVE_CURVE
#cmakedefine ZMQ_USE_TWEETNACL
#cmakedefine ZMQ_USE_LIBSODIUM
#cmakedefine SODIUM_STATIC
#cmakedefine ZMQ_USE_GNUTLS
#cmakedefine ZMQ_USE_RADIX_TREE
#ifdef _AIX
#define ZMQ_HAVE_AIX
......
<?xml version="1.0" encoding="utf-8"?>
<!-- These values are populated into the package.gsl templates by package.bat. -->
<!-- The target attribute controls path and file name only, id controls package naming. -->
<package id="libzmq-vc120" target="libzmq" version = "4.2.3.0" pathversion="4_2_3_0" platformtoolset="v120">
<package id="libzmq-vc142" target="libzmq" version = "4.2.3.0" pathversion="4_2_3_0" platformtoolset="v142">
<!--<dependency id="libsodium_vc120" version="1.0.12.0" />-->
</package>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>libzmq-vc120</id>
<version>4.2.3.0</version>
<title>libzmq-vc120</title>
<authors>libzmq contributors</authors>
<owners>Eric Voskuil</owners>
<licenseUrl>https://raw.github.com/zeromq/libzmq/master/COPYING.LESSER</licenseUrl>
<projectUrl>https://github.com/zeromq/libzmq</projectUrl>
<iconUrl>https://avatars1.githubusercontent.com/u/109777?s=32</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<developmentDependency>false</developmentDependency>
<description>The 0MQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products. 0MQ sockets provide an abstraction of asynchronous message queues, multiple messaging patterns, message filtering (subscriptions), seamless access to multiple transport protocols and more.</description>
<summary>The 0MQ lightweight messaging kernel, with tweetnacl integrated, packaged for specific Visual Studio compiler.</summary>
<releaseNotes>https://raw.github.com/zeromq/libzmq/master/NEWS</releaseNotes>
<copyright>GNU Lesser GPL v3</copyright>
<tags>native, libzmq, zmq, 0MQ, messaging, sockets, C++</tags>
<dependencies>
</dependencies>
</metadata>
<files>
<!-- include -->
<file src="..\..\include\*.h" target="build\native\include" />
<file src="..\..\builds\msvc\platform.hpp" target="build\native\include" />
<!-- targets -->
<file src="package.targets" target="build\native\libzmq-vc120.targets" />
<file src="package.xml" target="build\native\package.xml" />
<!-- docs -->
<!-- Documents (.*) -->
<!--<file src="..\..\docs\*" target="build\native\docs" />-->
<!-- libraries -->
<!-- x86 Dynamic libraries (.dll) -->
<file src="..\..\bin\Win32\Release\v120\dynamic\libzmq.dll" target="build\native\bin\libzmq-x86-v120-mt-4_2_3_0.dll" />
<file src="..\..\bin\Win32\Debug\v120\dynamic\libzmq.dll" target="build\native\bin\libzmq-x86-v120-mt-gd-4_2_3_0.dll" />
<!-- x86 Debugging symbols (.pdb) -->
<!--<file src="..\..\bin\Win32\Release\v120\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x86-v120-mt-4_2_3_0.pdb" />-->
<file src="..\..\bin\Win32\Debug\v120\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x86-v120-mt-gd-4_2_3_0.pdb" />
<!-- x86 Import libraries (.imp.lib) -->
<file src="..\..\bin\Win32\Release\v120\dynamic\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-4_2_3_0.imp.lib" />
<file src="..\..\bin\Win32\Debug\v120\dynamic\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-gd-4_2_3_0.imp.lib" />
<!-- x86 Export libraries (.exp) -->
<file src="..\..\bin\Win32\Release\v120\dynamic\libzmq.exp" target="build\native\bin\libzmq-x86-v120-mt-4_2_3_0.exp" />
<file src="..\..\bin\Win32\Debug\v120\dynamic\libzmq.exp" target="build\native\bin\libzmq-x86-v120-mt-gd-4_2_3_0.exp" />
<!-- x86 Static libraries (.lib) -->
<file src="..\..\bin\Win32\Release\v120\static\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-s-4_2_3_0.lib" />
<file src="..\..\bin\Win32\Debug\v120\static\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-sgd-4_2_3_0.lib" />
<!-- x86 Static link time code generation libraries (.ltcg.lib) -->
<file src="..\..\bin\Win32\Release\v120\ltcg\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-s-4_2_3_0.ltcg.lib" />
<file src="..\..\bin\Win32\Debug\v120\ltcg\libzmq.lib" target="build\native\bin\libzmq-x86-v120-mt-sgd-4_2_3_0.ltcg.lib" />
<!-- x64 Dynamic libraries (.dll) -->
<file src="..\..\bin\x64\Release\v120\dynamic\libzmq.dll" target="build\native\bin\libzmq-x64-v120-mt-4_2_3_0.dll" />
<file src="..\..\bin\x64\Debug\v120\dynamic\libzmq.dll" target="build\native\bin\libzmq-x64-v120-mt-gd-4_2_3_0.dll" />
<!-- x64 Debugging symbols (.pdb) -->
<!--<file src="..\..\bin\x64\Release\v120\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x64-v120-mt-4_2_3_0.pdb" />-->
<file src="..\..\bin\x64\Debug\v120\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x64-v120-mt-gd-4_2_3_0.pdb" />
<!-- x64 Import libraries (.imp.lib) -->
<file src="..\..\bin\x64\Release\v120\dynamic\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-4_2_3_0.imp.lib" />
<file src="..\..\bin\x64\Debug\v120\dynamic\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-gd-4_2_3_0.imp.lib" />
<!-- x64 Export libraries (.exp) -->
<file src="..\..\bin\x64\Release\v120\dynamic\libzmq.exp" target="build\native\bin\libzmq-x64-v120-mt-4_2_3_0.exp" />
<file src="..\..\bin\x64\Debug\v120\dynamic\libzmq.exp" target="build\native\bin\libzmq-x64-v120-mt-gd-4_2_3_0.exp" />
<!-- x64 Static libraries (.lib) -->
<file src="..\..\bin\x64\Release\v120\static\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-s-4_2_3_0.lib" />
<file src="..\..\bin\x64\Debug\v120\static\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-sgd-4_2_3_0.lib" />
<!-- x64 Static link time code generation libraries (.ltcg.lib) -->
<file src="..\..\bin\Win32\Release\v120\ltcg\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-s-4_2_3_0.ltcg.lib" />
<file src="..\..\bin\Win32\Debug\v120\ltcg\libzmq.lib" target="build\native\bin\libzmq-x64-v120-mt-sgd-4_2_3_0.ltcg.lib" />
</files>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
</package>
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>libzmq-vc142</id>
<version>4.2.3.0</version>
<title>libzmq-vc142</title>
<authors>libzmq contributors</authors>
<owners>Eric Voskuil</owners>
<licenseUrl>https://raw.github.com/zeromq/libzmq/master/COPYING.LESSER</licenseUrl>
<projectUrl>https://github.com/zeromq/libzmq</projectUrl>
<iconUrl>https://avatars1.githubusercontent.com/u/109777?s=32</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<developmentDependency>false</developmentDependency>
<description>The 0MQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products. 0MQ sockets provide an abstraction of asynchronous message queues, multiple messaging patterns, message filtering (subscriptions), seamless access to multiple transport protocols and more.</description>
<summary>The 0MQ lightweight messaging kernel, with tweetnacl integrated, packaged for specific Visual Studio compiler.</summary>
<releaseNotes>https://raw.github.com/zeromq/libzmq/master/NEWS</releaseNotes>
<copyright>GNU Lesser GPL v3</copyright>
<tags>native, libzmq, zmq, 0MQ, messaging, sockets, C++</tags>
<dependencies>
</dependencies>
</metadata>
<files>
<!-- include -->
<file src="..\..\include\*.h" target="build\native\include" />
<file src="..\..\builds\msvc\platform.hpp" target="build\native\include" />
<!-- targets -->
<file src="package.targets" target="build\native\libzmq-vc142.targets" />
<file src="package.xml" target="build\native\package.xml" />
<!-- docs -->
<!-- Documents (.*) -->
<!--<file src="..\..\docs\*" target="build\native\docs" />-->
<!-- libraries -->
<!-- x86 Dynamic libraries (.dll) -->
<file src="..\..\bin\Win32\Release\v142\dynamic\libzmq.dll" target="build\native\bin\libzmq-x86-v142-mt-4_2_3_0.dll" />
<file src="..\..\bin\Win32\Debug\v142\dynamic\libzmq.dll" target="build\native\bin\libzmq-x86-v142-mt-gd-4_2_3_0.dll" />
<!-- x86 Debugging symbols (.pdb) -->
<!--<file src="..\..\bin\Win32\Release\v142\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x86-v142-mt-4_2_3_0.pdb" />-->
<file src="..\..\bin\Win32\Debug\v142\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x86-v142-mt-gd-4_2_3_0.pdb" />
<!-- x86 Import libraries (.imp.lib) -->
<file src="..\..\bin\Win32\Release\v142\dynamic\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-4_2_3_0.imp.lib" />
<file src="..\..\bin\Win32\Debug\v142\dynamic\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-gd-4_2_3_0.imp.lib" />
<!-- x86 Export libraries (.exp) -->
<file src="..\..\bin\Win32\Release\v142\dynamic\libzmq.exp" target="build\native\bin\libzmq-x86-v142-mt-4_2_3_0.exp" />
<file src="..\..\bin\Win32\Debug\v142\dynamic\libzmq.exp" target="build\native\bin\libzmq-x86-v142-mt-gd-4_2_3_0.exp" />
<!-- x86 Static libraries (.lib) -->
<file src="..\..\bin\Win32\Release\v142\static\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-s-4_2_3_0.lib" />
<file src="..\..\bin\Win32\Debug\v142\static\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-sgd-4_2_3_0.lib" />
<!-- x86 Static link time code generation libraries (.ltcg.lib) -->
<file src="..\..\bin\Win32\Release\v142\ltcg\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-s-4_2_3_0.ltcg.lib" />
<file src="..\..\bin\Win32\Debug\v142\ltcg\libzmq.lib" target="build\native\bin\libzmq-x86-v142-mt-sgd-4_2_3_0.ltcg.lib" />
<!-- x64 Dynamic libraries (.dll) -->
<file src="..\..\bin\x64\Release\v142\dynamic\libzmq.dll" target="build\native\bin\libzmq-x64-v142-mt-4_2_3_0.dll" />
<file src="..\..\bin\x64\Debug\v142\dynamic\libzmq.dll" target="build\native\bin\libzmq-x64-v142-mt-gd-4_2_3_0.dll" />
<!-- x64 Debugging symbols (.pdb) -->
<!--<file src="..\..\bin\x64\Release\v142\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x64-v142-mt-4_2_3_0.pdb" />-->
<file src="..\..\bin\x64\Debug\v142\dynamic\libzmq.pdb" target="build\native\bin\libzmq-x64-v142-mt-gd-4_2_3_0.pdb" />
<!-- x64 Import libraries (.imp.lib) -->
<file src="..\..\bin\x64\Release\v142\dynamic\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-4_2_3_0.imp.lib" />
<file src="..\..\bin\x64\Debug\v142\dynamic\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-gd-4_2_3_0.imp.lib" />
<!-- x64 Export libraries (.exp) -->
<file src="..\..\bin\x64\Release\v142\dynamic\libzmq.exp" target="build\native\bin\libzmq-x64-v142-mt-4_2_3_0.exp" />
<file src="..\..\bin\x64\Debug\v142\dynamic\libzmq.exp" target="build\native\bin\libzmq-x64-v142-mt-gd-4_2_3_0.exp" />
<!-- x64 Static libraries (.lib) -->
<file src="..\..\bin\x64\Release\v142\static\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-s-4_2_3_0.lib" />
<file src="..\..\bin\x64\Debug\v142\static\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-sgd-4_2_3_0.lib" />
<!-- x64 Static link time code generation libraries (.ltcg.lib) -->
<file src="..\..\bin\Win32\Release\v142\ltcg\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-s-4_2_3_0.ltcg.lib" />
<file src="..\..\bin\Win32\Debug\v142\ltcg\libzmq.lib" target="build\native\bin\libzmq-x64-v142-mt-sgd-4_2_3_0.ltcg.lib" />
</files>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
</package>
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- user interface -->
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)package.xml" />
</ItemGroup>
<!-- general -->
<ItemDefinitionGroup>
<ClCompile>
<!-- ZMQ_USE_TWEETNACL defined in packaged builds and must be defined for package consumer. -->
<PreprocessorDefinitions>ZMQ_USE_TWEETNACL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)bin\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Linkage-libzmq)' == 'static' Or '$(Linkage-libzmq)' == 'ltcg'">
<ClCompile>
<PreprocessorDefinitions>ZMQ_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<!-- static libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-s-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-sgd-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-s-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-sgd-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- static ltcg libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-s-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-sgd-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-s-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-sgd-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- dynamic import libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v120-mt-gd-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v120-mt-gd-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- dynamic libraries with debug symbols -->
<Target Name="libzmq_AfterBuild" AfterTargets="AfterBuild" />
<Target Name="libzmq_AfterBuild_Win32_v120_Dynamic_Release"
Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v120-mt-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<!--<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v120-mt-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />-->
</Target>
<Target Name="libzmq_AfterBuild_Win32_v120_Dynamic_Debug"
Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v120-mt-gd-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v120-mt-gd-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />
</Target>
<Target Name="libzmq_AfterBuild_x64_v120_Dynamic_Release"
Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v120-mt-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<!--<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v120-mt-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />-->
</Target>
<Target Name="libzmq_AfterBuild_x64_v120_Dynamic_Debug"
Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v120-mt-gd-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v120-mt-gd-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />
</Target>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
</Project>
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- user interface -->
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)package.xml" />
</ItemGroup>
<!-- general -->
<ItemDefinitionGroup>
<ClCompile>
<!-- ZMQ_USE_TWEETNACL defined in packaged builds and must be defined for package consumer. -->
<PreprocessorDefinitions>ZMQ_USE_TWEETNACL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)bin\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Linkage-libzmq)' == 'static' Or '$(Linkage-libzmq)' == 'ltcg'">
<ClCompile>
<PreprocessorDefinitions>ZMQ_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<!-- static libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-s-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-sgd-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-s-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-sgd-4_2_3_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- static ltcg libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-s-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-sgd-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-s-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'ltcg' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-sgd-4_2_3_0.ltcg.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- dynamic import libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x86-v142-mt-gd-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1">
<Link>
<AdditionalDependencies>libzmq-x64-v142-mt-gd-4_2_3_0.imp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<!-- dynamic libraries with debug symbols -->
<Target Name="libzmq_AfterBuild" AfterTargets="AfterBuild" />
<Target Name="libzmq_AfterBuild_Win32_v142_Dynamic_Release"
Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v142-mt-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<!--<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v142-mt-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />-->
</Target>
<Target Name="libzmq_AfterBuild_Win32_v142_Dynamic_Debug"
Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v142-mt-gd-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x86-v142-mt-gd-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />
</Target>
<Target Name="libzmq_AfterBuild_x64_v142_Dynamic_Release"
Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v142-mt-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<!--<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v142-mt-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />-->
</Target>
<Target Name="libzmq_AfterBuild_x64_v142_Dynamic_Debug"
Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1"
AfterTargets="libzmq_AfterBuild">
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v142-mt-gd-4_2_3_0.dll" DestinationFiles="$(TargetDir)libzmq.dll" SkipUnchangedFiles="true" />
<Copy SourceFiles="$(MSBuildThisFileDirectory)bin\libzmq-x64-v142-mt-gd-4_2_3_0.pdb" DestinationFiles="$(TargetDir)libzmq.pdb" SkipUnchangedFiles="true" />
</Target>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
</Project>
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework">
<Rule Name="Linkage-libzmq-uiextension" PageTemplate="tool" DisplayName="NuGet Dependencies" SwitchPrefix="/" Order="1">
<Rule.Categories>
<Category Name="libzmq" DisplayName="libzmq" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" />
</Rule.DataSource>
<EnumProperty Name="Linkage-libzmq" DisplayName="Linkage" Description="How NuGet libzmq will be linked into the output of this project" Category="libzmq">
<EnumValue Name="" DisplayName="Not linked" />
<EnumValue Name="dynamic" DisplayName="Dynamic (DLL)" />
<EnumValue Name="static" DisplayName="Static (LIB)" />
<EnumValue Name="ltcg" DisplayName="Static using link time compile generation (LTCG)" />
</EnumProperty>
</Rule>
<?xml version="1.0" encoding="utf-8"?>
<!--
#################################################################
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY #
#################################################################
-->
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework">
<Rule Name="Linkage-libzmq-uiextension" PageTemplate="tool" DisplayName="NuGet Dependencies" SwitchPrefix="/" Order="1">
<Rule.Categories>
<Category Name="libzmq" DisplayName="libzmq" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" />
</Rule.DataSource>
<EnumProperty Name="Linkage-libzmq" DisplayName="Linkage" Description="How NuGet libzmq will be linked into the output of this project" Category="libzmq">
<EnumValue Name="" DisplayName="Not linked" />
<EnumValue Name="dynamic" DisplayName="Dynamic (DLL)" />
<EnumValue Name="static" DisplayName="Static (LIB)" />
<EnumValue Name="ltcg" DisplayName="Static using link time compile generation (LTCG)" />
</EnumProperty>
</Rule>
</ProjectSchemaDefinitions>
\ No newline at end of file
......@@ -46,7 +46,9 @@ class ctx_t;
class tcp_address_t;
class udp_address_t;
class ws_address_t;
#ifdef ZMQ_HAVE_WSS
class wss_address_t;
#endif
#if defined ZMQ_HAVE_IPC
class ipc_address_t;
#endif
......@@ -107,6 +109,8 @@ struct address_t
udp_address_t *udp_addr;
#ifdef ZMQ_HAVE_WS
ws_address_t *ws_addr;
#endif
#ifdef ZMQ_HAVE_WSS
wss_address_t *wss_addr;
#endif
#if defined ZMQ_HAVE_IPC
......
......@@ -112,7 +112,8 @@ f_compatible_get_tick_count64 init_compatible_get_tick_count64 ()
func = compatible_get_tick_count64;
#if !defined ZMQ_HAVE_WINDOWS_UWP
::FreeLibrary (module);
if (module != NULL)
::FreeLibrary (module);
#endif
return func;
......
......@@ -54,8 +54,9 @@
#include "ipc_listener.hpp"
#include "tipc_listener.hpp"
#include "tcp_connecter.hpp"
#ifdef ZMQ_HAVE_WS
#include "ws_address.hpp"
#include "wss_address.hpp"
#endif
#include "io_thread.hpp"
#include "session_base.hpp"
#include "config.hpp"
......@@ -72,6 +73,9 @@
#include "mailbox.hpp"
#include "mailbox_safe.hpp"
#ifdef ZMQ_HAVE_WSS
#include "wss_address.hpp"
#endif
#if defined ZMQ_HAVE_VMCI
#include "vmci_address.hpp"
#include "vmci_listener.hpp"
......
......@@ -71,7 +71,7 @@ class stream_engine_base_t : public io_object_t, public i_engine
// i_poll_events interface implementation.
void in_event () ZMQ_FINAL;
void out_event () ZMQ_FINAL;
void out_event ();
void timer_event (int id_) ZMQ_FINAL;
protected:
......
......@@ -39,12 +39,12 @@
#include "tcp.hpp"
#include "address.hpp"
#include "ws_address.hpp"
#include "wss_address.hpp"
#include "session_base.hpp"
#include "ws_engine.hpp"
#include "session_base.hpp"
#ifdef ZMQ_HAVE_WSS
#include "wss_engine.hpp"
#include "wss_address.hpp"
#endif
#if !defined ZMQ_HAVE_WINDOWS
......@@ -120,8 +120,12 @@ void zmq::ws_connecter_t::out_event ()
}
if (_wss)
#ifdef ZMQ_HAVE_WSS
create_engine (fd,
get_socket_name<wss_address_t> (fd, socket_end_local));
#else
assert (false);
#endif
else
create_engine (fd,
get_socket_name<ws_address_t> (fd, socket_end_local));
......@@ -190,7 +194,7 @@ int zmq::ws_connecter_t::open ()
unblock_socket (_s);
// Connect to the remote peer.
#if defined ZMQ_HAVE_VXWORKS
#ifdef ZMQ_HAVE_VXWORKS
int rc = ::connect (_s, (sockaddr *) tcp_addr.addr (), tcp_addr.addrlen ());
#else
const int rc = ::connect (_s, tcp_addr.addr (), tcp_addr.addrlen ());
......
......@@ -128,7 +128,7 @@ zmq::ws_engine_t::ws_engine_t (fd_t fd_,
{
memset (_websocket_key, 0, MAX_HEADER_VALUE_LENGTH + 1);
memset (_websocket_accept, 0, MAX_HEADER_VALUE_LENGTH + 1);
memset (_websocket_protocol, 0, MAX_HEADER_VALUE_LENGTH + 1);
memset (_websocket_protocol, 0, 256);
_next_msg = &ws_engine_t::next_handshake_command;
_process_msg = &ws_engine_t::process_handshake_command;
......@@ -488,7 +488,7 @@ bool zmq::ws_engine_t::server_handshake ()
// Sec-WebSocket-Protocol can appear multiple times or be a comma separated list
// if _websocket_protocol is already set we skip the check
if (_websocket_protocol[0] == '\0') {
char *rest;
char *rest = 0;
char *p = strtok_r (_header_value, ",", &rest);
while (p != NULL) {
if (*p == ' ')
......
......@@ -124,7 +124,7 @@ typedef enum
client_handshake_error = -1
} ws_client_handshake_state_t;
class ws_engine_t ZMQ_FINAL : public stream_engine_base_t
class ws_engine_t : public stream_engine_base_t
{
public:
ws_engine_t (fd_t fd_,
......
......@@ -42,11 +42,11 @@
#include "socket_base.hpp"
#include "address.hpp"
#include "ws_engine.hpp"
#include "wss_address.hpp"
#include "session_base.hpp"
#ifdef ZMQ_HAVE_WSS
#include "wss_engine.hpp"
#include "wss_address.hpp"
#endif
#ifndef ZMQ_HAVE_WINDOWS
......@@ -126,9 +126,11 @@ std::string zmq::ws_listener_t::get_socket_name (zmq::fd_t fd_,
{
std::string socket_name;
#ifdef ZMQ_HAVE_WSS
if (_wss)
socket_name = zmq::get_socket_name<wss_address_t> (fd_, socket_end_);
else
#endif
socket_name = zmq::get_socket_name<ws_address_t> (fd_, socket_end_);
return socket_name + _address.path ();
......@@ -313,6 +315,7 @@ void zmq::ws_listener_t::create_engine (fd_t fd_)
else
engine = new (std::nothrow)
ws_engine_t (fd_, options, endpoint_pair, _address, false);
alloc_assert (engine);
// Choose I/O thread to run connecter in. Given that we are already
......
......@@ -34,7 +34,7 @@
#include "ws_address.hpp"
#include "stream_listener_base.hpp"
#if ZMQ_USE_GNUTLS
#ifdef ZMQ_USE_GNUTLS
#include <gnutls/gnutls.h>
#endif
......@@ -73,7 +73,7 @@ class ws_listener_t ZMQ_FINAL : public stream_listener_base_t
ws_address_t _address;
bool _wss;
#if ZMQ_HAVE_WSS
#ifdef ZMQ_HAVE_WSS
gnutls_certificate_credentials_t _tls_cred;
#endif
......
......@@ -5,110 +5,102 @@ cmake_minimum_required(VERSION "2.8.1")
project(tests)
set(tests
test_ancillaries
test_system
test_pair_inproc
test_pair_tcp
test_reqrep_inproc
test_reqrep_tcp
test_hwm
test_hwm_pubsub
test_reqrep_device
test_sub_forward
test_invalid_rep
test_msg_flags
test_msg_ffn
test_connect_resolve
test_immediate
test_last_endpoint
test_term_endpoint
test_router_mandatory
test_probe_router
test_stream
test_stream_empty
test_stream_disconnect
test_disconnect_inproc
test_unbind_wildcard
test_ctx_options
test_ctx_destroy
test_security_no_zap_handler
test_security_null
test_security_plain
test_security_zap
test_iov
test_spec_req
test_spec_rep
test_spec_dealer
test_spec_router
test_spec_pushpull
test_req_correlate
test_req_relaxed
test_conflate
test_inproc_connect
test_issue_566
test_shutdown_stress
test_timeo
test_many_sockets
test_diffserv
test_connect_rid
test_xpub_nodrop
test_pub_invert_matching
test_setsockopt
test_sockopt_hwm
test_heartbeats
test_atomics
test_bind_src_address
test_capabilities
test_metadata
test_router_handover
test_srcfd
test_stream_timeout
test_xpub_manual
test_xpub_welcome_msg
test_xpub_verbose
test_base85
test_bind_after_connect_tcp
test_sodium
test_monitor
test_socket_null
test_reconnect_ivl
test_mock_pub_sub
)
test_ancillaries
test_system
test_pair_inproc
test_pair_tcp
test_reqrep_inproc
test_reqrep_tcp
test_hwm
test_hwm_pubsub
test_reqrep_device
test_sub_forward
test_invalid_rep
test_msg_flags
test_msg_ffn
test_connect_resolve
test_immediate
test_last_endpoint
test_term_endpoint
test_router_mandatory
test_probe_router
test_stream
test_stream_empty
test_stream_disconnect
test_disconnect_inproc
test_unbind_wildcard
test_ctx_options
test_ctx_destroy
test_security_no_zap_handler
test_security_null
test_security_plain
test_security_zap
test_iov
test_spec_req
test_spec_rep
test_spec_dealer
test_spec_router
test_spec_pushpull
test_req_correlate
test_req_relaxed
test_conflate
test_inproc_connect
test_issue_566
test_shutdown_stress
test_timeo
test_many_sockets
test_diffserv
test_connect_rid
test_xpub_nodrop
test_pub_invert_matching
test_setsockopt
test_sockopt_hwm
test_heartbeats
test_atomics
test_bind_src_address
test_capabilities
test_metadata
test_router_handover
test_srcfd
test_stream_timeout
test_xpub_manual
test_xpub_welcome_msg
test_xpub_verbose
test_base85
test_bind_after_connect_tcp
test_sodium
test_monitor
test_socket_null
test_reconnect_ivl
test_mock_pub_sub)
if(NOT WIN32)
list(APPEND tests
test_security_gssapi)
list(APPEND tests test_security_gssapi test_socks)
endif()
if(ZMQ_HAVE_CURVE)
list(APPEND tests
test_security_curve)
list(APPEND tests test_security_curve)
endif()
option(ENABLE_CAPSH "Run tests that require sudo and capsh (for cap_net_admin)" OFF)
if(ENABLE_CAPSH)
find_program(CAPSH_PROGRAM NAMES capsh)
if (CAPSH_PROGRAM)
list(APPEND tests
test_pair_tcp_cap_net_admin
)
if(CAPSH_PROGRAM)
list(APPEND tests test_pair_tcp_cap_net_admin)
else()
message(STATUS "capsh not found, skipping tests that require CAP_NET_ADMIN")
message(STATUS "capsh not found, skipping tests that require CAP_NET_ADMIN")
endif()
endif()
if(ZMQ_HAVE_IPC)
list(APPEND tests
test_ipc_wildcard
test_pair_ipc
test_reqrep_ipc
test_rebind_ipc
)
list(APPEND tests test_ipc_wildcard test_pair_ipc test_reqrep_ipc test_rebind_ipc)
endif()
if(NOT WIN32)
list(APPEND tests
list(
APPEND
tests
test_proxy
test_proxy_hwm
test_proxy_single_socket
......@@ -118,17 +110,16 @@ if(NOT WIN32)
test_stream_exceeds_buffer
test_router_mandatory_hwm
test_use_fd
test_zmq_poll_fd
)
test_zmq_poll_fd)
if(HAVE_FORK)
list(APPEND tests test_fork)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
list(APPEND tests
test_abstract_ipc
)
list(APPEND tests test_abstract_ipc)
if(ZMQ_HAVE_TIPC)
list(APPEND tests
list(
APPEND
tests
test_address_tipc
test_pair_tipc
test_reqrep_device_tipc
......@@ -137,21 +128,19 @@ if(NOT WIN32)
test_sub_forward_tipc
test_connect_delay_tipc
test_shutdown_stress_tipc
test_term_endpoint_tipc
)
test_term_endpoint_tipc)
endif()
endif()
endif()
if(WITH_VMCI)
list(APPEND tests
test_pair_vmci
test_reqrep_vmci
)
list(APPEND tests test_pair_vmci test_reqrep_vmci)
endif()
if(ENABLE_DRAFTS)
list(APPEND tests
list(
APPEND
tests
test_poller
test_thread_safe
test_client_server
......@@ -164,8 +153,14 @@ if(ENABLE_DRAFTS)
test_xpub_manual_last_value
test_peer
test_reconnect_options
test_msg_init
)
test_msg_init)
endif()
if(ZMQ_HAVE_WS)
list(APPEND tests test_ws_transport)
if(ZMQ_HAVE_WSS)
list(APPEND tests test_wss_transport)
endif()
endif()
# add location of platform.hpp for Windows builds
......@@ -176,12 +171,11 @@ if(WIN32)
link_libraries(ws2_32.lib)
endif()
add_library(unity STATIC
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.c"
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h"
add_library(
unity STATIC
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.c" "${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h"
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity_internals.h")
set_target_properties(unity PROPERTIES
PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h")
set_target_properties(unity PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h")
target_compile_definitions(unity PUBLIC "UNITY_USE_COMMAND_LINE_ARGS" "UNITY_EXCLUDE_FLOAT")
target_include_directories(unity PUBLIC "${CMAKE_CURRENT_LIST_DIR}/../external/unity")
......@@ -193,22 +187,21 @@ set(TESTUTIL_SOURCES
testutil_security.cpp
testutil_security.hpp
testutil_unity.cpp
testutil_unity.hpp
)
testutil_unity.hpp)
if(BUILD_STATIC)
add_library(testutil-static STATIC ${TESTUTIL_SOURCES})
target_link_libraries(testutil-static libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
add_library(testutil-static STATIC ${TESTUTIL_SOURCES})
target_link_libraries(testutil-static libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
endif()
if(BUILD_SHARED)
add_library(testutil STATIC ${TESTUTIL_SOURCES})
target_link_libraries(testutil libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
add_library(testutil STATIC ${TESTUTIL_SOURCES})
target_link_libraries(testutil libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
endif()
if(BUILD_STATIC AND NOT BUILD_SHARED)
# use testutil-static for both tests and unit tests
set(TESTUTIL_LIB testutil-static)
# use testutil-static for both tests and unit tests
set(TESTUTIL_LIB testutil-static)
else()
# use testutil for tests and testutil-static for unit tests
set(TESTUTIL_LIB testutil)
# use testutil for tests and testutil-static for unit tests
set(TESTUTIL_LIB testutil)
endif()
if(MSVC_VERSION LESS 1700)
......@@ -228,18 +221,14 @@ endif()
foreach(test ${tests})
# target_sources not supported before CMake 3.1
if(ZMQ_HAVE_CURVE AND ${test} MATCHES test_security_curve)
add_executable(${test} ${test}.cpp
"../src/tweetnacl.c"
"../src/err.cpp"
"../src/random.cpp"
"../src/clock.cpp")
add_executable(${test} ${test}.cpp "../src/tweetnacl.c" "../src/err.cpp" "../src/random.cpp" "../src/clock.cpp")
else()
add_executable(${test} ${test}.cpp)
endif()
target_link_libraries(${test} ${TESTUTIL_LIB})
if(WIN32)
# This is the output for Debug dynamic builds on Visual Studio 6.0
# You should provide the correct directory, don't know how to do it automatically
# This is the output for Debug dynamic builds on Visual Studio 6.0 You should provide the correct directory, don't
# know how to do it automatically
find_path(LIBZMQ_PATH "libzmq.lib" PATHS "../bin/Win32/Debug/v120/dynamic")
if(NOT ${LIBZMQ_PATH} STREQUAL "LIBZMQ_PATH-NOTFOUND")
set_target_properties(${test} PROPERTIES LINK_FLAGS "/LIBPATH:${LIBZMQ_PATH}")
......@@ -261,9 +250,12 @@ foreach(test ${tests})
endif()
if(WIN32)
add_test(NAME ${test} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${test})
add_test(
NAME ${test}
WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
COMMAND ${test})
else()
if (${test} MATCHES "_cap_net_admin")
if(${test} MATCHES "_cap_net_admin")
add_test(NAME ${test} COMMAND sh -c "sudo ${CAPSH_PROGRAM} --caps=cap_net_admin+eip -- -c $<TARGET_FILE:${test}>")
else()
add_test(NAME ${test} COMMAND ${test})
......@@ -273,7 +265,7 @@ foreach(test ${tests})
set_tests_properties(${test} PROPERTIES SKIP_RETURN_CODE 77)
endforeach()
#override timeout for these tests
# override timeout for these tests
if(ZMQ_HAVE_CURVE)
set_tests_properties(test_security_curve PROPERTIES TIMEOUT 60)
endif()
......@@ -287,8 +279,7 @@ if(WIN32 AND ENABLE_DRAFTS)
set_tests_properties(test_radio_dish PROPERTIES TIMEOUT 30)
endif()
#add additional required flags
#ZMQ_USE_TWEETNACL will already be defined when not using sodium
# add additional required flags ZMQ_USE_TWEETNACL will already be defined when not using sodium
if(ZMQ_HAVE_CURVE AND NOT ZMQ_USE_TWEETNACL)
target_compile_definitions(test_security_curve PRIVATE "-DZMQ_USE_TWEETNACL")
endif()
......@@ -296,7 +287,7 @@ endif()
set_tests_properties(test_security_zap PROPERTIES TIMEOUT 60)
set_tests_properties(test_reconnect_ivl PROPERTIES TIMEOUT 15)
#Check whether all tests in the current folder are present
# Check whether all tests in the current folder are present
file(READ "${CMAKE_CURRENT_LIST_FILE}" CURRENT_LIST_FILE_CONTENT)
file(GLOB ALL_TEST_SOURCES "test_*.cpp")
foreach(TEST_SOURCE ${ALL_TEST_SOURCES})
......
......@@ -27,10 +27,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef _WIN32
#include "../src/windows.hpp"
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
......@@ -104,7 +109,12 @@ void *setup_socks_server (char *socks_server_address,
TEST_ASSERT_NOT_EQUAL (-1, server_fd);
int flag = 1;
int res;
#ifdef _WIN32
res = setsockopt (server_fd, SOL_SOCKET, SO_REUSEADDR, (const char *) &flag,
sizeof (int));
#else
res = setsockopt (server_fd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof (int));
#endif
TEST_ASSERT_SUCCESS_RAW_ERRNO (res);
struct sockaddr_in saddr = bind_bsd_socket (server_fd);
int nbytes = snprintf (socks_server_address, socks_server_address_len,
......
......@@ -35,18 +35,27 @@ SETUP_TEARDOWN_TESTCONTEXT
void test_roundtrip ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/roundtrip")];
char bind_address[MAX_SOCKET_STRING];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_REP);
void *sc = test_context_socket (ZMQ_REQ);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*/roundtrip"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, bind_address, &addr_length));
// Windows can't connect to 0.0.0.0
sprintf (connect_address, "ws://127.0.0.1%s", strrchr (bind_address, ':'));
void *sc = test_context_socket (ZMQ_REQ);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, connect_address));
bounce (sb, sc);
TEST_ASSERT_SUCCESS_ERRNO (zmq_disconnect (sc, connect_address));
TEST_ASSERT_SUCCESS_ERRNO (zmq_unbind (sb, bind_address));
test_context_socket_close (sc);
test_context_socket_close (sb);
}
......@@ -56,7 +65,7 @@ void test_roundtrip_without_path ()
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://127.0.0.1:*"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
......@@ -72,10 +81,10 @@ void test_roundtrip_without_path ()
void test_heartbeat ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/heartbeat")];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*/heartbeat"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://127.0.0.1:*/heartbeat"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
......@@ -105,10 +114,10 @@ void test_heartbeat ()
void test_short_message ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/short")];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*/short"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://127.0.0.1:*/short"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
......@@ -138,10 +147,10 @@ void test_short_message ()
void test_large_message ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/large")];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*/large"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://127.0.0.1:*/large"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
......@@ -172,7 +181,7 @@ void test_large_message ()
void test_curve ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/roundtrip")];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
char client_public[41];
char client_secret[41];
......@@ -190,7 +199,7 @@ void test_curve ()
zmq_setsockopt (server, ZMQ_CURVE_SERVER, &as_server, sizeof (int)));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_setsockopt (server, ZMQ_CURVE_SECRETKEY, server_secret, 41));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (server, "ws://*:*/roundtrip"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (server, "ws://127.0.0.1:*/roundtrip"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_getsockopt (server, ZMQ_LAST_ENDPOINT,
connect_address, &addr_length));
......@@ -212,10 +221,10 @@ void test_curve ()
void test_mask_shared_msg ()
{
char connect_address[MAX_SOCKET_STRING + strlen ("/mask-shared")];
char connect_address[MAX_SOCKET_STRING];
size_t addr_length = sizeof (connect_address);
void *sb = test_context_socket (ZMQ_DEALER);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://*:*/mask-shared"));
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ws://127.0.0.1:*/mask-shared"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, connect_address, &addr_length));
......@@ -268,8 +277,8 @@ int main ()
setup_test_environment ();
UNITY_BEGIN ();
RUN_TEST (test_roundtrip);
RUN_TEST (test_roundtrip_without_path);
RUN_TEST (test_roundtrip);
RUN_TEST (test_short_message);
RUN_TEST (test_large_message);
RUN_TEST (test_heartbeat);
......
......@@ -2,19 +2,15 @@
cmake_minimum_required(VERSION "2.8.1")
set(unittests
unittest_ypipe
unittest_poller
unittest_mtrie
unittest_ip_resolver
unittest_udp_address
unittest_radix_tree
unittest_curve_encoding
)
unittest_ypipe
unittest_poller
unittest_mtrie
unittest_ip_resolver
unittest_udp_address
unittest_radix_tree
unittest_curve_encoding)
#if(ENABLE_DRAFTS)
# list(APPEND tests
# )
#endif(ENABLE_DRAFTS)
# if(ENABLE_DRAFTS) list(APPEND tests ) endif(ENABLE_DRAFTS)
# add location of platform.hpp for Windows builds
if(WIN32)
......@@ -48,7 +44,10 @@ foreach(test ${unittests})
endif()
if(WIN32)
add_test(NAME ${test} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${test})
add_test(
NAME ${test}
WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
COMMAND ${test})
else()
add_test(NAME ${test} COMMAND ${test})
endif()
......@@ -61,8 +60,8 @@ foreach(test ${unittests})
set_target_properties(${test} PROPERTIES LINK_LIBRARIES "${LIBS}")
endforeach()
#Check whether all tests in the current folder are present
#TODO duplicated with tests/CMakeLists.txt, define as a function?
# Check whether all tests in the current folder are present TODO duplicated with tests/CMakeLists.txt, define as a
# function?
file(READ "${CMAKE_CURRENT_LIST_FILE}" CURRENT_LIST_FILE_CONTENT)
file(GLOB ALL_TEST_SOURCES "test_*.cpp")
foreach(TEST_SOURCE ${ALL_TEST_SOURCES})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment