Commit 949d1578 authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #492 from arsenm/master

Make CMake build usable for other systems
parents c7009d27 6ce46441
# CMake build script for ZeroMQ on Windows # CMake build script for ZeroMQ
cmake_minimum_required (VERSION 2.8) cmake_minimum_required(VERSION 2.8)
project (ZeroMQ) project(ZeroMQ)
include (${CMAKE_SOURCE_DIR}/cmake/Modules/TestZMQVersion.cmake) option(WITH_OPENPGM "Build with support for OpenPGM" OFF)
option (WITH_DOC "Build Reference Guide documentation (requires DocBook)" OFF) if(APPLE)
option (WITH_OPENPGM "Build with support for OpenPGM" OFF) option(ZMQ_BUILD_FRAMEWORK "Build as OS X framework" ON)
endif()
# WARNING: Windows Python will override Cygwin yet not work with Asciidoc.
#find_package (PythonInterp REQUIRED)
# Workaround, manually set Python location set(POLLER "" CACHE STRING "Choose polling system manually. valid values are
set(PYTHON_EXECUTABLE c:/cygwin/bin/python2.6.exe CACHE FILEPATH "Python interpreter executable") kqueue, epoll, devpoll, poll or select [default=autodetect]")
# TODO: Replace with FindAsciidoc.cmake
set(ASCIIDOC_EXECUTABLE c:/cygwin/bin/asciidoc CACHE FILEPATH "AsciiDoc executable") if( NOT POLLER STREQUAL ""
AND NOT POLLER STREQUAL "kqueue"
if (WITH_OPENPGM) AND NOT POLLER STREQUAL "epoll"
# set(OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM") AND NOT POLLER STREQUAL "devpoll"
set(OPENPGM_VERSION_MAJOR 5) AND NOT POLLER STREQUAL "poll"
set(OPENPGM_VERSION_MINOR 2) AND NOT POLLER STREQUAL "select")
set(OPENPGM_VERSION_MICRO 122) message(FATAL_ERROR "Invalid polling method")
if (CMAKE_CL_64) endif()
find_path(OPENPGM_ROOT include/pgm/pgm.h
PATHS if(NOT ${POLLER} STREQUAL "")
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]" string(TOUPPER ${POLLER} UPPER_POLLER)
NO_DEFAULT_PATH set(ZMQ_FORCE_${UPPER_POLLER} 1)
) endif()
message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
else (CMAKE_CL_64) set(ZMQ_CMAKE_MODULES_DIR ${CMAKE_CURRENT_LIST_DIR}/cmake/Modules)
find_path(OPENPGM_ROOT include/pgm/pgm.h list(APPEND CMAKE_MODULE_PATH ${ZMQ_CMAKE_MODULES_DIR})
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]" include(TestZMQVersion)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]" include(ZMQSourceRunChecks)
NO_DEFAULT_PATH include(CheckIncludeFiles)
) include(CheckLibraryExists)
message(STATUS "OpenPGM x86 detected - ${OPENPGM_ROOT}") include(CheckFunctionExists)
endif (CMAKE_CL_64) include(CheckCCompilerFlag)
set(OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include) include(CheckCXXCompilerFlag)
set(OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib) include(CheckCSourceCompiles)
set(OPENPGM_LIBRARIES include(CheckCSourceRuns)
optimized libpgm${_zmq_COMPILER}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib include(CMakeDependentOption)
debug libpgm${_zmq_COMPILER}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
endif (WITH_OPENPGM) check_include_files(ifaddrs.h ZMQ_HAVE_IFADDRS)
check_include_files(windows.h HAVE_WINDOWS_H)
mark_as_advanced(PYTHON_EXECUTABLE ASCIIDOC_EXECUTABLE) check_include_files(sys/uio.h ZMQ_HAVE_UIO)
check_include_files(sys/eventfd.h ZMQ_HAVE_EVENTFD)
check_library_exists(ws2_32 printf "" HAVE_WS2_32) # TODO: Why doesn't something logical like WSAStartup work?
check_library_exists(ws2 printf "" HAVE_WS2)
check_library_exists(rpcrt4 printf "" HAVE_RPCRT4) # UuidCreateSequential
check_library_exists(iphlpapi printf "" HAVE_IPHLAPI) # GetAdaptersAddresses
find_package(Threads)
if(WIN32 AND NOT CYGWIN)
if(NOT HAVE_WS2_32 AND NOT HAVE_WS2)
message(FATAL_ERROR "Cannot link to ws2_32 or ws2")
endif()
if(NOT HAVE_RPCRT4)
message(FATAL_ERROR "Cannot link to rpcrt4")
endif()
if(NOT HAVE_IPHLAPI)
message(FATAL_ERROR "Cannot link to iphlapi")
endif()
endif()
set(CMAKE_REQUIRED_LIBRARIES rt)
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
set(CMAKE_REQUIRED_LIBRARIES )
set(CMAKE_REQUIRED_INCLUDES sys/time.h)
check_function_exists(gethrtime HAVE_GETHRTIME)
set(CMAKE_REQUIRED_INCLUDES )
add_definitions(-D_REENTRANT -D_THREAD_SAFE)
if(WIN32)
add_definitions(-DDLL_EXPORT)
endif()
option(ENABLE_EVENTFD "Enable/disable eventfd" ZMQ_HAVE_EVENTFD)
macro(zmq_check_cxx_flag_prepend flag)
check_cxx_compiler_flag("${flag}" HAVE_FLAG_${flag})
if(HAVE_FLAG_${flag})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
endif()
endmacro()
if(MSVC)
zmq_check_cxx_flag_prepend("/W3")
else()
zmq_check_cxx_flag_prepend("-Wall")
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
zmq_check_cxx_flag_prepend("-Wextra")
endif()
zmq_check_cxx_flag_prepend("-Wno-long-long")
zmq_check_cxx_flag_prepend("-Wno-uninitialized")
option(LIBZMQ_PEDANTIC "" ON)
option(LIBZMQ_WERROR "" OFF)
if(LIBZMQ_PEDANTIC)
zmq_check_cxx_flag_prepend("-pedantic")
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")
zmq_check_cxx_flag_prepend("-strict-ansi")
endif()
if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
zmq_check_cxx_flag_prepend("-compat=5")
endif()
endif()
if(LIBZMQ_WERROR)
zmq_check_cxx_flag_prepend("-Werror")
zmq_check_cxx_flag_prepend("-errwarn=%all")
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
zmq_check_cxx_flag_prepend("-mcpu=v9")
endif()
if(${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
zmq_check_cxx_flag_prepend("-features=zla")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "SunOS" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD")
message(STATUS "Checking whether atomic operations can be used")
check_c_source_compiles(
"
#include <atomic.h>
int main()
{
uint32_t value;
atomic_cas_32(&value, 0, 0);
return 0;
}
"
HAVE_ATOMIC_H)
if(NOT HAVE_ATOMIC_H)
set(ZMQ_FORCE_MUTEXES 1)
endif()
endif()
#-----------------------------------------------------------------------------
zmq_check_sock_cloexec()
zmq_check_so_keepalive()
zmq_check_tcp_keepcnt()
zmq_check_tcp_keepidle()
zmq_check_tcp_keepintvl()
zmq_check_tcp_keepalive()
if( CMAKE_SYSTEM_NAME MATCHES "Linux"
OR CMAKE_SYSTEM_NAME MATCHES "GNU/kFreeBSD"
OR CMAKE_SYSTEM_NAME MATCHES "GNU/Hurd"
OR CYGWIN)
add_definitions(-D_GNU_SOURCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_definitions(-D__BSD_VISIBLE)
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
add_definitions(-D_NETBSD_SOURCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
add_definitions(-D_OPENBSD_SOURCE)
elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
add_definitions(-D_PTHREADS)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
add_definitions(-D_POSIX_C_SOURCE=200112L)
zmq_check_cxx_flag_prepend(-Ae)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions(-D_DARWIN_C_SOURCE)
endif()
set(CMAKE_PYTHON_VERSION 2.7 2.6 2.5 2.4)
find_package(PythonInterp)
find_package(AsciiDoc)
cmake_dependent_option(WITH_DOC "Build Reference Guide documentation(requires DocBook)" ON
"PYTHON_FOUND;ASCIIDOC_FOUND" OFF)
if(MSVC)
if(WITH_OPENPGM)
# set(OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM")
set(OPENPGM_VERSION_MAJOR 5)
set(OPENPGM_VERSION_MINOR 2)
set(OPENPGM_VERSION_MICRO 122)
if(CMAKE_CL_64)
find_path(OPENPGM_ROOT include/pgm/pgm.h
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
NO_DEFAULT_PATH
)
message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
else()
find_path(OPENPGM_ROOT include/pgm/pgm.h
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
NO_DEFAULT_PATH
)
message(STATUS "OpenPGM x86 detected - ${OPENPGM_ROOT}")
endif(CMAKE_CL_64)
set(OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include)
set(OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib)
set(OPENPGM_LIBRARIES
optimized libpgm${_zmq_COMPILER}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib
debug libpgm${_zmq_COMPILER}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
endif()
else()
if(WITH_OPENPGM)
message(FATAL_ERROR "WITH_OPENPGM not implemented")
# DSO symbol visibility for openpgm
if(HAVE_FLAG_VISIBILITY_HIDDEN)
elseif(HAVE_FLAG_LDSCOPE_HIDDEN)
endif()
endif()
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# force off-tree build # force off-tree build
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_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.:
del CMakeCache.txt rm CMakeCache.txt
mkdir cmake-make mkdir cmake-make
cd cmake-make cd cmake-make
cmake .. cmake ..
") ")
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# default to Release build # default to Release build
...@@ -66,330 +254,469 @@ if(NOT CMAKE_BUILD_TYPE) ...@@ -66,330 +254,469 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE) FORCE)
endif(NOT CMAKE_BUILD_TYPE) endif()
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# platform specifics # platform specifics
add_definitions( if(MSVC)
-DWIN32 add_definitions(
-DDLL_EXPORT -DWIN32
# NB: May require tweaking for highly connected applications. -DDLL_EXPORT
-DFD_SETSIZE=1024 # NB: May require tweaking for highly connected applications.
-D_CRT_SECURE_NO_WARNINGS -DFD_SETSIZE=1024
) -D_CRT_SECURE_NO_WARNINGS)
# Parallel make. # Parallel make.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
# Optimization flags.
# http://msdn.microsoft.com/en-us/magazine/cc301698.aspx
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
endif()
# Optimization flags.
# http://msdn.microsoft.com/en-us/magazine/cc301698.aspx
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# source files # source files
set(cxx-sources set(cxx-sources
address.cpp address.cpp
clock.cpp clock.cpp
ctx.cpp ctx.cpp
dealer.cpp dealer.cpp
decoder.cpp decoder.cpp
devpoll.cpp devpoll.cpp
dist.cpp dist.cpp
encoder.cpp encoder.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
msg.cpp msg.cpp
mtrie.cpp mtrie.cpp
object.cpp object.cpp
options.cpp options.cpp
own.cpp own.cpp
pair.cpp pair.cpp
pgm_receiver.cpp pgm_receiver.cpp
pgm_sender.cpp pgm_sender.cpp
pgm_socket.cpp pgm_socket.cpp
pipe.cpp pipe.cpp
poll.cpp poll.cpp
poller_base.cpp poller_base.cpp
precompiled.cpp precompiled.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
reaper.cpp reaper.cpp
rep.cpp rep.cpp
req.cpp req.cpp
router.cpp router.cpp
select.cpp select.cpp
session_base.cpp session_base.cpp
signaler.cpp signaler.cpp
socket_base.cpp socket_base.cpp
stream_engine.cpp stream_engine.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
v1_decoder.cpp v1_decoder.cpp
v1_encoder.cpp v1_encoder.cpp
xpub.cpp xpub.cpp
xsub.cpp xsub.cpp
zmq.cpp zmq.cpp
zmq_utils.cpp zmq_utils.cpp)
)
set(rc-sources version.rc)
set(rc-sources
version.rc if(MINGW)
) # Generate the right type when using -m32 or -m64
macro(set_rc_arch rc_target)
include_directories( set(CMAKE_RC_COMPILER_INIT windres)
include enable_language(RC)
${CMAKE_BINARY_DIR} set(CMAKE_RC_COMPILE_OBJECT
) "<CMAKE_RC_COMPILER> <FLAGS> --target=${rc_target} <DEFINES> -i <SOURCE> -o <OBJECT>")
set(headers endmacro()
include/zmq.h
include/zmq_utils.h if( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i386"
) OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i486"
set(readme-docs OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i586"
AUTHORS OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i686"
COPYING # This also happens on x86_64 systems...what a worthless variable
COPYING.LESSER OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86"
MAINTAINERS OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64"
NEWS OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "amd64")
README
) if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set_rc_arch("pe-x86-64")
else()
set_rc_arch("pe-i386")
endif()
endif()
endif()
include_directories(include ${CMAKE_CURRENT_BINARY_DIR})
set(public_headers include/zmq.h
include/zmq_utils.h)
set(readme-docs AUTHORS
COPYING
COPYING.LESSER
MAINTAINERS
NEWS
README)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# optional modules # optional modules
if(WITH_OPENPGM) if(WITH_OPENPGM)
add_definitions( add_definitions(-DZMQ_HAVE_OPENPGM)
-DZMQ_HAVE_OPENPGM include_directories(${OPENPGM_INCLUDE_DIRS})
) link_directories(${OPENPGM_LIBRARY_DIRS})
include_directories( set(OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES})
${OPENPGM_INCLUDE_DIRS}
)
link_directories(
${OPENPGM_LIBRARY_DIRS}
)
set(OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES})
endif(WITH_OPENPGM) endif(WITH_OPENPGM)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# source generators # source generators
foreach (source ${cxx-sources}) foreach(source ${cxx-sources})
list(APPEND sources ${CMAKE_SOURCE_DIR}/src/${source}) list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/${source})
endforeach() endforeach()
foreach (source ${rc-sources}) foreach(source ${rc-sources})
list(APPEND sources ${CMAKE_BINARY_DIR}/${source}) list(APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/${source})
configure_file(${CMAKE_SOURCE_DIR}/src/${source}.in ${CMAKE_BINARY_DIR}/${source})
endforeach() endforeach()
add_custom_command( foreach(source ${rc-sources})
OUTPUT ${CMAKE_BINARY_DIR}/platform.hpp list(APPEND sources ${CMAKE_BINARY_DIR}/${source})
COMMAND ${CMAKE_COMMAND} configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/${source}.in ${CMAKE_CURRENT_BINARY_DIR}/${source})
ARGS -E endforeach()
copy
${CMAKE_SOURCE_DIR}/builds/msvc/platform.hpp configure_file(${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/platform.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp)
${CMAKE_BINARY_DIR}/platform.hpp list(APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp)
DEPENDS ${CMAKE_SOURCE_DIR}/builds/msvc/platform.hpp
) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/libzmq.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc)
list(APPEND sources ${CMAKE_BINARY_DIR}/platform.hpp) set(zmq-pkgconfig ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc)
if (CMAKE_CL_64) if(NOT ZMQ_BUILD_FRAMEWORK)
set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template64.in) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc DESTINATION lib/pkgconfig)
else (CMAKE_CL_64) endif()
set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template32.in)
endif (CMAKE_CL_64)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/NSIS.template.in if(MSVC)
COMMAND ${CMAKE_COMMAND} if(CMAKE_CL_64)
ARGS -E set(nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/cmake/NSIS.template64.in)
copy else()
${nsis-template} set(nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/cmake/NSIS.template32.in)
${CMAKE_BINARY_DIR}/NSIS.template.in endif()
DEPENDS ${nsis-template}
) add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc) COMMAND ${CMAKE_COMMAND}
file(GLOB docs RELATIVE ${CMAKE_BINARY_DIR}/ "${CMAKE_SOURCE_DIR}/doc/*.txt") ARGS -E
set (html-docs) copy
foreach (txt ${docs}) ${nsis-template}
string (REGEX REPLACE ".*/(.*)\\.txt" "\\1.html" html ${txt}) ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
set (src ${txt}) DEPENDS ${nsis-template})
set (dst doc/${html}) endif()
add_custom_command(
OUTPUT ${dst} file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
COMMAND ${PYTHON_EXECUTABLE} file(GLOB docs RELATIVE ${CMAKE_CURRENT_BINARY_DIR}/ "${CMAKE_CURRENT_SOURCE_DIR}/doc/*.txt")
ARGS -x set(html-docs)
${ASCIIDOC_EXECUTABLE} foreach(txt ${docs})
-d manpage string(REGEX REPLACE ".*/(.*)\\.txt" "\\1.html" html ${txt})
-b xhtml11 set(src ${txt})
-f ${CMAKE_SOURCE_DIR}/doc/asciidoc.conf set(dst doc/${html})
-azmq_version=${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH} add_custom_command(
-o ${dst} OUTPUT ${dst}
${src} COMMAND ${PYTHON_EXECUTABLE}
DEPENDS ${CMAKE_BINARY_DIR}/${src} ARGS -x
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ${ASCIIDOC_EXECUTABLE}
COMMENT "Generating ${html}" -d manpage
) -b xhtml11
if (WITH_DOC) -f ${CMAKE_SOURCE_DIR}/doc/asciidoc.conf
list(APPEND html-docs ${CMAKE_BINARY_DIR}/${dst}) -azmq_version=${ZMQ_VERSION}
endif (WITH_DOC) -f ${CMAKE_CURRENT_SOURCE_DIR}/doc/asciidoc.conf
endforeach (txt ${docs}) -azmq_version=${ZMQ_VERSION}
-o ${dst}
${src}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${src}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating ${html}")
if(WITH_DOC)
list(APPEND html-docs ${CMAKE_CURRENT_BINARY_DIR}/${dst})
endif()
endforeach()
if(ZMQ_BUILD_FRAMEWORK)
add_custom_command(
TARGET libzmq
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E make_directory "${CMAKE_LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION}/MacOS"
COMMENT "Perf tools")
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# output # output
add_library(libzmq SHARED ${sources} ${html-docs} ${CMAKE_BINARY_DIR}/NSIS.template.in) if(MSVC)
target_link_libraries(libzmq ws2_32.lib rpcrt4.lib ${OPTIONAL_LIBRARIES}) add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in)
set_target_properties(libzmq PROPERTIES target_link_libraries(libzmq ${OPTIONAL_LIBRARIES})
RELEASE_POSTFIX "${_zmq_COMPILER}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}" set_target_properties(libzmq PROPERTIES
DEBUG_POSTFIX "${_zmq_COMPILER}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}") PUBLIC_HEADER "${public_headers}"
RELEASE_POSTFIX "${_zmq_COMPILER}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
DEBUG_POSTFIX "${_zmq_COMPILER}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}")
else()
add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig})
if(ZMQ_BUILD_FRAMEWORK)
set_target_properties(libzmq PROPERTIES
FRAMEWORK TRUE
OUTPUT_NAME "ZeroMQ"
PUBLIC_HEADER "${public_headers}"
MACOSX_FRAMEWORK_IDENTIFIER "org.zeromq.libzmq"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${ZMQ_VERSION}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${ZMQ_VERSION}
VERSION ${ZMQ_VERSION}
SOVERSION "${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.0")
set_source_files_properties(${html-docs} PROPERTIES
MACOSX_PACKAGE_LOCATION doc)
set_source_files_properties(${readme-docs} PROPERTIES
MACOSX_PACKAGE_LOCATION etc)
set_source_files_properties(${zmq-pkgconfig} PROPERTIES
MACOSX_PACKAGE_LOCATION lib/pkgconfig)
else()
set_target_properties(libzmq PROPERTIES
OUTPUT_NAME "zmq"
PUBLIC_HEADER "${public_headers}")
endif()
endif()
target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})
if(HAVE_WS2_32)
target_link_libraries(libzmq ws2_32)
elseif(HAVE_WS2)
target_link_libraries(libzmq ws2)
endif()
if(HAVE_RPCRT4)
target_link_libraries(libzmq rpcrt4)
endif()
if(HAVE_IPHLAPI)
target_link_libraries(libzmq iphlpapi)
endif()
set(perf-tools local_lat
remote_lat
local_thr
remote_thr
inproc_lat
inproc_thr)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # Why?
foreach(perf-tool ${perf-tools})
add_executable(${perf-tool} perf/${perf-tool}.cpp)
target_link_libraries(${perf-tool} libzmq)
if(ZMQ_BUILD_FRAMEWORK)
# Copy perf-tools binaries into Framework
add_custom_command(
TARGET libzmq ${perf-tool}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy "$<TARGET_FILE:${perf-tool}>" "${LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION_STRING}/MacOS/${perf-tool}"
VERBATIM
COMMENT "Perf tools")
else()
install(TARGETS ${perf-tool}
RUNTIME DESTINATION bin
COMPONENT PerfTools)
endif()
endforeach()
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# installer # installer
install (TARGETS libzmq ARCHIVE DESTINATION lib COMPONENT SDK) if(MSVC)
if (CMAKE_BUILD_TYPE STREQUAL "Debug") install(TARGETS libzmq
install (TARGETS libzmq RUNTIME DESTINATION bin COMPONENT SDK) ARCHIVE DESTINATION lib
install (FILES ${CMAKE_BINARY_DIR}/lib/libzmq${_zmq_COMPILER}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}.pdb DESTINATION lib COMPONENT SDK) LIBRARY DESTINATION lib
else (CMAKE_BUILD_TYPE STREQUAL "Debug") PUBLIC_HEADER DESTINATION include
install (TARGETS libzmq RUNTIME DESTINATION bin COMPONENT Runtime) COMPONENT SDK)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install (FILES ${headers} DESTINATION include COMPONENT SDK) install(TARGETS libzmq
RUNTIME DESTINATION bin
set (perf-tools PUBLIC_HEADER DESTINATION include
local_lat COMPONENT SDK)
remote_lat install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib/libzmq${_zmq_COMPILER}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}.pdb DESTINATION lib
local_thr COMPONENT SDK)
remote_thr else()
inproc_lat install(TARGETS libzmq
inproc_thr RUNTIME DESTINATION bin
) PUBLIC_HEADER DESTINATION include
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") COMPONENT Runtime)
foreach (perf-tool ${perf-tools}) endif()
add_executable (${perf-tool} perf/${perf-tool}.cpp) else()
target_link_libraries (${perf-tool} libzmq) install(TARGETS libzmq
install (TARGETS ${perf-tool} RUNTIME DESTINATION bin COMPONENT PerfTools) RUNTIME DESTINATION bin
endforeach (perf-tool ${perf-tools}) ARCHIVE DESTINATION lib
endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") LIBRARY DESTINATION lib
FRAMEWORK DESTINATION "Library/Frameworks"
file(GLOB headers "${CMAKE_SOURCE_DIR}/src/*.hpp") PUBLIC_HEADER DESTINATION include)
install (FILES ${sources} ${headers} DESTINATION src COMPONENT SourceCode) endif()
foreach (readme ${readme-docs}) # install(FILES ${public_headers}
configure_file (${CMAKE_SOURCE_DIR}/${readme} ${CMAKE_BINARY_DIR}/${readme}.txt) # DESTINATION include
install (FILES ${CMAKE_BINARY_DIR}/${readme}.txt DESTINATION .) # COMPONENT SDK)
endforeach (readme ${readme-docs})
if (WITH_DOC) if(NOT ZMQ_BUILD_FRAMEWORK)
install (FILES ${html-docs} DESTINATION doc COMPONENT RefGuide) file(GLOB private_headers "${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp")
endif (WITH_DOC) install(FILES ${sources} ${private_headers} DESTINATION src/zmq
COMPONENT SourceCode)
include (InstallRequiredSystemLibraries) endif()
if (CMAKE_CL_64) foreach(readme ${readme-docs})
set (CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH} (x64)") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${readme} ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt)
set (CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-x64")
set (CPACK_INSTALL_CMAKE_PROJECTS if(NOT ZMQ_BUILD_FRAMEWORK)
"${CMAKE_SOURCE_DIR}/build/x64/v110;ZeroMQ;ALL;/" if(MSVC)
"${CMAKE_SOURCE_DIR}/debug/x64/v110;ZeroMQ;ALL;/" install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt DESTINATION .)
"${CMAKE_SOURCE_DIR}/build/x64/v100;ZeroMQ;ALL;/" else()
"${CMAKE_SOURCE_DIR}/debug/x64/v100;ZeroMQ;ALL;/" install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt DESTINATION etc/zmq)
"${CMAKE_SOURCE_DIR}/build/x64/v90;ZeroMQ;ALL;/" endif()
"${CMAKE_SOURCE_DIR}/debug/x64/v90;ZeroMQ;ALL;/" endif()
) endforeach()
else (CMAKE_CL_64)
set (CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}") if(WITH_DOC)
set (CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-x86") if(NOT ZMQ_BUILD_FRAMEWORK)
set (CPACK_INSTALL_CMAKE_PROJECTS install(FILES ${html-docs} DESTINATION doc/zmq COMPONENT RefGuide)
"${CMAKE_SOURCE_DIR}/build/x86/v110;ZeroMQ;ALL;/" endif()
"${CMAKE_SOURCE_DIR}/debug/x86/v110;ZeroMQ;ALL;/" endif()
"${CMAKE_SOURCE_DIR}/build/x86/v100;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/debug/x86/v100;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/build/x86/v90;ZeroMQ;ALL;/" if(MSVC)
"${CMAKE_SOURCE_DIR}/debug/x86/v90;ZeroMQ;ALL;/" include(InstallRequiredSystemLibraries)
)
endif (CMAKE_CL_64) if(CMAKE_CL_64)
set (CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}") set(arch_name "x64")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "ZeroMQ lightweight messaging kernel") else()
set (CPACK_PACKAGE_VENDOR "Miru") set(arch_name "x86")
set (CPACK_NSIS_CONTACT "Steven McCoy <Steven.McCoy@miru.hk>") endif()
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/COPYING.txt")
# There is a bug in NSI that does not handle full unix paths properly. Make set(CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}(${arch_name})")
# sure there is at least one set of four (4) backlasshes. set(CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-${arch_name}")
set (CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}\\\\installer.ico")
set (CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}\\\\installer.ico") # TODO: I think this part was intended to be used when running cpack
set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\branding.bmp") # separately from cmake but I don't know how that works.
set (CPACK_NSIS_COMPRESSOR "/SOLID lzma") #
set (CPACK_PACKAGE_VERSION_MAJOR "${ZMQ_VERSION_MAJOR}") # macro(add_crt_version version)
set (CPACK_PACKAGE_VERSION_MINOR "${ZMQ_VERSION_MINOR}") # set(rel_dir "${CMAKE_CURRENT_BINARY_DIR}/build/${arch_name}/${version};ZeroMQ;ALL;/")
set (CPACK_PACKAGE_VERSION_PATCH "${ZMQ_VERSION_PATCH}") # set(debug_dir "${CMAKE_CURRENT_BINARY_DIR}/debug/${arch_name}/${version};ZeroMQ;ALL;/")
# if(EXISTS ${rel_dir})
include (CPack) # list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir})
# endif()
cpack_add_component_group (Development
DISPLAY_NAME "ZeroMQ software development kit" # if(EXISTS ${debug_dir})
EXPANDED # list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir})
) # endmacro()
cpack_add_component (PerfTools # endmacro()
DISPLAY_NAME "ZeroMQ performance tools"
INSTALL_TYPES FullInstall DevInstall # add_crt_version(v110)
) # add_crt_version(v100)
cpack_add_component (SourceCode # add_crt_version(v90)
DISPLAY_NAME "ZeroMQ source code"
DISABLED set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_BINARY_DIR}")
INSTALL_TYPES FullInstall set(CPACK_GENERATOR "NSIS")
) set(CPACK_PACKAGE_NAME "ZeroMQ")
cpack_add_component (SDK set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ZeroMQ lightweight messaging kernel")
DISPLAY_NAME "ZeroMQ headers and libraries" set(CPACK_PACKAGE_VENDOR "Miru")
INSTALL_TYPES FullInstall DevInstall set(CPACK_NSIS_CONTACT "Steven McCoy <Steven.McCoy@miru.hk>")
GROUP Development set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}\\\\COPYING.txt")
) set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}\\\\README.txt")
if (WITH_DOC) set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_BINARY_DIR}\\\\README.txt")
cpack_add_component (RefGuide # There is a bug in NSI that does not handle full unix paths properly. Make
DISPLAY_NAME "ZeroMQ reference guide" # sure there is at least one set of four(4) backslashes.
INSTALL_TYPES FullInstall DevInstall set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico")
GROUP Development set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico")
)
endif (WITH_DOC) set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\branding.bmp")
cpack_add_component (Runtime set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
DISPLAY_NAME "ZeroMQ runtime files" set(CPACK_PACKAGE_VERSION ${ZMQ_VERSION})
REQUIRED set(CPACK_PACKAGE_VERSION_MAJOR ${ZMQ_VERSION_MAJOR})
INSTALL_TYPES FullInstall DevInstall MinInstall set(CPACK_PACKAGE_VERSION_MINOR ${ZMQ_VERSION_MINOR})
) set(CPACK_PACKAGE_VERSION_PATCH ${ZMQ_VERSION_PATCH})
cpack_add_install_type (FullInstall # set(CPACK_PACKAGE_INSTALL_DIRECTORY "ZMQ Install Directory")
DISPLAY_NAME "Full install, including source code" # set(CPACK_TEMPORARY_DIRECTORY "ZMQ Temporary CPack Directory")
)
cpack_add_install_type (DevInstall include(CPack)
DISPLAY_NAME "Developer install, headers and libraries"
) cpack_add_component_group(Development
cpack_add_install_type (MinInstall DISPLAY_NAME "ZeroMQ software development kit"
DISPLAY_NAME "Minimal install, runtime only" EXPANDED)
) cpack_add_component(PerfTools
DISPLAY_NAME "ZeroMQ performance tools"
# end of file INSTALL_TYPES FullInstall DevInstall)
cpack_add_component(SourceCode
DISPLAY_NAME "ZeroMQ source code"
DISABLED
INSTALL_TYPES FullInstall)
cpack_add_component(SDK
DISPLAY_NAME "ZeroMQ headers and libraries"
INSTALL_TYPES FullInstall DevInstall
GROUP Development)
if(WITH_DOC)
cpack_add_component(RefGuide
DISPLAY_NAME "ZeroMQ reference guide"
INSTALL_TYPES FullInstall DevInstall
GROUP Development)
endif()
cpack_add_component(Runtime
DISPLAY_NAME "ZeroMQ runtime files"
REQUIRED
INSTALL_TYPES FullInstall DevInstall MinInstall)
cpack_add_install_type(FullInstall
DISPLAY_NAME "Full install, including source code")
cpack_add_install_type(DevInstall
DISPLAY_NAME "Developer install, headers and libraries")
cpack_add_install_type(MinInstall
DISPLAY_NAME "Minimal install, runtime only")
endif()
# Export this for library to help build this as a sub-project
set(ZEROMQ_LIBRARY libzmq CACHE STRING "ZeroMQ library")
# Workaround for MSVS10 to avoid the Dialog Hell
# FIXME: This could be removed with future version of CMake.
if(MSVC_VERSION EQUAL 1600)
set(ZMQ_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/ZeroMQ.sln")
if(EXISTS "${ZMQ_SLN_FILENAME}")
file(APPEND "${ZMQ_SLN_FILENAME}" "\n# This should be regenerated!\n")
endif()
endif()
#ifndef __ZMQ_PLATFORM_HPP_INCLUDED__
#define __ZMQ_PLATFORM_HPP_INCLUDED__
#cmakedefine ZMQ_FORCE_SELECT
#cmakedefine ZMQ_FORCE_POLL
#cmakedefine ZMQ_FORCE_EPOLL
#cmakedefine ZMQ_FORCE_DEVPOLL
#cmakedefine ZMQ_FORCE_KQUEUE
#cmakedefine ZMQ_FORCE_SELECT
#cmakedefine ZMQ_FORCE_POLL
#cmakedefine ZMQ_FORCE_MUTEXES
#cmakedefine HAVE_CLOCK_GETTIME
#cmakedefine HAVE_GETHRTIME
#cmakedefine ZMQ_HAVE_UIO
#cmakedefine ZMQ_HAVE_EVENTFD
#cmakedefine ZMQ_HAVE_IFADDRS
#cmakedefine ZMQ_HAVE_SOCK_CLOEXEC
#cmakedefine ZMQ_HAVE_SO_KEEPALIVE
#cmakedefine ZMQ_HAVE_TCP_KEEPCNT
#cmakedefine ZMQ_HAVE_TCP_KEEPIDLE
#cmakedefine ZMQ_HAVE_TCP_KEEPINTVL
#cmakedefine ZMQ_HAVE_TCP_KEEPALIVE
#cmakedefine ZMQ_HAVE_OPENPGM
#cmakedefine ZMQ_MAKE_VALGRIND_HAPPY
#ifdef _AIX
#define ZMQ_HAVE_AIX
#endif
#if defined ANDROID
#define ZMQ_HAVE_ANDROID
#endif
#if defined __CYGWIN__
#define ZMQ_HAVE_CYGWIN
#endif
#if defined __MINGW32__
#define ZMQ_HAVE_MINGW32
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
#define ZMQ_HAVE_FREEBSD
#endif
#if defined __hpux
#define ZMQ_HAVE_HPUX
#endif
#if defined __linux__
#define ZMQ_HAVE_LINUX
#endif
#if defined __NetBSD__
#define ZMQ_HAVE_NETBSD
#endif
#if defined __OpenBSD__
#define ZMQ_HAVE_OPENBSD
#endif
#if defined __VMS
#define ZMQ_HAVE_OPENVMS
#endif
#if defined __APPLE__
#define ZMQ_HAVE_OSX
#endif
#if defined __QNXNTO__
#define ZMQ_HAVE_QNXNTO
#endif
#if defined(sun) || defined(__sun)
#define ZMQ_HAVE_SOLARIS
#endif
#if defined(WIN32) || defined(_WIN32)
#define ZMQ_HAVE_WINDOWS
#endif
#endif
# - Find Asciidoc
# this module looks for asciidoc and a2x
#
# ASCIIDOC_EXECUTABLE - the full path to asciidoc
# ASCIIDOC_FOUND - If false, don't attempt to use asciidoc.
# A2X_EXECUTABLE - the full path to a2x
# A2X_FOUND - If false, don't attempt to use a2x.
find_program(ASCIIDOC_EXECUTABLE asciidoc asciidoc.py
PATHS "$ENV{ASCIIDOC_ROOT}"
"$ENV{PROGRAMW6432}/asciidoc"
"$ENV{PROGRAMFILES}/asciidoc"
"$ENV{PROGRAMFILES(X86)}/asciidoc")
find_program(A2X_EXECUTABLE a2x
PATHS "$ENV{ASCIIDOC_ROOT}"
"$ENV{PROGRAMW6432}/asciidoc"
"$ENV{PROGRAMFILES}/asciidoc"
"$ENV{PROGRAMFILES(X86)}/asciidoc")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_ARGS(AsciiDoc REQUIRED_VARS ASCIIDOC_EXECUTABLE)
mark_as_advanced(ASCIIDOC_EXECUTABLE A2X_EXECUTABLE)
\ No newline at end of file
MESSAGE(STATUS "Detecting ZMQ") file(READ "${PROJECT_SOURCE_DIR}/include/zmq.h" _ZMQ_H_CONTENTS)
SET(TRY_RUN_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/zmq_run.dir) string(REGEX REPLACE ".*#define ZMQ_VERSION_MAJOR ([0-9]+).*" "\\1" ZMQ_VERSION_MAJOR "${_ZMQ_H_CONTENTS}")
string(REGEX REPLACE ".*#define ZMQ_VERSION_MINOR ([0-9]+).*" "\\1" ZMQ_VERSION_MINOR "${_ZMQ_H_CONTENTS}")
string(REGEX REPLACE ".*#define ZMQ_VERSION_PATCH ([0-9]+).*" "\\1" ZMQ_VERSION_PATCH "${_ZMQ_H_CONTENTS}")
set(ZMQ_VERSION "${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}")
TRY_RUN(RUN_RESULT COMPILE_RESULT message(STATUS "Detected ZMQ Version - ${ZMQ_VERSION}")
${TRY_RUN_DIR}
${CMAKE_SOURCE_DIR}/cmake/Modules/zmq_version.cpp
CMAKE_FLAGS
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_SOURCE_DIR}/include"
COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
RUN_OUTPUT_VARIABLE RUN_OUTPUT)
IF(COMPILE_RESULT) if(MSVC_VERSION MATCHES "1700")
IF(RUN_RESULT MATCHES "FAILED_TO_RUN") set(_zmq_COMPILER "-v110")
MESSAGE(STATUS "Detecting ZMQ - failed") elseif(MSVC10)
ELSE() set(_zmq_COMPILER "-v100")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1" ZMQ_VERSION_MAJOR "${RUN_OUTPUT}") elseif(MSVC90)
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\2" ZMQ_VERSION_MINOR "${RUN_OUTPUT}") set(_zmq_COMPILER "-v90")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\3" ZMQ_VERSION_PATCH "${RUN_OUTPUT}") else()
MESSAGE(STATUS "Detecting ZMQ - ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}") set(_zmq_COMPILER "")
ENDIF() endif()
ELSE()
MESSAGE(STATUS "Check for ZMQ version - not found")
MESSAGE(STATUS "Detecting ZMQ - failed")
ENDIF()
if(MSVC_VERSION MATCHES "1700")
set(_zmq_COMPILER "-v110")
elseif(MSVC10)
set(_zmq_COMPILER "-v100")
elseif(MSVC90)
set(_zmq_COMPILER "-v90")
else()
set(_zmq_COMPILER "")
endif()
macro(zmq_check_sock_cloexec)
message(STATUS "Checking whether SOCK_CLOEXEC is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
int main(int argc, char *argv [])
{
int s = socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
return(s == -1);
}
"
ZMQ_HAVE_SOCK_CLOEXEC)
endmacro()
# TCP keep-alives Checks.
macro(zmq_check_so_keepalive)
message(STATUS "Checking whether SO_KEEPALIVE is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
int main(int argc, char *argv [])
{
int s, rc, opt = 1;
return(
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1)
);
}
"
ZMQ_HAVE_SO_KEEPALIVE)
endmacro()
macro(zmq_check_tcp_keepcnt)
message(STATUS "Checking whether TCP_KEEPCNT is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
int main(int argc, char *argv [])
{
int s, rc, opt = 1;
return(
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPCNT,(char*) &opt, sizeof(int))) == -1)
);
}
"
ZMQ_HAVE_TCP_KEEPCNT)
endmacro()
macro(zmq_check_tcp_keepidle)
message(STATUS "Checking whether TCP_KEEPIDLE is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
int main(int argc, char *argv [])
{
int s, rc, opt = 1;
return(
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPIDLE,(char*) &opt, sizeof(int))) == -1)
);
}
"
ZMQ_HAVE_TCP_KEEPIDLE)
endmacro()
macro(zmq_check_tcp_keepintvl)
message(STATUS "Checking whether TCP_KEEPINTVL is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
int main(int argc, char *argv [])
{
int s, rc, opt = 1;
return(
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPINTVL,(char*) &opt, sizeof(int))) == -1)
);
}
"
ZMQ_HAVE_TCP_KEEPINTVL)
endmacro()
macro(zmq_check_tcp_keepalive)
message(STATUS "Checking whether TCP_KEEPALIVE is supported")
check_c_source_runs(
"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
int main(int argc, char *argv [])
{
int s, rc, opt = 1;
return(
((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) ||
((rc = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char*) &opt, sizeof(int))) == -1) ||
((rc = setsockopt(s, IPPROTO_TCP, TCP_KEEPALIVE,(char*) &opt, sizeof(int))) == -1)
);
}
"
ZMQ_HAVE_TCP_KEEPALIVE)
endmacro()
/*
Copyright (c) 2007-2012 iMatix Corporation
Copyright (c) 2009-2011 250bpm s.r.o.
Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "zmq.h"
#include <stdio.h>
int main ()
{
printf ("%d.%d.%d\n", ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH);
return 0;
}
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "../src/platform.hpp" #include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
#include <windows.h> #include <windows.h>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "../src/platform.hpp" #include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
#include <windows.h> #include <windows.h>
......
...@@ -163,7 +163,7 @@ namespace zmq ...@@ -163,7 +163,7 @@ namespace zmq
return false; return false;
} }
inline bool message_ready_size (size_t msg_sz) inline bool message_ready_size (size_t /* msg_sz */)
{ {
zmq_assert (false); zmq_assert (false);
return false; return false;
......
...@@ -30,8 +30,9 @@ namespace zmq ...@@ -30,8 +30,9 @@ namespace zmq
// Interface to be implemented by message decoder. // Interface to be implemented by message decoder.
struct i_decoder class i_decoder
{ {
public:
virtual ~i_decoder () {} virtual ~i_decoder () {}
virtual void set_msg_sink (i_msg_sink *msg_sink_) = 0; virtual void set_msg_sink (i_msg_sink *msg_sink_) = 0;
......
...@@ -29,8 +29,9 @@ namespace zmq ...@@ -29,8 +29,9 @@ namespace zmq
// Interface to be implemented by message sink. // Interface to be implemented by message sink.
struct i_msg_sink class i_msg_sink
{ {
public:
virtual ~i_msg_sink () {} virtual ~i_msg_sink () {}
// Delivers a message. Returns 0 if successful; -1 otherwise. // Delivers a message. Returns 0 if successful; -1 otherwise.
......
...@@ -29,8 +29,9 @@ namespace zmq ...@@ -29,8 +29,9 @@ namespace zmq
// Interface to be implemented by message source. // Interface to be implemented by message source.
struct i_msg_source class i_msg_source
{ {
public:
virtual ~i_msg_source () {} virtual ~i_msg_source () {}
// Fetch a message. Returns 0 if successful; -1 otherwise. // Fetch a message. Returns 0 if successful; -1 otherwise.
......
...@@ -73,11 +73,11 @@ zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_) ...@@ -73,11 +73,11 @@ zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
void zmq::unblock_socket (fd_t s_) void zmq::unblock_socket (fd_t s_)
{ {
#ifdef ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
u_long nonblock = 1; u_long nonblock = 1;
int rc = ioctlsocket (s_, FIONBIO, &nonblock); int rc = ioctlsocket (s_, FIONBIO, &nonblock);
wsa_assert (rc != SOCKET_ERROR); wsa_assert (rc != SOCKET_ERROR);
#elif ZMQ_HAVE_OPENVMS #elif defined ZMQ_HAVE_OPENVMS
int nonblock = 1; int nonblock = 1;
int rc = ioctl (s_, FIONBIO, &nonblock); int rc = ioctl (s_, FIONBIO, &nonblock);
errno_assert (rc != -1); errno_assert (rc != -1);
...@@ -92,6 +92,8 @@ void zmq::unblock_socket (fd_t s_) ...@@ -92,6 +92,8 @@ void zmq::unblock_socket (fd_t s_)
void zmq::enable_ipv4_mapping (fd_t s_) void zmq::enable_ipv4_mapping (fd_t s_)
{ {
(void) s_;
#ifdef IPV6_V6ONLY #ifdef IPV6_V6ONLY
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
DWORD flag = 0; DWORD flag = 0;
...@@ -107,3 +109,4 @@ void zmq::enable_ipv4_mapping (fd_t s_) ...@@ -107,3 +109,4 @@ void zmq::enable_ipv4_mapping (fd_t s_)
#endif #endif
#endif #endif
} }
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_PREFIX@/lib
includedir=@CMAKE_INSTALL_PREFIX@/include
Name: libzmq
Description: 0MQ c++ library
Version: @ZMQ_VERSION_MAJOR@.@ZMQ_VERSION_MINOR@.@ZMQ_VERSION_PATCH@
Libs: -L${libdir} -lzmq
Cflags: -I@CMAKE_INSTALL_PREFIX@/include
...@@ -124,6 +124,7 @@ void zmq::object_t::process_command (command_t &cmd_) ...@@ -124,6 +124,7 @@ void zmq::object_t::process_command (command_t &cmd_)
process_reaped (); process_reaped ();
break; break;
case command_t::done:
default: default:
zmq_assert (false); zmq_assert (false);
} }
......
...@@ -320,20 +320,23 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -320,20 +320,23 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
else { else {
std::string filter_str ((const char*) optval_, optvallen_); std::string filter_str ((const char*) optval_, optvallen_);
tcp_address_mask_t filter; tcp_address_mask_t mask;
int rc = filter.resolve (filter_str.c_str (), ipv4only ? true : false); int rc = mask.resolve (filter_str.c_str (), ipv4only ? true : false);
if (rc != 0) { if (rc != 0) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
tcp_accept_filters.push_back(filter); tcp_accept_filters.push_back(mask);
return 0; return 0;
} }
} }
default:
{
errno = EINVAL;
return -1;
}
} }
errno = EINVAL;
return -1;
} }
int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
......
...@@ -206,8 +206,8 @@ void zmq::signaler_t::recv () ...@@ -206,8 +206,8 @@ void zmq::signaler_t::recv ()
// one, return it back to the eventfd object. // one, return it back to the eventfd object.
if (unlikely (dummy == 2)) { if (unlikely (dummy == 2)) {
const uint64_t inc = 1; const uint64_t inc = 1;
ssize_t sz = write (w, &inc, sizeof (inc)); ssize_t sz2 = write (w, &inc, sizeof (inc));
errno_assert (sz == sizeof (inc)); errno_assert (sz2 == sizeof (inc));
return; return;
} }
...@@ -238,8 +238,10 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_) ...@@ -238,8 +238,10 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
return 0; return 0;
#elif defined ZMQ_HAVE_WINDOWS #elif defined ZMQ_HAVE_WINDOWS
SECURITY_DESCRIPTOR sd = {0}; SECURITY_DESCRIPTOR sd;
SECURITY_ATTRIBUTES sa = {0}; SECURITY_ATTRIBUTES sa;
memset (&sd, 0, sizeof (sd));
memset (&sa, 0, sizeof (sa));
InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(&sd, TRUE, 0, FALSE); SetSecurityDescriptorDacl(&sd, TRUE, 0, FALSE);
......
...@@ -437,14 +437,14 @@ int zmq::socket_base_t::connect (const char *addr_) ...@@ -437,14 +437,14 @@ int zmq::socket_base_t::connect (const char *addr_)
// Create a bi-directional pipe to connect the peers. // Create a bi-directional pipe to connect the peers.
object_t *parents [2] = {this, peer.socket}; object_t *parents [2] = {this, peer.socket};
pipe_t *pipes [2] = {NULL, NULL}; pipe_t *new_pipes [2] = {NULL, NULL};
int hwms [2] = {sndhwm, rcvhwm}; int hwms [2] = {sndhwm, rcvhwm};
bool delays [2] = {options.delay_on_disconnect, options.delay_on_close}; bool delays [2] = {options.delay_on_disconnect, options.delay_on_close};
int rc = pipepair (parents, pipes, hwms, delays); int rc = pipepair (parents, new_pipes, hwms, delays);
errno_assert (rc == 0); errno_assert (rc == 0);
// Attach local end of the pipe to this socket object. // Attach local end of the pipe to this socket object.
attach_pipe (pipes [0]); attach_pipe (new_pipes [0]);
// If required, send the identity of the local socket to the peer. // If required, send the identity of the local socket to the peer.
if (peer.options.recv_identity) { if (peer.options.recv_identity) {
...@@ -453,9 +453,9 @@ int zmq::socket_base_t::connect (const char *addr_) ...@@ -453,9 +453,9 @@ int zmq::socket_base_t::connect (const char *addr_)
errno_assert (rc == 0); errno_assert (rc == 0);
memcpy (id.data (), options.identity, options.identity_size); memcpy (id.data (), options.identity, options.identity_size);
id.set_flags (msg_t::identity); id.set_flags (msg_t::identity);
bool written = pipes [0]->write (&id); bool written = new_pipes [0]->write (&id);
zmq_assert (written); zmq_assert (written);
pipes [0]->flush (); new_pipes [0]->flush ();
} }
// If required, send the identity of the peer to the local socket. // If required, send the identity of the peer to the local socket.
...@@ -465,21 +465,21 @@ int zmq::socket_base_t::connect (const char *addr_) ...@@ -465,21 +465,21 @@ int zmq::socket_base_t::connect (const char *addr_)
errno_assert (rc == 0); errno_assert (rc == 0);
memcpy (id.data (), peer.options.identity, peer.options.identity_size); memcpy (id.data (), peer.options.identity, peer.options.identity_size);
id.set_flags (msg_t::identity); id.set_flags (msg_t::identity);
bool written = pipes [1]->write (&id); bool written = new_pipes [1]->write (&id);
zmq_assert (written); zmq_assert (written);
pipes [1]->flush (); new_pipes [1]->flush ();
} }
// Attach remote end of the pipe to the peer socket. Note that peer's // Attach remote end of the pipe to the peer socket. Note that peer's
// seqnum was incremented in find_endpoint function. We don't need it // seqnum was incremented in find_endpoint function. We don't need it
// increased here. // increased here.
send_bind (peer.socket, pipes [1], false); send_bind (peer.socket, new_pipes [1], false);
// Save last endpoint URI // Save last endpoint URI
options.last_endpoint.assign (addr_); options.last_endpoint.assign (addr_);
// remember inproc connections for disconnect // remember inproc connections for disconnect
inprocs.insert (inprocs_t::value_type (std::string (addr_), pipes[0])); inprocs.insert (inprocs_t::value_type (std::string (addr_), new_pipes[0]));
return 0; return 0;
} }
...@@ -540,17 +540,17 @@ int zmq::socket_base_t::connect (const char *addr_) ...@@ -540,17 +540,17 @@ int zmq::socket_base_t::connect (const char *addr_)
if (options.delay_attach_on_connect != 1 || icanhasall) { if (options.delay_attach_on_connect != 1 || icanhasall) {
// Create a bi-directional pipe. // Create a bi-directional pipe.
object_t *parents [2] = {this, session}; object_t *parents [2] = {this, session};
pipe_t *pipes [2] = {NULL, NULL}; pipe_t *new_pipes [2] = {NULL, NULL};
int hwms [2] = {options.sndhwm, options.rcvhwm}; int hwms [2] = {options.sndhwm, options.rcvhwm};
bool delays [2] = {options.delay_on_disconnect, options.delay_on_close}; bool delays [2] = {options.delay_on_disconnect, options.delay_on_close};
rc = pipepair (parents, pipes, hwms, delays); rc = pipepair (parents, new_pipes, hwms, delays);
errno_assert (rc == 0); errno_assert (rc == 0);
// Attach local end of the pipe to the socket object. // Attach local end of the pipe to the socket object.
attach_pipe (pipes [0], icanhasall); attach_pipe (new_pipes [0], icanhasall);
// Attach remote end of the pipe to the session object later on. // Attach remote end of the pipe to the session object later on.
session->attach_pipe (pipes [1]); session->attach_pipe (new_pipes [1]);
} }
// Save last endpoint URI // Save last endpoint URI
...@@ -664,7 +664,7 @@ int zmq::socket_base_t::send (msg_t *msg_, int flags_) ...@@ -664,7 +664,7 @@ int zmq::socket_base_t::send (msg_t *msg_, int flags_)
return -1; return -1;
// Compute the time when the timeout should occur. // Compute the time when the timeout should occur.
// If the timeout is infite, don't care. // If the timeout is infinite, don't care.
int timeout = options.sndtimeo; int timeout = options.sndtimeo;
uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout); uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout);
...@@ -746,7 +746,7 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_) ...@@ -746,7 +746,7 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_)
} }
// Compute the time when the timeout should occur. // Compute the time when the timeout should occur.
// If the timeout is infite, don't care. // If the timeout is infinite, don't care.
int timeout = options.rcvtimeo; int timeout = options.rcvtimeo;
uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout); uint64_t end = timeout < 0 ? 0 : (clock.now_ms () + timeout);
......
...@@ -94,7 +94,7 @@ namespace zmq ...@@ -94,7 +94,7 @@ namespace zmq
// Size of the greeting message: // Size of the greeting message:
// Preamble (10 bytes) + version (1 byte) + socket type (1 byte). // Preamble (10 bytes) + version (1 byte) + socket type (1 byte).
const static size_t greeting_size = 12; static const size_t greeting_size = 12;
// True iff we are registered with an I/O poller. // True iff we are registered with an I/O poller.
bool io_enabled; bool io_enabled;
......
...@@ -240,7 +240,8 @@ zmq::fd_t zmq::tcp_listener_t::accept () ...@@ -240,7 +240,8 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
// Accept one connection and deal with different failure modes. // Accept one connection and deal with different failure modes.
zmq_assert (s != retired_fd); zmq_assert (s != retired_fd);
struct sockaddr_storage ss = {}; struct sockaddr_storage ss;
memset (&ss, 0, sizeof (ss));
#ifdef ZMQ_HAVE_HPUX #ifdef ZMQ_HAVE_HPUX
int ss_len = sizeof (ss); int ss_len = sizeof (ss);
#else #else
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
// XSI vector I/O // XSI vector I/O
#if ZMQ_HAVE_UIO #if defined ZMQ_HAVE_UIO
#include <sys/uio.h> #include <sys/uio.h>
#else #else
struct iovec { struct iovec {
...@@ -980,7 +980,7 @@ int zmq_proxy (void *frontend_, void *backend_, void *control_) ...@@ -980,7 +980,7 @@ int zmq_proxy (void *frontend_, void *backend_, void *control_)
// The deprecated device functionality // The deprecated device functionality
int zmq_device (int type, void *frontend_, void *backend_) int zmq_device (int /* type */, void *frontend_, void *backend_)
{ {
return zmq::proxy ( return zmq::proxy (
(zmq::socket_base_t*) frontend_, (zmq::socket_base_t*) frontend_,
...@@ -989,7 +989,7 @@ int zmq_device (int type, void *frontend_, void *backend_) ...@@ -989,7 +989,7 @@ int zmq_device (int type, void *frontend_, void *backend_)
// Callback to free socket event data // Callback to free socket event data
void zmq_free_event (void *event_data, void *hint) void zmq_free_event (void *event_data, void * /* hint */)
{ {
zmq_event_t *event = (zmq_event_t *) event_data; zmq_event_t *event = (zmq_event_t *) event_data;
......
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