mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-09 15:26:04 +00:00
Merge pull request #492 from arsenm/master
Make CMake build usable for other systems
This commit is contained in:
commit
949d157897
639
CMakeLists.txt
639
CMakeLists.txt
@ -1,20 +1,199 @@
|
|||||||
# 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_DOC "Build Reference Guide documentation (requires DocBook)" OFF)
|
|
||||||
option(WITH_OPENPGM "Build with support for OpenPGM" OFF)
|
option(WITH_OPENPGM "Build with support for OpenPGM" OFF)
|
||||||
|
|
||||||
# WARNING: Windows Python will override Cygwin yet not work with Asciidoc.
|
if(APPLE)
|
||||||
#find_package (PythonInterp REQUIRED)
|
option(ZMQ_BUILD_FRAMEWORK "Build as OS X framework" ON)
|
||||||
# Workaround, manually set Python location
|
endif()
|
||||||
set(PYTHON_EXECUTABLE c:/cygwin/bin/python2.6.exe CACHE FILEPATH "Python interpreter executable")
|
|
||||||
# TODO: Replace with FindAsciidoc.cmake
|
|
||||||
set(ASCIIDOC_EXECUTABLE c:/cygwin/bin/asciidoc CACHE FILEPATH "AsciiDoc executable")
|
|
||||||
|
|
||||||
|
|
||||||
|
set(POLLER "" CACHE STRING "Choose polling system manually. valid values are
|
||||||
|
kqueue, epoll, devpoll, poll or select [default=autodetect]")
|
||||||
|
|
||||||
|
if( NOT POLLER STREQUAL ""
|
||||||
|
AND NOT POLLER STREQUAL "kqueue"
|
||||||
|
AND NOT POLLER STREQUAL "epoll"
|
||||||
|
AND NOT POLLER STREQUAL "devpoll"
|
||||||
|
AND NOT POLLER STREQUAL "poll"
|
||||||
|
AND NOT POLLER STREQUAL "select")
|
||||||
|
message(FATAL_ERROR "Invalid polling method")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT ${POLLER} STREQUAL "")
|
||||||
|
string(TOUPPER ${POLLER} UPPER_POLLER)
|
||||||
|
set(ZMQ_FORCE_${UPPER_POLLER} 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(ZMQ_CMAKE_MODULES_DIR ${CMAKE_CURRENT_LIST_DIR}/cmake/Modules)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${ZMQ_CMAKE_MODULES_DIR})
|
||||||
|
|
||||||
|
include(TestZMQVersion)
|
||||||
|
include(ZMQSourceRunChecks)
|
||||||
|
include(CheckIncludeFiles)
|
||||||
|
include(CheckLibraryExists)
|
||||||
|
include(CheckFunctionExists)
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
include(CheckCSourceRuns)
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
|
check_include_files(ifaddrs.h ZMQ_HAVE_IFADDRS)
|
||||||
|
check_include_files(windows.h HAVE_WINDOWS_H)
|
||||||
|
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)
|
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)
|
||||||
@ -27,7 +206,7 @@ if (WITH_OPENPGM)
|
|||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
|
message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
|
||||||
else (CMAKE_CL_64)
|
else()
|
||||||
find_path(OPENPGM_ROOT include/pgm/pgm.h
|
find_path(OPENPGM_ROOT include/pgm/pgm.h
|
||||||
PATHS
|
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}]"
|
||||||
@ -41,23 +220,32 @@ if (WITH_OPENPGM)
|
|||||||
set(OPENPGM_LIBRARIES
|
set(OPENPGM_LIBRARIES
|
||||||
optimized libpgm${_zmq_COMPILER}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib
|
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)
|
debug libpgm${_zmq_COMPILER}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
|
||||||
endif (WITH_OPENPGM)
|
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()
|
||||||
|
|
||||||
mark_as_advanced(PYTHON_EXECUTABLE ASCIIDOC_EXECUTABLE)
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# 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,21 +254,21 @@ 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
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-DWIN32
|
-DWIN32
|
||||||
-DDLL_EXPORT
|
-DDLL_EXPORT
|
||||||
# NB: May require tweaking for highly connected applications.
|
# NB: May require tweaking for highly connected applications.
|
||||||
-DFD_SETSIZE=1024
|
-DFD_SETSIZE=1024
|
||||||
-D_CRT_SECURE_NO_WARNINGS
|
-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")
|
||||||
@ -91,6 +279,8 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
|
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_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
|
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# source files
|
# source files
|
||||||
@ -157,43 +347,54 @@ set(cxx-sources
|
|||||||
xpub.cpp
|
xpub.cpp
|
||||||
xsub.cpp
|
xsub.cpp
|
||||||
zmq.cpp
|
zmq.cpp
|
||||||
zmq_utils.cpp
|
zmq_utils.cpp)
|
||||||
)
|
|
||||||
|
|
||||||
set(rc-sources
|
set(rc-sources version.rc)
|
||||||
version.rc
|
|
||||||
)
|
|
||||||
|
|
||||||
include_directories(
|
if(MINGW)
|
||||||
include
|
# Generate the right type when using -m32 or -m64
|
||||||
${CMAKE_BINARY_DIR}
|
macro(set_rc_arch rc_target)
|
||||||
)
|
set(CMAKE_RC_COMPILER_INIT windres)
|
||||||
set(headers
|
enable_language(RC)
|
||||||
include/zmq.h
|
set(CMAKE_RC_COMPILE_OBJECT
|
||||||
include/zmq_utils.h
|
"<CMAKE_RC_COMPILER> <FLAGS> --target=${rc_target} <DEFINES> -i <SOURCE> -o <OBJECT>")
|
||||||
)
|
endmacro()
|
||||||
set(readme-docs
|
|
||||||
AUTHORS
|
if( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i386"
|
||||||
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i486"
|
||||||
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i586"
|
||||||
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i686"
|
||||||
|
# This also happens on x86_64 systems...what a worthless variable
|
||||||
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86"
|
||||||
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64"
|
||||||
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "amd64")
|
||||||
|
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set_rc_arch("pe-x86-64")
|
||||||
|
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
|
||||||
COPYING.LESSER
|
COPYING.LESSER
|
||||||
MAINTAINERS
|
MAINTAINERS
|
||||||
NEWS
|
NEWS
|
||||||
README
|
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(
|
|
||||||
${OPENPGM_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
link_directories(
|
|
||||||
${OPENPGM_LIBRARY_DIRS}
|
|
||||||
)
|
|
||||||
set(OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES})
|
set(OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES})
|
||||||
endif(WITH_OPENPGM)
|
endif(WITH_OPENPGM)
|
||||||
|
|
||||||
@ -201,42 +402,49 @@ 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()
|
||||||
|
|
||||||
|
foreach(source ${rc-sources})
|
||||||
|
list(APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/${source})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach(source ${rc-sources})
|
foreach(source ${rc-sources})
|
||||||
list(APPEND sources ${CMAKE_BINARY_DIR}/${source})
|
list(APPEND sources ${CMAKE_BINARY_DIR}/${source})
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/src/${source}.in ${CMAKE_BINARY_DIR}/${source})
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/${source}.in ${CMAKE_CURRENT_BINARY_DIR}/${source})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_custom_command(
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/platform.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp)
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/platform.hpp
|
list(APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp)
|
||||||
COMMAND ${CMAKE_COMMAND}
|
|
||||||
ARGS -E
|
|
||||||
copy
|
|
||||||
${CMAKE_SOURCE_DIR}/builds/msvc/platform.hpp
|
|
||||||
${CMAKE_BINARY_DIR}/platform.hpp
|
|
||||||
DEPENDS ${CMAKE_SOURCE_DIR}/builds/msvc/platform.hpp
|
|
||||||
)
|
|
||||||
list(APPEND sources ${CMAKE_BINARY_DIR}/platform.hpp)
|
|
||||||
|
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/libzmq.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc)
|
||||||
|
set(zmq-pkgconfig ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc)
|
||||||
|
|
||||||
|
if(NOT ZMQ_BUILD_FRAMEWORK)
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc DESTINATION lib/pkgconfig)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
if(CMAKE_CL_64)
|
if(CMAKE_CL_64)
|
||||||
set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template64.in)
|
set(nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/cmake/NSIS.template64.in)
|
||||||
else (CMAKE_CL_64)
|
else()
|
||||||
set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template32.in)
|
set(nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/cmake/NSIS.template32.in)
|
||||||
endif (CMAKE_CL_64)
|
endif()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/NSIS.template.in
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
ARGS -E
|
ARGS -E
|
||||||
copy
|
copy
|
||||||
${nsis-template}
|
${nsis-template}
|
||||||
${CMAKE_BINARY_DIR}/NSIS.template.in
|
${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
|
||||||
DEPENDS ${nsis-template}
|
DEPENDS ${nsis-template})
|
||||||
)
|
endif()
|
||||||
|
|
||||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
|
||||||
file(GLOB docs RELATIVE ${CMAKE_BINARY_DIR}/ "${CMAKE_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})
|
||||||
@ -250,146 +458,265 @@ foreach (txt ${docs})
|
|||||||
-d manpage
|
-d manpage
|
||||||
-b xhtml11
|
-b xhtml11
|
||||||
-f ${CMAKE_SOURCE_DIR}/doc/asciidoc.conf
|
-f ${CMAKE_SOURCE_DIR}/doc/asciidoc.conf
|
||||||
-azmq_version=${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}
|
-azmq_version=${ZMQ_VERSION}
|
||||||
|
-f ${CMAKE_CURRENT_SOURCE_DIR}/doc/asciidoc.conf
|
||||||
|
-azmq_version=${ZMQ_VERSION}
|
||||||
-o ${dst}
|
-o ${dst}
|
||||||
${src}
|
${src}
|
||||||
DEPENDS ${CMAKE_BINARY_DIR}/${src}
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${src}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
COMMENT "Generating ${html}"
|
COMMENT "Generating ${html}")
|
||||||
)
|
|
||||||
if(WITH_DOC)
|
if(WITH_DOC)
|
||||||
list(APPEND html-docs ${CMAKE_BINARY_DIR}/${dst})
|
list(APPEND html-docs ${CMAKE_CURRENT_BINARY_DIR}/${dst})
|
||||||
endif (WITH_DOC)
|
endif()
|
||||||
endforeach (txt ${docs})
|
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)
|
||||||
|
target_link_libraries(libzmq ${OPTIONAL_LIBRARIES})
|
||||||
set_target_properties(libzmq PROPERTIES
|
set_target_properties(libzmq PROPERTIES
|
||||||
|
PUBLIC_HEADER "${public_headers}"
|
||||||
RELEASE_POSTFIX "${_zmq_COMPILER}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
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}")
|
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})
|
||||||
# installer
|
if(HAVE_WS2_32)
|
||||||
|
target_link_libraries(libzmq ws2_32)
|
||||||
|
elseif(HAVE_WS2)
|
||||||
|
target_link_libraries(libzmq ws2)
|
||||||
|
endif()
|
||||||
|
|
||||||
install (TARGETS libzmq ARCHIVE DESTINATION lib COMPONENT SDK)
|
if(HAVE_RPCRT4)
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
target_link_libraries(libzmq rpcrt4)
|
||||||
install (TARGETS libzmq RUNTIME DESTINATION bin COMPONENT SDK)
|
endif()
|
||||||
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)
|
|
||||||
else (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
install (TARGETS libzmq RUNTIME DESTINATION bin COMPONENT Runtime)
|
|
||||||
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
install (FILES ${headers} DESTINATION include COMPONENT SDK)
|
|
||||||
|
|
||||||
set (perf-tools
|
if(HAVE_IPHLAPI)
|
||||||
local_lat
|
target_link_libraries(libzmq iphlpapi)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(perf-tools local_lat
|
||||||
remote_lat
|
remote_lat
|
||||||
local_thr
|
local_thr
|
||||||
remote_thr
|
remote_thr
|
||||||
inproc_lat
|
inproc_lat
|
||||||
inproc_thr
|
inproc_thr)
|
||||||
)
|
|
||||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # Why?
|
||||||
foreach(perf-tool ${perf-tools})
|
foreach(perf-tool ${perf-tools})
|
||||||
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)
|
||||||
install (TARGETS ${perf-tool} RUNTIME DESTINATION bin COMPONENT PerfTools)
|
|
||||||
endforeach (perf-tool ${perf-tools})
|
|
||||||
endif (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
|
|
||||||
file(GLOB headers "${CMAKE_SOURCE_DIR}/src/*.hpp")
|
if(ZMQ_BUILD_FRAMEWORK)
|
||||||
install (FILES ${sources} ${headers} DESTINATION src COMPONENT SourceCode)
|
# 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
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
install(TARGETS libzmq
|
||||||
|
ARCHIVE DESTINATION lib
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
PUBLIC_HEADER DESTINATION include
|
||||||
|
COMPONENT SDK)
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
install(TARGETS libzmq
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
PUBLIC_HEADER DESTINATION include
|
||||||
|
COMPONENT SDK)
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib/libzmq${_zmq_COMPILER}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}.pdb DESTINATION lib
|
||||||
|
COMPONENT SDK)
|
||||||
|
else()
|
||||||
|
install(TARGETS libzmq
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
PUBLIC_HEADER DESTINATION include
|
||||||
|
COMPONENT Runtime)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
install(TARGETS libzmq
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
ARCHIVE DESTINATION lib
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
FRAMEWORK DESTINATION "Library/Frameworks"
|
||||||
|
PUBLIC_HEADER DESTINATION include)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# install(FILES ${public_headers}
|
||||||
|
# DESTINATION include
|
||||||
|
# COMPONENT SDK)
|
||||||
|
|
||||||
|
if(NOT ZMQ_BUILD_FRAMEWORK)
|
||||||
|
file(GLOB private_headers "${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp")
|
||||||
|
install(FILES ${sources} ${private_headers} DESTINATION src/zmq
|
||||||
|
COMPONENT SourceCode)
|
||||||
|
endif()
|
||||||
|
|
||||||
foreach(readme ${readme-docs})
|
foreach(readme ${readme-docs})
|
||||||
configure_file (${CMAKE_SOURCE_DIR}/${readme} ${CMAKE_BINARY_DIR}/${readme}.txt)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${readme} ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt)
|
||||||
install (FILES ${CMAKE_BINARY_DIR}/${readme}.txt DESTINATION .)
|
|
||||||
endforeach (readme ${readme-docs})
|
|
||||||
if (WITH_DOC)
|
|
||||||
install (FILES ${html-docs} DESTINATION doc COMPONENT RefGuide)
|
|
||||||
endif (WITH_DOC)
|
|
||||||
|
|
||||||
|
if(NOT ZMQ_BUILD_FRAMEWORK)
|
||||||
|
if(MSVC)
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt DESTINATION .)
|
||||||
|
else()
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt DESTINATION etc/zmq)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(WITH_DOC)
|
||||||
|
if(NOT ZMQ_BUILD_FRAMEWORK)
|
||||||
|
install(FILES ${html-docs} DESTINATION doc/zmq COMPONENT RefGuide)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
include(InstallRequiredSystemLibraries)
|
include(InstallRequiredSystemLibraries)
|
||||||
|
|
||||||
if(CMAKE_CL_64)
|
if(CMAKE_CL_64)
|
||||||
set (CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH} (x64)")
|
set(arch_name "x64")
|
||||||
set (CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-x64")
|
else()
|
||||||
set (CPACK_INSTALL_CMAKE_PROJECTS
|
set(arch_name "x86")
|
||||||
"${CMAKE_SOURCE_DIR}/build/x64/v110;ZeroMQ;ALL;/"
|
endif()
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x64/v110;ZeroMQ;ALL;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/build/x64/v100;ZeroMQ;ALL;/"
|
set(CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}(${arch_name})")
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x64/v100;ZeroMQ;ALL;/"
|
set(CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-${arch_name}")
|
||||||
"${CMAKE_SOURCE_DIR}/build/x64/v90;ZeroMQ;ALL;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x64/v90;ZeroMQ;ALL;/"
|
# TODO: I think this part was intended to be used when running cpack
|
||||||
)
|
# separately from cmake but I don't know how that works.
|
||||||
else (CMAKE_CL_64)
|
#
|
||||||
set (CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}")
|
# macro(add_crt_version version)
|
||||||
set (CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-x86")
|
# set(rel_dir "${CMAKE_CURRENT_BINARY_DIR}/build/${arch_name}/${version};ZeroMQ;ALL;/")
|
||||||
set (CPACK_INSTALL_CMAKE_PROJECTS
|
# set(debug_dir "${CMAKE_CURRENT_BINARY_DIR}/debug/${arch_name}/${version};ZeroMQ;ALL;/")
|
||||||
"${CMAKE_SOURCE_DIR}/build/x86/v110;ZeroMQ;ALL;/"
|
# if(EXISTS ${rel_dir})
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x86/v110;ZeroMQ;ALL;/"
|
# list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir})
|
||||||
"${CMAKE_SOURCE_DIR}/build/x86/v100;ZeroMQ;ALL;/"
|
# endif()
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x86/v100;ZeroMQ;ALL;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/build/x86/v90;ZeroMQ;ALL;/"
|
# if(EXISTS ${debug_dir})
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x86/v90;ZeroMQ;ALL;/"
|
# list(APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir})
|
||||||
)
|
# endmacro()
|
||||||
endif (CMAKE_CL_64)
|
# endmacro()
|
||||||
set (CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}")
|
|
||||||
|
# add_crt_version(v110)
|
||||||
|
# add_crt_version(v100)
|
||||||
|
# add_crt_version(v90)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
set(CPACK_GENERATOR "NSIS")
|
||||||
|
set(CPACK_PACKAGE_NAME "ZeroMQ")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ZeroMQ lightweight messaging kernel")
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ZeroMQ lightweight messaging kernel")
|
||||||
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_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_WELCOME "${CMAKE_CURRENT_BINARY_DIR}\\\\README.txt")
|
||||||
# There is a bug in NSI that does not handle full unix paths properly. Make
|
# There is a bug in NSI that does not handle full unix paths properly. Make
|
||||||
# sure there is at least one set of four (4) backlasshes.
|
# sure there is at least one set of four(4) backslashes.
|
||||||
set (CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}\\\\installer.ico")
|
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico")
|
||||||
set (CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}\\\\installer.ico")
|
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico")
|
||||||
set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\branding.bmp")
|
|
||||||
|
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\branding.bmp")
|
||||||
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
|
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
|
||||||
set (CPACK_PACKAGE_VERSION_MAJOR "${ZMQ_VERSION_MAJOR}")
|
set(CPACK_PACKAGE_VERSION ${ZMQ_VERSION})
|
||||||
set (CPACK_PACKAGE_VERSION_MINOR "${ZMQ_VERSION_MINOR}")
|
set(CPACK_PACKAGE_VERSION_MAJOR ${ZMQ_VERSION_MAJOR})
|
||||||
set (CPACK_PACKAGE_VERSION_PATCH "${ZMQ_VERSION_PATCH}")
|
set(CPACK_PACKAGE_VERSION_MINOR ${ZMQ_VERSION_MINOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH ${ZMQ_VERSION_PATCH})
|
||||||
|
# set(CPACK_PACKAGE_INSTALL_DIRECTORY "ZMQ Install Directory")
|
||||||
|
# set(CPACK_TEMPORARY_DIRECTORY "ZMQ Temporary CPack Directory")
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
cpack_add_component_group(Development
|
cpack_add_component_group(Development
|
||||||
DISPLAY_NAME "ZeroMQ software development kit"
|
DISPLAY_NAME "ZeroMQ software development kit"
|
||||||
EXPANDED
|
EXPANDED)
|
||||||
)
|
|
||||||
cpack_add_component(PerfTools
|
cpack_add_component(PerfTools
|
||||||
DISPLAY_NAME "ZeroMQ performance tools"
|
DISPLAY_NAME "ZeroMQ performance tools"
|
||||||
INSTALL_TYPES FullInstall DevInstall
|
INSTALL_TYPES FullInstall DevInstall)
|
||||||
)
|
|
||||||
cpack_add_component(SourceCode
|
cpack_add_component(SourceCode
|
||||||
DISPLAY_NAME "ZeroMQ source code"
|
DISPLAY_NAME "ZeroMQ source code"
|
||||||
DISABLED
|
DISABLED
|
||||||
INSTALL_TYPES FullInstall
|
INSTALL_TYPES FullInstall)
|
||||||
)
|
|
||||||
cpack_add_component(SDK
|
cpack_add_component(SDK
|
||||||
DISPLAY_NAME "ZeroMQ headers and libraries"
|
DISPLAY_NAME "ZeroMQ headers and libraries"
|
||||||
INSTALL_TYPES FullInstall DevInstall
|
INSTALL_TYPES FullInstall DevInstall
|
||||||
GROUP Development
|
GROUP Development)
|
||||||
)
|
|
||||||
if(WITH_DOC)
|
if(WITH_DOC)
|
||||||
cpack_add_component(RefGuide
|
cpack_add_component(RefGuide
|
||||||
DISPLAY_NAME "ZeroMQ reference guide"
|
DISPLAY_NAME "ZeroMQ reference guide"
|
||||||
INSTALL_TYPES FullInstall DevInstall
|
INSTALL_TYPES FullInstall DevInstall
|
||||||
GROUP Development
|
GROUP Development)
|
||||||
)
|
endif()
|
||||||
endif (WITH_DOC)
|
|
||||||
cpack_add_component(Runtime
|
cpack_add_component(Runtime
|
||||||
DISPLAY_NAME "ZeroMQ runtime files"
|
DISPLAY_NAME "ZeroMQ runtime files"
|
||||||
REQUIRED
|
REQUIRED
|
||||||
INSTALL_TYPES FullInstall DevInstall MinInstall
|
INSTALL_TYPES FullInstall DevInstall MinInstall)
|
||||||
)
|
|
||||||
cpack_add_install_type(FullInstall
|
cpack_add_install_type(FullInstall
|
||||||
DISPLAY_NAME "Full install, including source code"
|
DISPLAY_NAME "Full install, including source code")
|
||||||
)
|
|
||||||
cpack_add_install_type(DevInstall
|
cpack_add_install_type(DevInstall
|
||||||
DISPLAY_NAME "Developer install, headers and libraries"
|
DISPLAY_NAME "Developer install, headers and libraries")
|
||||||
)
|
|
||||||
cpack_add_install_type(MinInstall
|
cpack_add_install_type(MinInstall
|
||||||
DISPLAY_NAME "Minimal install, runtime only"
|
DISPLAY_NAME "Minimal install, runtime only")
|
||||||
)
|
endif()
|
||||||
|
|
||||||
# end of file
|
# 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()
|
||||||
|
91
builds/cmake/platform.hpp.in
Normal file
91
builds/cmake/platform.hpp.in
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#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
|
24
cmake/Modules/FindAsciiDoc.cmake
Normal file
24
cmake/Modules/FindAsciiDoc.cmake
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# - 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)
|
@ -1,28 +1,11 @@
|
|||||||
|
|
||||||
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(RUN_RESULT MATCHES "FAILED_TO_RUN")
|
|
||||||
MESSAGE(STATUS "Detecting ZMQ - failed")
|
|
||||||
ELSE()
|
|
||||||
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1" ZMQ_VERSION_MAJOR "${RUN_OUTPUT}")
|
|
||||||
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\2" ZMQ_VERSION_MINOR "${RUN_OUTPUT}")
|
|
||||||
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\3" ZMQ_VERSION_PATCH "${RUN_OUTPUT}")
|
|
||||||
MESSAGE(STATUS "Detecting ZMQ - ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}")
|
|
||||||
ENDIF()
|
|
||||||
ELSE()
|
|
||||||
MESSAGE(STATUS "Check for ZMQ version - not found")
|
|
||||||
MESSAGE(STATUS "Detecting ZMQ - failed")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
if(MSVC_VERSION MATCHES "1700")
|
if(MSVC_VERSION MATCHES "1700")
|
||||||
set(_zmq_COMPILER "-v110")
|
set(_zmq_COMPILER "-v110")
|
||||||
|
129
cmake/Modules/ZMQSourceRunChecks.cmake
Normal file
129
cmake/Modules/ZMQSourceRunChecks.cmake
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
|
||||||
|
|
||||||
|
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()
|
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
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 @@
|
|||||||
#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 @@
|
|||||||
#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
|
|||||||
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
|
|||||||
|
|
||||||
// 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
|
|||||||
|
|
||||||
// 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
|
|||||||
|
|
||||||
// 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_)
|
|||||||
|
|
||||||
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_)
|
|||||||
|
|
||||||
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_)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
src/libzmq.pc.cmake.in
Normal file
10
src/libzmq.pc.cmake.in
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
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_)
|
|||||||
process_reaped ();
|
process_reaped ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case command_t::done:
|
||||||
default:
|
default:
|
||||||
zmq_assert (false);
|
zmq_assert (false);
|
||||||
}
|
}
|
||||||
|
@ -320,21 +320,24 @@ 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;
|
errno = EINVAL;
|
||||||
return -1;
|
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 ()
|
|||||||
// 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_)
|
|||||||
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_)
|
|||||||
|
|
||||||
// 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_)
|
|||||||
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_)
|
|||||||
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_)
|
|||||||
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_)
|
|||||||
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_)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
|||||||
|
|
||||||
// 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 ()
|
|||||||
// 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 @@
|
|||||||
|
|
||||||
|
|
||||||
// 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_)
|
|||||||
|
|
||||||
// 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_)
|
|||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user