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)
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)
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)
endif()
check_c_compiler_flag("-std=gnu11" COMPILER_SUPPORTS_C11)
if(COMPILER_SUPPORTS_C11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
else()
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
endif()
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,25 +101,40 @@ 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)
option(ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" OFF)
endif()
option(WITH_NSS "Use NSS instead of builtin sha1" OFF)
if (ENABLE_WS)
list(APPEND sources
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/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
......@@ -125,62 +143,79 @@ if (ENABLE_WS)
${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")
else()
message(FATAL_ERROR
"nss is not installed. Install it, then run CMake again")
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")
message(WARNING "No nss installed, if you don't want builtin SHA1, install NSS or GnuTLS")
endif()
endif()
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(ENABLE_CURVE)
if(WITH_LIBSODIUM)
find_package("Sodium")
if(SODIUM_FOUND)
message(STATUS "Using libsodium for CURVE security")
include_directories(${SODIUM_INCLUDE_DIRS})
......@@ -190,70 +225,65 @@ elseif(WITH_LIBSODIUM)
set(ZMQ_USE_LIBSODIUM 1)
set(ZMQ_HAVE_CURVE 1)
else()
message(FATAL_ERROR
"libsodium is not installed. Install it, then run CMake again")
message(
WARNING
"libsodium not installed, instead using builtin tweetnacl, you may want to install libsodium and run cmake again"
)
endif()
else()
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)
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")
endif()
else()
option (ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" OFF)
set(pkg_config_defines "")
message(STATUS "CURVE security is disabled")
endif()
if (ENABLE_RADIX_TREE)
message(STATUS "Using radix tree implementation to manage subscriptions")
add_definitions(-DZMQ_USE_RADIX_TREE)
endif()
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
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(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)
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)
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)
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")
if("${verMajor}" MATCHES "10")
set(verMajor "A")
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
endif ("${verMajor}" MATCHES "10")
endif("${verMajor}" MATCHES "10")
# Remove all remaining '.' characters.
string(REPLACE "." "" ver ${ver})
# Prepend each digit with a zero.
......@@ -262,10 +292,11 @@ if (WIN32)
endif(CMAKE_SYSTEM_VERSION)
endmacro(get_WIN32_WINNT)
get_WIN32_WINNT(ZMQ_WIN32_WINNT_DEFAULT)
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
# 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")
......@@ -276,14 +307,23 @@ if (WIN32)
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")
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]")
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,8 +382,7 @@ 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()
......@@ -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})
......@@ -396,12 +441,12 @@ else()
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)
if (ZMQ_HAVE_STL_CONDITION_VARIABLE)
if(ZMQ_HAVE_STL_CONDITION_VARIABLE)
set(ZMQ_CV_IMPL_DEFAULT "stl11")
else()
if(WIN32 AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS "6.0")
......@@ -415,7 +460,9 @@ if(NOT ZMQ_CV_IMPL)
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
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()
......@@ -431,7 +478,7 @@ elseif(ZMQ_CV_IMPL STREQUAL "none")
else()
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,7 +642,9 @@ 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(
"\
......@@ -615,7 +668,7 @@ if(NOT ANDROID)
zmq_check_noexcept()
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
if(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
zmq_check_sock_cloexec()
zmq_check_o_cloexec()
......@@ -653,23 +706,25 @@ 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
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)
message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
else()
find_path(OPENPGM_ROOT include/pgm/pgm.h
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}]"
......@@ -679,8 +734,9 @@ 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)
......@@ -690,9 +746,9 @@ else()
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})
......@@ -700,8 +756,10 @@ else()
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,8 +838,7 @@ if(MSVC)
endif()
endif()
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# source files
set(cxx-sources
......@@ -1025,8 +1082,7 @@ set(cxx-sources
ypipe_conflate.hpp
yqueue.hpp
zap_client.hpp
zmtp_engine.hpp
)
zmtp_engine.hpp)
if(MINGW)
# Generate the right type when using -m32 or -m64
......@@ -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})
......@@ -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})
......@@ -1145,13 +1193,8 @@ if (WITH_DOCS)
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}
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}")
......@@ -1164,8 +1207,8 @@ 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"
COMMAND ${CMAKE_COMMAND} ARGS -E make_directory
"${CMAKE_LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION}/MacOS"
COMMENT "Perf tools")
endif()
......@@ -1175,56 +1218,43 @@ 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_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
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}"
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}"
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}"
......@@ -1237,95 +1267,104 @@ if(MSVC)
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}"
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}"
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)
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")
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")
if(ZMQ_BUILD_FRAMEWORK)
set_target_properties(libzmq PROPERTIES
FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER "org.zeromq.libzmq"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${ZMQ_VERSION}
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_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})
......@@ -1412,19 +1458,33 @@ 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")
......@@ -1434,25 +1494,24 @@ if(BUILD_SHARED)
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")
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()
endif()
elseif(WITH_PERF_TOOL)
elseif(WITH_PERF_TOOL)
message(FATAL_ERROR "Shared library disabled - perf-tools unavailable.")
endif()
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,30 +1574,38 @@ 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
......@@ -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)
endif()
cpack_add_component(Runtime
DISPLAY_NAME "ZeroMQ runtime files"
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"
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)
# 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
......@@ -6,9 +6,9 @@
-->
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>libzmq-vc120</id>
<id>libzmq-vc142</id>
<version>4.2.3.0</version>
<title>libzmq-vc120</title>
<title>libzmq-vc142</title>
<authors>libzmq contributors</authors>
<owners>Eric Voskuil</owners>
<licenseUrl>https://raw.github.com/zeromq/libzmq/master/COPYING.LESSER</licenseUrl>
......@@ -32,7 +32,7 @@
<!-- targets -->
<file src="package.targets" target="build\native\libzmq-vc120.targets" />
<file src="package.targets" target="build\native\libzmq-vc142.targets" />
<file src="package.xml" target="build\native\package.xml" />
<!-- docs -->
......@@ -43,52 +43,52 @@
<!-- 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" />
<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\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" />
<!--<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\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" />
<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\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" />
<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\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" />
<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\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" />
<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\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" />
<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\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" />
<!--<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\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" />
<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\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" />
<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\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" />
<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\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" />
<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>
<!--
#################################################################
......
......@@ -29,96 +29,96 @@
</ItemDefinitionGroup>
<!-- static libraries -->
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'static' And $(Configuration.IndexOf('Release')) != -1">
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' 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>
<AdditionalDependencies>libzmq-x86-v142-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">
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' 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>
<AdditionalDependencies>libzmq-x86-v142-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">
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' 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>
<AdditionalDependencies>libzmq-x64-v142-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">
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' 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>
<AdditionalDependencies>libzmq-x64-v142-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">
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' 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>
<AdditionalDependencies>libzmq-x86-v142-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">
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' 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>
<AdditionalDependencies>libzmq-x86-v142-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">
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' 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>
<AdditionalDependencies>libzmq-x64-v142-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">
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' 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>
<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)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1">
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' 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>
<AdditionalDependencies>libzmq-x86-v142-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">
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v142' 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>
<AdditionalDependencies>libzmq-x86-v142-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">
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' 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>
<AdditionalDependencies>libzmq-x64-v142-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">
<ItemDefinitionGroup Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v142' 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>
<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_v120_Dynamic_Release"
Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1"
<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-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" />-->
<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_v120_Dynamic_Debug"
Condition="'$(Platform)' == 'Win32' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1"
<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-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" />
<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_v120_Dynamic_Release"
Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Release')) != -1"
<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-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" />-->
<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_v120_Dynamic_Debug"
Condition="'$(Platform)' == 'x64' And ('$(PlatformToolset)' == 'v120' Or '$(PlatformToolset)' == 'CTP_Nov2013') And '$(Linkage-libzmq)' == 'dynamic' And $(Configuration.IndexOf('Debug')) != -1"
<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-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" />
<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>
<!--
......
......@@ -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,6 +112,7 @@ f_compatible_get_tick_count64 init_compatible_get_tick_count64 ()
func = compatible_get_tick_count64;
#if !defined ZMQ_HAVE_WINDOWS_UWP
if (module != NULL)
::FreeLibrary (module);
#endif
......
......@@ -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
......
......@@ -72,43 +72,35 @@ set(tests
test_monitor
test_socket_null
test_reconnect_ivl
test_mock_pub_sub
)
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")
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,8 +187,7 @@ 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)
......@@ -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);
......
......@@ -8,13 +8,9 @@ set(unittests
unittest_ip_resolver
unittest_udp_address
unittest_radix_tree
unittest_curve_encoding
)
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