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