2012-12-31 23:52:32 +01:00
|
|
|
# CMake build script for ZeroMQ
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
cmake_minimum_required (VERSION 2.8.12)
|
|
|
|
project (ZeroMQ)
|
|
|
|
|
2017-04-04 10:28:38 +02:00
|
|
|
list (INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}")
|
2016-02-11 13:32:01 +01:00
|
|
|
|
2016-02-19 22:48:43 +01:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-std=gnu++11" COMPILER_SUPPORTS_CXX11)
|
|
|
|
if(COMPILER_SUPPORTS_CXX11)
|
2016-03-06 13:23:26 +01:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
2016-02-19 22:48:43 +01:00
|
|
|
endif()
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
CHECK_C_COMPILER_FLAG("-std=gnu11" COMPILER_SUPPORTS_C11)
|
|
|
|
if(COMPILER_SUPPORTS_C11)
|
2016-03-06 13:23:26 +01:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
2016-02-19 22:48:43 +01:00
|
|
|
endif()
|
|
|
|
|
2016-09-27 19:39:07 +02:00
|
|
|
# Will be used to add flags to pkg-config useful when apps want to statically link
|
|
|
|
set (pkg_config_libs_private "")
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
option (WITH_OPENPGM "Build with support for OpenPGM" OFF)
|
|
|
|
option (WITH_VMCI "Build with support for VMware VMCI socket" OFF)
|
|
|
|
|
|
|
|
if (APPLE)
|
2017-01-27 19:30:18 +01:00
|
|
|
option (ZMQ_BUILD_FRAMEWORK "Build as OS X framework" OFF)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
# Select curve encryption library, defaults to tweetnacl
|
|
|
|
# To use libsodium instead, use --with-libsodium (must be installed)
|
|
|
|
# To disable curve, use --disable-curve
|
|
|
|
|
|
|
|
option (WITH_LIBSODIUM "Use libsodium instead of built-in tweetnacl" OFF)
|
|
|
|
option (ENABLE_CURVE "Enable CURVE security" ON)
|
|
|
|
|
|
|
|
if (NOT ENABLE_CURVE)
|
|
|
|
message (STATUS "CURVE security is disabled")
|
|
|
|
|
2016-02-11 21:40:34 +01:00
|
|
|
elseif (WITH_LIBSODIUM)
|
2016-02-11 13:32:01 +01:00
|
|
|
find_package (Sodium)
|
|
|
|
if (SODIUM_FOUND)
|
|
|
|
message (STATUS "Using libsodium for CURVE security")
|
|
|
|
include_directories (${SODIUM_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
# On Solaris, libsodium depends on libssp
|
2016-02-11 21:41:18 +01:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
2017-04-24 15:57:14 +02:00
|
|
|
target_link_libraries (libzmq ssp)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2016-03-12 15:25:41 +01:00
|
|
|
set (ZMQ_USE_LIBSODIUM 1)
|
2016-02-11 18:06:07 +01:00
|
|
|
set (ZMQ_HAVE_CURVE 1)
|
2016-09-28 00:08:40 +02:00
|
|
|
set (pkg_config_libs_private "${pkg_config_libs_private} -lsodium")
|
2016-02-11 13:32:01 +01:00
|
|
|
else ()
|
|
|
|
message (FATAL_ERROR
|
|
|
|
"libsodium is not installed. Install it, then run CMake again")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
else ()
|
|
|
|
message (STATUS "Using tweetnacl for CURVE security")
|
2016-02-11 18:06:07 +01:00
|
|
|
list (APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/tweetnacl.c)
|
|
|
|
set (ZMQ_USE_TWEETNACL 1)
|
|
|
|
set (ZMQ_HAVE_CURVE 1)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
|
|
|
|
2016-05-02 20:44:35 +02:00
|
|
|
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
|
|
|
|
if (EXISTS "${SOURCE_DIR}/.git")
|
|
|
|
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" ON)
|
|
|
|
else ()
|
|
|
|
OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
|
|
|
|
endif ()
|
|
|
|
IF (ENABLE_DRAFTS)
|
|
|
|
ADD_DEFINITIONS (-DZMQ_BUILD_DRAFT_API)
|
|
|
|
set (pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1")
|
|
|
|
ELSE (ENABLE_DRAFTS)
|
|
|
|
set (pkg_config_defines "")
|
|
|
|
ENDIF (ENABLE_DRAFTS)
|
|
|
|
|
2016-05-06 21:50:56 +02:00
|
|
|
option (WITH_MILITANT "Enable militant assertions" OFF)
|
|
|
|
if (WITH_MILITANT)
|
|
|
|
add_definitions(-DZMQ_ACT_MILITANT)
|
|
|
|
endif()
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
set (POLLER "" CACHE STRING "Choose polling system. valid values are
|
2016-09-21 05:24:26 +02:00
|
|
|
kqueue, epoll, devpoll, pollset, poll or select [default=autodetect]")
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
include (CheckFunctionExists)
|
|
|
|
include (CheckTypeSize)
|
|
|
|
|
|
|
|
if (POLLER STREQUAL "")
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES sys/event.h)
|
|
|
|
check_function_exists (kqueue HAVE_KQUEUE)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES)
|
|
|
|
if (HAVE_KQUEUE)
|
|
|
|
set (POLLER "kqueue")
|
2014-02-17 14:08:11 +01:00
|
|
|
endif()
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (POLLER STREQUAL "")
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES sys/epoll.h)
|
|
|
|
check_function_exists (epoll_create HAVE_EPOLL)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES)
|
|
|
|
if (HAVE_EPOLL)
|
|
|
|
set (POLLER "epoll")
|
2016-12-26 18:01:36 +01:00
|
|
|
check_function_exists (epoll_create1 HAVE_EPOLL_CLOEXEC)
|
|
|
|
if (HAVE_EPOLL_CLOEXEC)
|
|
|
|
set (ZMQ_USE_EPOLL_CLOEXEC 1)
|
|
|
|
endif ()
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (POLLER STREQUAL "")
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES sys/devpoll.h)
|
|
|
|
check_type_size ("struct pollfd" DEVPOLL)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES)
|
|
|
|
if (HAVE_DEVPOLL)
|
|
|
|
set (POLLER "devpoll")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
2016-09-21 05:24:26 +02:00
|
|
|
if (POLLER STREQUAL "")
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES sys/pollset.h)
|
|
|
|
check_function_exists (pollset_create HAVE_POLLSET)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES)
|
|
|
|
if (HAVE_POLLSET)
|
|
|
|
set (POLLER "pollset")
|
|
|
|
endif()
|
|
|
|
endif ()
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (POLLER STREQUAL "")
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES poll.h)
|
|
|
|
check_function_exists (poll HAVE_POLL)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES)
|
|
|
|
if (HAVE_POLL)
|
|
|
|
set (POLLER "poll")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (POLLER STREQUAL "")
|
|
|
|
if (WIN32)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES winsock2.h)
|
|
|
|
set (HAVE_SELECT 1)
|
|
|
|
else ()
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES sys/select.h)
|
|
|
|
check_function_exists (select HAVE_SELECT)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES)
|
|
|
|
endif ()
|
|
|
|
if (HAVE_SELECT)
|
|
|
|
set (POLLER "select")
|
|
|
|
else ()
|
|
|
|
message (FATAL_ERROR
|
|
|
|
"Could not autodetect polling method")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (POLLER STREQUAL "kqueue"
|
|
|
|
OR POLLER STREQUAL "epoll"
|
|
|
|
OR POLLER STREQUAL "devpoll"
|
2016-09-21 05:24:26 +02:00
|
|
|
OR POLLER STREQUAL "pollset"
|
2016-02-11 13:32:01 +01:00
|
|
|
OR POLLER STREQUAL "poll"
|
|
|
|
OR POLLER STREQUAL "select")
|
|
|
|
message (STATUS "Detected ${POLLER} polling method")
|
|
|
|
string (TOUPPER ${POLLER} UPPER_POLLER)
|
|
|
|
set (ZMQ_USE_${UPPER_POLLER} 1)
|
|
|
|
else ()
|
|
|
|
message (FATAL_ERROR "Invalid polling method")
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
set (ZMQ_CMAKE_MODULES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules)
|
|
|
|
list (APPEND CMAKE_MODULE_PATH ${ZMQ_CMAKE_MODULES_DIR})
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
include (TestZMQVersion)
|
2017-04-04 10:32:29 +02:00
|
|
|
if (NOT CMAKE_CROSSCOMPILING)
|
|
|
|
include (ZMQSourceRunChecks)
|
|
|
|
endif ()
|
2016-02-11 13:32:01 +01:00
|
|
|
include (CheckIncludeFiles)
|
|
|
|
include (CheckLibraryExists)
|
|
|
|
include (CheckCCompilerFlag)
|
|
|
|
include (CheckCXXCompilerFlag)
|
|
|
|
include (CheckCSourceCompiles)
|
|
|
|
include (CheckCSourceRuns)
|
|
|
|
include (CMakeDependentOption)
|
|
|
|
include (CheckCXXSymbolExists)
|
2015-02-06 16:42:23 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
check_include_files (ifaddrs.h ZMQ_HAVE_IFADDRS)
|
|
|
|
check_include_files (windows.h ZMQ_HAVE_WINDOWS)
|
2017-06-14 15:55:29 +02:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND CMAKE_SYSTEM_VERSION STREQUAL "10.0")
|
2017-04-04 10:50:33 +02:00
|
|
|
SET(ZMQ_HAVE_WINDOWS_UWP ON)
|
|
|
|
ADD_DEFINITIONS(-D_WIN32_WINNT=_WIN32_WINNT_WIN10)
|
|
|
|
endif()
|
2016-02-11 13:32:01 +01:00
|
|
|
check_include_files (sys/uio.h ZMQ_HAVE_UIO)
|
|
|
|
check_include_files (sys/eventfd.h ZMQ_HAVE_EVENTFD)
|
2017-04-04 10:32:29 +02:00
|
|
|
if (ZMQ_HAVE_EVENTFD AND NOT CMAKE_CROSSCOMPILING)
|
2016-12-26 18:18:00 +01:00
|
|
|
zmq_check_efd_cloexec ()
|
|
|
|
endif ()
|
2015-02-06 16:42:23 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
check_library_exists (ws2_32 fopen "" HAVE_WS2_32) # TODO: Why doesn't something logical like WSAStartup work?
|
|
|
|
check_library_exists (ws2 fopen "" HAVE_WS2)
|
|
|
|
check_library_exists (rpcrt4 fopen "" HAVE_RPCRT4) # UuidCreateSequential
|
|
|
|
check_library_exists (iphlpapi fopen "" HAVE_IPHLAPI) # GetAdaptersAddresses
|
2013-12-06 19:55:44 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
check_cxx_symbol_exists (SO_PEERCRED sys/socket.h ZMQ_HAVE_SO_PEERCRED)
|
|
|
|
check_cxx_symbol_exists (LOCAL_PEERCRED sys/socket.h ZMQ_HAVE_LOCAL_PEERCRED)
|
2013-01-23 20:31:02 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
find_library (RT_LIBRARY rt)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
find_package (Threads)
|
2013-01-02 03:04:19 +01:00
|
|
|
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
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 ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (NOT HAVE_IPHLAPI)
|
|
|
|
message (FATAL_ERROR "Cannot link to iphlapi")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
set (CMAKE_REQUIRED_LIBRARIES rt)
|
|
|
|
check_function_exists (clock_gettime HAVE_CLOCK_GETTIME)
|
|
|
|
set (CMAKE_REQUIRED_LIBRARIES)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
set (CMAKE_REQUIRED_INCLUDES unistd.h)
|
|
|
|
check_function_exists (fork HAVE_FORK)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES)
|
2014-03-17 21:09:10 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
set (CMAKE_REQUIRED_INCLUDES sys/time.h)
|
|
|
|
check_function_exists (gethrtime HAVE_GETHRTIME)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-04-10 23:45:35 +02:00
|
|
|
set (CMAKE_REQUIRED_INCLUDES stdlib.h)
|
|
|
|
check_function_exists (mkdtemp HAVE_MKDTEMP)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES)
|
|
|
|
|
2017-11-17 19:40:53 +01:00
|
|
|
set (CMAKE_REQUIRED_INCLUDES sys/socket.h)
|
|
|
|
check_function_exists (accept4 HAVE_ACCEPT4)
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES)
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
add_definitions (-D_REENTRANT -D_THREAD_SAFE)
|
2016-02-12 11:31:38 +01:00
|
|
|
add_definitions (-DZMQ_CUSTOM_PLATFORM_HPP)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
option (ENABLE_EVENTFD "Enable/disable eventfd" ZMQ_HAVE_EVENTFD)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
macro (zmq_check_cxx_flag_prepend flag)
|
|
|
|
check_cxx_compiler_flag ("${flag}" HAVE_FLAG_${flag})
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (HAVE_FLAG_${flag})
|
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
|
|
|
endif ()
|
|
|
|
endmacro ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (MSVC)
|
|
|
|
zmq_check_cxx_flag_prepend ("/W3")
|
2015-12-18 15:50:41 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (MSVC_IDE)
|
|
|
|
set (MSVC_TOOLSET "-${CMAKE_VS_PLATFORM_TOOLSET}")
|
|
|
|
else ()
|
|
|
|
set (MSVC_TOOLSET "")
|
|
|
|
endif ()
|
|
|
|
else ()
|
|
|
|
zmq_check_cxx_flag_prepend ("-Wall")
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
zmq_check_cxx_flag_prepend ("-Wextra")
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
# TODO: why is -Wno-long-long defined differently than in configure.ac?
|
|
|
|
zmq_check_cxx_flag_prepend ("-Wno-long-long")
|
|
|
|
zmq_check_cxx_flag_prepend ("-Wno-uninitialized")
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
option (LIBZMQ_PEDANTIC "" ON)
|
|
|
|
option (LIBZMQ_WERROR "" OFF)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (LIBZMQ_PEDANTIC)
|
|
|
|
zmq_check_cxx_flag_prepend ("-pedantic")
|
2013-01-01 09:26:31 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")
|
|
|
|
zmq_check_cxx_flag_prepend ("-strict-ansi")
|
|
|
|
endif ()
|
2013-01-01 09:26:31 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
|
|
|
|
zmq_check_cxx_flag_prepend ("-compat=5")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (LIBZMQ_WERROR)
|
|
|
|
zmq_check_cxx_flag_prepend ("-Werror")
|
|
|
|
zmq_check_cxx_flag_prepend ("-errwarn=%all")
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
|
|
|
|
zmq_check_cxx_flag_prepend ("-mcpu=v9")
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro")
|
|
|
|
zmq_check_cxx_flag_prepend ("-features=zla")
|
|
|
|
endif ()
|
2013-01-01 11:22:05 +01:00
|
|
|
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
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 (
|
2012-12-31 23:52:32 +01:00
|
|
|
"
|
|
|
|
#include <atomic.h>
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
int main ()
|
2012-12-31 23:52:32 +01:00
|
|
|
{
|
|
|
|
uint32_t value;
|
2016-02-11 13:32:01 +01:00
|
|
|
atomic_cas_32 (&value, 0, 0);
|
2012-12-31 23:52:32 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
"
|
|
|
|
HAVE_ATOMIC_H)
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (NOT HAVE_ATOMIC_H)
|
|
|
|
set (ZMQ_FORCE_MUTEXES 1)
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
2017-04-04 10:32:29 +02:00
|
|
|
if (NOT CMAKE_CROSSCOMPILING)
|
|
|
|
zmq_check_sock_cloexec ()
|
2017-07-28 00:29:33 +02:00
|
|
|
zmq_check_o_cloexec ()
|
Add socket option BINDTODEVICE
Linux now supports Virtual Routing and Forwarding (VRF) as per:
https://www.kernel.org/doc/Documentation/networking/vrf.txt
In order for an application to bind or connect to a socket with an
address in a VRF, they need to first bind the socket to the VRF device:
setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, dev, strlen(dev)+1);
Note "dev" is the VRF device, eg. VRF "blue", rather than an interface
enslaved to the VRF.
Add a new socket option, ZMQ_BINDTODEVICE, to bind a socket to a device.
In general, if a socket is bound to a device, eg. an interface, only
packets received from that particular device are processed by the socket.
If device is a VRF device, then subsequent binds/connects to that socket
use addresses in the VRF routing table.
2017-07-28 15:35:09 +02:00
|
|
|
zmq_check_so_bindtodevice ()
|
2017-04-04 10:32:29 +02:00
|
|
|
zmq_check_so_keepalive ()
|
|
|
|
zmq_check_tcp_keepcnt ()
|
|
|
|
zmq_check_tcp_keepidle ()
|
|
|
|
zmq_check_tcp_keepintvl ()
|
|
|
|
zmq_check_tcp_keepalive ()
|
|
|
|
zmq_check_tcp_tipc ()
|
|
|
|
zmq_check_pthread_setname ()
|
2017-10-16 13:29:03 +02:00
|
|
|
zmq_check_pthread_setaffinity ()
|
2017-07-27 22:37:12 +02:00
|
|
|
zmq_check_getrandom ()
|
2017-04-04 10:32:29 +02:00
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if ( CMAKE_SYSTEM_NAME MATCHES "Linux"
|
2012-12-31 23:52:32 +01:00
|
|
|
OR CMAKE_SYSTEM_NAME MATCHES "GNU/kFreeBSD"
|
|
|
|
OR CMAKE_SYSTEM_NAME MATCHES "GNU/Hurd"
|
|
|
|
OR CYGWIN)
|
2016-02-11 13:32:01 +01:00
|
|
|
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
|
2016-08-28 12:57:28 +02:00
|
|
|
"PYTHONINTERP_FOUND;ASCIIDOC_FOUND" OFF)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
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
|
2012-12-31 23:52:32 +01:00
|
|
|
PATHS
|
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
|
|
|
|
NO_DEFAULT_PATH
|
2016-02-11 13:32:01 +01:00
|
|
|
)
|
|
|
|
message (STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
|
|
|
|
else ()
|
|
|
|
find_path (OPENPGM_ROOT include/pgm/pgm.h
|
2012-12-31 23:52:32 +01:00
|
|
|
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
|
2016-02-11 13:32:01 +01:00
|
|
|
)
|
|
|
|
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
|
2015-12-18 15:50:41 +01:00
|
|
|
optimized libpgm${MSVC_TOOLSET}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib
|
|
|
|
debug libpgm${MSVC_TOOLSET}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
|
|
|
else ()
|
|
|
|
if (WITH_OPENPGM)
|
2016-11-01 12:31:40 +01:00
|
|
|
# message (FATAL_ERROR "WITH_OPENPGM not implemented")
|
|
|
|
|
|
|
|
if (NOT OPENPGM_PKGCONFIG_NAME)
|
|
|
|
SET (OPENPGM_PKGCONFIG_NAME "openpgm-5.2")
|
|
|
|
endif(NOT OPENPGM_PKGCONFIG_NAME)
|
|
|
|
|
|
|
|
SET (OPENPGM_PKGCONFIG_NAME ${OPENPGM_PKGCONFIG_NAME} CACHE STRING
|
|
|
|
"Name pkg-config shall use to find openpgm libraries and include paths"
|
|
|
|
FORCE )
|
|
|
|
|
|
|
|
find_package(PkgConfig)
|
|
|
|
pkg_check_modules (OPENPGM ${OPENPGM_PKGCONFIG_NAME})
|
|
|
|
|
|
|
|
if (OPENPGM_FOUND)
|
|
|
|
message (STATUS ${OPENPGM_PKGCONFIG_NAME}" found")
|
|
|
|
else ()
|
|
|
|
message (FATAL_ERROR
|
|
|
|
${OPENPGM_PKGCONFIG_NAME}" not found. openpgm is searchd via `pkg-config ${OPENPGM_PKGCONFIG_NAME}`. Consider providing a valid OPENPGM_PKGCONFIG_NAME")
|
|
|
|
endif ()
|
|
|
|
|
2012-12-31 23:52:32 +01:00
|
|
|
# DSO symbol visibility for openpgm
|
2016-02-11 13:32:01 +01:00
|
|
|
if (HAVE_FLAG_VISIBILITY_HIDDEN)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
elseif (HAVE_FLAG_LDSCOPE_HIDDEN)
|
2016-11-01 12:31:40 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2012-10-11 12:31:30 +02:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# force off-tree build
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
message (FATAL_ERROR "CMake generation is not allowed within the source directory!
|
2012-10-11 12:31:30 +02:00
|
|
|
Remove the CMakeCache.txt file and try again from another folder, e.g.:
|
|
|
|
|
2012-12-31 23:52:32 +01:00
|
|
|
rm CMakeCache.txt
|
2012-10-11 12:31:30 +02:00
|
|
|
mkdir cmake-make
|
|
|
|
cd cmake-make
|
|
|
|
cmake ..
|
|
|
|
")
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2012-10-11 12:31:30 +02:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# default to Release build
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
2015-08-21 05:45:59 +02:00
|
|
|
# CMAKE_BUILD_TYPE is not used for multi-configuration generators like Visual Studio/XCode
|
|
|
|
# which instead use CMAKE_CONFIGURATION_TYPES
|
2016-02-11 13:32:01 +01:00
|
|
|
set (CMAKE_BUILD_TYPE Release CACHE STRING
|
2012-10-11 12:31:30 +02:00
|
|
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
|
|
|
FORCE)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2012-10-11 12:31:30 +02:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
|
|
|
set (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
2015-02-12 20:29:09 +01:00
|
|
|
|
2012-10-11 12:31:30 +02:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# platform specifics
|
|
|
|
|
2015-03-11 10:10:23 +01:00
|
|
|
if (WIN32)
|
2016-02-12 16:30:55 +01:00
|
|
|
# Socket limit is 16K (can be raised arbitrarily)
|
|
|
|
add_definitions (-DFD_SETSIZE=16384)
|
2016-02-11 13:32:01 +01:00
|
|
|
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
|
2016-03-06 13:23:26 +01:00
|
|
|
add_definitions (-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
2015-03-11 10:10:23 +01:00
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (MSVC)
|
2012-12-31 23:52:32 +01:00
|
|
|
# Parallel make.
|
2016-02-11 13:32:01 +01:00
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
2012-10-11 12:31:30 +02:00
|
|
|
|
2012-12-31 23:52:32 +01:00
|
|
|
# Optimization flags.
|
|
|
|
# http://msdn.microsoft.com/en-us/magazine/cc301698.aspx
|
2016-02-11 13:32:01 +01:00
|
|
|
if (NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug")
|
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GL")
|
|
|
|
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG")
|
|
|
|
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LTCG")
|
|
|
|
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LTCG")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2012-10-12 20:18:04 +02:00
|
|
|
|
|
|
|
|
2012-10-11 12:31:30 +02:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# source files
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
set (cxx-sources
|
2017-01-06 10:52:20 +01:00
|
|
|
precompiled.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
address.cpp
|
2015-02-02 15:42:50 +01:00
|
|
|
client.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
clock.cpp
|
|
|
|
ctx.cpp
|
2017-08-18 11:34:22 +02:00
|
|
|
curve_mechanism_base.cpp
|
2013-06-18 23:38:24 +02:00
|
|
|
curve_client.cpp
|
|
|
|
curve_server.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
dealer.cpp
|
|
|
|
devpoll.cpp
|
2016-05-13 04:06:45 +02:00
|
|
|
dgram.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
dist.cpp
|
|
|
|
epoll.cpp
|
|
|
|
err.cpp
|
|
|
|
fq.cpp
|
|
|
|
io_object.cpp
|
|
|
|
io_thread.cpp
|
|
|
|
ip.cpp
|
|
|
|
ipc_address.cpp
|
|
|
|
ipc_connecter.cpp
|
|
|
|
ipc_listener.cpp
|
|
|
|
kqueue.cpp
|
|
|
|
lb.cpp
|
|
|
|
mailbox.cpp
|
2015-02-12 15:56:14 +01:00
|
|
|
mailbox_safe.cpp
|
2013-08-17 14:43:45 +02:00
|
|
|
mechanism.cpp
|
2017-08-18 11:34:22 +02:00
|
|
|
mechanism_base.cpp
|
2014-05-01 21:35:53 +02:00
|
|
|
metadata.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
msg.cpp
|
|
|
|
mtrie.cpp
|
|
|
|
object.cpp
|
|
|
|
options.cpp
|
|
|
|
own.cpp
|
2013-08-17 14:43:45 +02:00
|
|
|
null_mechanism.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
pair.cpp
|
|
|
|
pgm_receiver.cpp
|
|
|
|
pgm_sender.cpp
|
|
|
|
pgm_socket.cpp
|
|
|
|
pipe.cpp
|
2014-05-12 09:51:13 +02:00
|
|
|
plain_client.cpp
|
|
|
|
plain_server.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
poll.cpp
|
|
|
|
poller_base.cpp
|
2016-09-21 05:28:32 +02:00
|
|
|
pollset.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
proxy.cpp
|
|
|
|
pub.cpp
|
|
|
|
pull.cpp
|
|
|
|
push.cpp
|
|
|
|
random.cpp
|
|
|
|
raw_encoder.cpp
|
|
|
|
raw_decoder.cpp
|
|
|
|
reaper.cpp
|
|
|
|
rep.cpp
|
|
|
|
req.cpp
|
|
|
|
router.cpp
|
|
|
|
select.cpp
|
2015-02-02 15:42:50 +01:00
|
|
|
server.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
session_base.cpp
|
|
|
|
signaler.cpp
|
|
|
|
socket_base.cpp
|
2014-06-23 14:10:43 +02:00
|
|
|
socks.cpp
|
|
|
|
socks_connecter.cpp
|
2013-07-01 12:52:39 +02:00
|
|
|
stream.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
stream_engine.cpp
|
|
|
|
sub.cpp
|
|
|
|
tcp.cpp
|
|
|
|
tcp_address.cpp
|
|
|
|
tcp_connecter.cpp
|
|
|
|
tcp_listener.cpp
|
|
|
|
thread.cpp
|
|
|
|
trie.cpp
|
|
|
|
v1_decoder.cpp
|
|
|
|
v1_encoder.cpp
|
2013-03-13 20:10:00 +01:00
|
|
|
v2_decoder.cpp
|
|
|
|
v2_encoder.cpp
|
2012-12-31 23:52:32 +01:00
|
|
|
xpub.cpp
|
|
|
|
xsub.cpp
|
|
|
|
zmq.cpp
|
2015-06-14 19:00:52 +02:00
|
|
|
zmq_utils.cpp
|
2015-08-21 05:45:59 +02:00
|
|
|
decoder_allocators.cpp
|
2015-10-18 20:07:23 +02:00
|
|
|
socket_poller.cpp
|
2015-12-18 11:12:18 +01:00
|
|
|
timers.cpp
|
2016-01-27 17:19:14 +01:00
|
|
|
config.hpp
|
|
|
|
radio.cpp
|
2016-01-29 20:17:11 +01:00
|
|
|
dish.cpp
|
|
|
|
udp_engine.cpp
|
2016-04-21 12:23:44 +02:00
|
|
|
udp_address.cpp
|
|
|
|
scatter.cpp
|
2017-08-16 10:03:11 +02:00
|
|
|
gather.cpp
|
|
|
|
zap_client.cpp)
|
2013-01-02 03:04:19 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (MINGW)
|
2013-01-02 03:04:19 +01:00
|
|
|
# Generate the right type when using -m32 or -m64
|
2016-02-11 13:32:01 +01:00
|
|
|
macro (set_rc_arch rc_target)
|
|
|
|
set (CMAKE_RC_COMPILER_INIT windres)
|
|
|
|
enable_language (RC)
|
|
|
|
set (CMAKE_RC_COMPILE_OBJECT
|
2014-04-13 15:25:22 +02:00
|
|
|
"<CMAKE_RC_COMPILER> <FLAGS> -O coff --target=${rc_target} <DEFINES> -i <SOURCE> -o <OBJECT>")
|
2016-02-11 13:32:01 +01:00
|
|
|
endmacro ()
|
2013-01-02 03:04:19 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (NOT CMAKE_SYSTEM_PROCESSOR)
|
|
|
|
set (CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
2013-10-23 20:22:20 +02:00
|
|
|
endif ()
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if ( CMAKE_SYSTEM_PROCESSOR MATCHES "i386"
|
2013-10-23 20:22:20 +02:00
|
|
|
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i486"
|
|
|
|
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i586"
|
|
|
|
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686"
|
2013-01-02 03:04:19 +01:00
|
|
|
# This also happens on x86_64 systems...what a worthless variable
|
2013-10-23 20:22:20 +02:00
|
|
|
OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86"
|
|
|
|
OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64"
|
|
|
|
OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
|
2013-01-02 03:04:19 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set_rc_arch ("pe-x86-64")
|
|
|
|
else ()
|
|
|
|
set_rc_arch ("pe-i386")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2013-01-02 03:04:19 +01:00
|
|
|
|
2016-02-18 10:27:21 +01:00
|
|
|
set (public_headers include/zmq.h
|
|
|
|
include/zmq_utils.h)
|
2013-01-02 03:04:19 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
set (readme-docs AUTHORS
|
2013-01-02 03:04:19 +01:00
|
|
|
COPYING
|
|
|
|
COPYING.LESSER
|
2013-07-14 19:26:55 +02:00
|
|
|
NEWS)
|
2012-10-11 12:31:30 +02:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# optional modules
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (WITH_OPENPGM)
|
|
|
|
add_definitions (-DZMQ_HAVE_OPENPGM)
|
|
|
|
include_directories (${OPENPGM_INCLUDE_DIRS})
|
|
|
|
link_directories (${OPENPGM_LIBRARY_DIRS})
|
|
|
|
set (OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES})
|
|
|
|
endif (WITH_OPENPGM)
|
2012-10-11 12:31:30 +02:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (WITH_VMCI)
|
|
|
|
add_definitions (-DZMQ_HAVE_VMCI)
|
|
|
|
include_directories (${VMCI_INCLUDE_DIRS})
|
|
|
|
list (APPEND cxx-sources vmci_address.cpp vmci_connecter.cpp vmci_listener.cpp vmci.cpp)
|
|
|
|
endif (WITH_VMCI)
|
2015-12-07 13:19:45 +01:00
|
|
|
|
2016-04-21 12:33:20 +02:00
|
|
|
if (ZMQ_HAVE_TIPC)
|
|
|
|
add_definitions (-DZMQ_HAVE_TIPC)
|
2016-05-04 17:12:27 +02:00
|
|
|
list (APPEND cxx-sources tipc_address.cpp tipc_connecter.cpp tipc_listener.cpp)
|
2016-04-21 12:33:20 +02:00
|
|
|
endif (ZMQ_HAVE_TIPC)
|
|
|
|
|
2012-10-11 12:31:30 +02:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# source generators
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
foreach (source ${cxx-sources})
|
|
|
|
list (APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/${source})
|
|
|
|
endforeach ()
|
2012-10-11 12:31:30 +02:00
|
|
|
|
2017-11-18 14:46:49 +01:00
|
|
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
2014-05-01 21:24:20 +02:00
|
|
|
|
2016-02-11 13:38:02 +01:00
|
|
|
# Delete any src/platform.hpp left by configure
|
|
|
|
file (REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/src/platform.hpp)
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/platform.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp)
|
|
|
|
list (APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp)
|
2013-01-01 08:25:15 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/libzmq.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc @ONLY)
|
|
|
|
set (zmq-pkgconfig ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc)
|
2012-10-11 12:31:30 +02:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (NOT ZMQ_BUILD_FRAMEWORK)
|
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libzmq.pc DESTINATION lib/pkgconfig)
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (MSVC)
|
|
|
|
if (CMAKE_CL_64)
|
|
|
|
set (nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/NSIS.template64.in)
|
|
|
|
else ()
|
|
|
|
set (nsis-template ${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/NSIS.template32.in)
|
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
add_custom_command (
|
2013-01-01 12:53:56 +01:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
ARGS -E
|
|
|
|
copy
|
|
|
|
${nsis-template}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in
|
|
|
|
DEPENDS ${nsis-template})
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc)
|
|
|
|
file (GLOB docs RELATIVE ${CMAKE_CURRENT_BINARY_DIR}/ "${CMAKE_CURRENT_SOURCE_DIR}/doc/*.txt")
|
|
|
|
set (html-docs)
|
|
|
|
foreach (txt ${docs})
|
2016-08-28 13:00:09 +02:00
|
|
|
string (REGEX REPLACE ".*/(.*)\\.txt" "\\1.html" html ${txt})
|
2016-02-11 13:32:01 +01:00
|
|
|
set (src ${txt})
|
|
|
|
set (dst doc/${html})
|
|
|
|
if (WITH_DOC)
|
2017-04-28 09:06:45 +02:00
|
|
|
add_custom_command (
|
|
|
|
OUTPUT ${dst}
|
|
|
|
COMMAND ${ASCIIDOC_EXECUTABLE}
|
|
|
|
-d manpage
|
|
|
|
-b xhtml11
|
|
|
|
-f ${CMAKE_CURRENT_SOURCE_DIR}/doc/asciidoc.conf
|
|
|
|
-azmq_version=${ZMQ_VERSION}
|
|
|
|
-o ${dst}
|
|
|
|
${src}
|
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${src}
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMENT "Generating ${html}")
|
2016-02-11 13:32:01 +01:00
|
|
|
list (APPEND html-docs ${CMAKE_CURRENT_BINARY_DIR}/${dst})
|
|
|
|
endif ()
|
|
|
|
endforeach ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (ZMQ_BUILD_FRAMEWORK)
|
|
|
|
add_custom_command (
|
2017-04-24 15:57:14 +02:00
|
|
|
TARGET libzmq
|
2012-12-31 23:52:32 +01:00
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
ARGS -E make_directory "${CMAKE_LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION}/MacOS"
|
|
|
|
COMMENT "Perf tools")
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-03-06 13:23:26 +01:00
|
|
|
if (MSVC)
|
|
|
|
# default for all sources is to use precompiled headers
|
|
|
|
foreach(source ${sources})
|
2017-05-17 18:50:01 +02:00
|
|
|
if (NOT ${source} STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/src/precompiled.cpp")
|
|
|
|
set_source_files_properties(${source}
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_FLAGS "/Yuprecompiled.hpp"
|
|
|
|
OBJECT_DEPENDS precompiled.hpp
|
|
|
|
)
|
|
|
|
endif()
|
2016-03-06 13:23:26 +01:00
|
|
|
endforeach()
|
|
|
|
# create precompiled header
|
|
|
|
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/precompiled.cpp
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_FLAGS "/Ycprecompiled.hpp"
|
2017-05-17 18:50:01 +02:00
|
|
|
OBJECT_OUTPUTS precompiled.hpp
|
2016-03-06 13:23:26 +01:00
|
|
|
)
|
|
|
|
# C and C++ can not use the same precompiled header
|
|
|
|
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tweetnacl.c
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_FLAGS "/Y-"
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2012-10-11 12:31:30 +02:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# output
|
2017-04-18 00:26:04 +02:00
|
|
|
option(BUILD_SHARED "Whether or not to build the shared object" ON)
|
|
|
|
option(BUILD_STATIC "Whether or not to build the static archive" ON)
|
|
|
|
|
|
|
|
list(APPEND target_outputs "")
|
|
|
|
|
|
|
|
if (BUILD_SHARED)
|
2017-04-24 15:57:14 +02:00
|
|
|
list(APPEND target_outputs "libzmq")
|
2017-04-18 00:26:04 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (BUILD_STATIC)
|
2017-04-24 15:57:14 +02:00
|
|
|
list(APPEND target_outputs "libzmq-static")
|
2017-04-18 00:26:04 +02:00
|
|
|
endif()
|
2012-10-11 12:31:30 +02:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (MSVC)
|
2017-05-20 20:22:29 +02:00
|
|
|
# Suppress linker warnings caused by #ifdef omission
|
|
|
|
# of file content.
|
|
|
|
set( CMAKE_STATIC_LINKER_FLAGS /ignore:4221 )
|
2017-04-18 00:26:04 +02:00
|
|
|
if (BUILD_SHARED)
|
2017-12-10 18:41:02 +01:00
|
|
|
add_library (libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
2017-04-24 15:57:14 +02:00
|
|
|
target_link_libraries (libzmq ${OPTIONAL_LIBRARIES})
|
|
|
|
set_target_properties (libzmq PROPERTIES
|
2017-04-18 00:26:04 +02:00
|
|
|
PUBLIC_HEADER "${public_headers}"
|
|
|
|
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
|
|
|
RELWITHDEBINFO_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
|
|
|
DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
|
|
|
|
COMPILE_DEFINITIONS "DLL_EXPORT"
|
|
|
|
OUTPUT_NAME "libzmq")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (BUILD_STATIC)
|
2017-12-10 18:41:02 +01:00
|
|
|
add_library (libzmq-static STATIC ${sources} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
2017-04-24 15:57:14 +02:00
|
|
|
set_target_properties (libzmq-static PROPERTIES
|
2017-04-18 00:26:04 +02:00
|
|
|
PUBLIC_HEADER "${public_headers}"
|
|
|
|
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
|
|
|
RELWITHDEBINFO_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
|
|
|
DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-sgd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
|
|
|
COMPILE_FLAGS "/DZMQ_STATIC"
|
|
|
|
OUTPUT_NAME "libzmq")
|
|
|
|
endif()
|
2016-02-11 13:32:01 +01:00
|
|
|
else ()
|
2017-12-10 18:41:02 +01:00
|
|
|
# avoid building everything twice for shared + static
|
|
|
|
# only on *nix, as Windows needs different preprocessor defines in static builds
|
|
|
|
add_library (objects OBJECT ${sources})
|
|
|
|
set_property(TARGET objects PROPERTY POSITION_INDEPENDENT_CODE ON)
|
|
|
|
|
2017-04-18 00:26:04 +02:00
|
|
|
if (BUILD_SHARED)
|
2017-11-18 14:46:49 +01:00
|
|
|
add_library (libzmq SHARED $<TARGET_OBJECTS:objects> ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
2017-08-19 13:26:36 +02:00
|
|
|
target_link_libraries (libzmq ${OPTIONAL_LIBRARIES})
|
2016-12-01 23:33:43 +01:00
|
|
|
# NOTE: the SOVERSION MUST be the same as the one generated by libtool!
|
2017-04-24 15:57:14 +02:00
|
|
|
set_target_properties (libzmq PROPERTIES
|
2015-03-11 10:15:40 +01:00
|
|
|
COMPILE_DEFINITIONS "DLL_EXPORT"
|
|
|
|
PUBLIC_HEADER "${public_headers}"
|
|
|
|
VERSION ${ZMQ_VERSION}
|
2017-02-18 18:56:55 +01:00
|
|
|
SOVERSION "5.1.3"
|
2017-04-05 18:46:48 +02:00
|
|
|
OUTPUT_NAME "zmq"
|
|
|
|
PREFIX "lib")
|
2016-02-11 13:32:01 +01:00
|
|
|
if (ZMQ_BUILD_FRAMEWORK)
|
2017-04-24 15:57:14 +02:00
|
|
|
set_target_properties (libzmq PROPERTIES
|
2015-02-12 20:29:09 +01:00
|
|
|
FRAMEWORK TRUE
|
|
|
|
MACOSX_FRAMEWORK_IDENTIFIER "org.zeromq.libzmq"
|
|
|
|
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${ZMQ_VERSION}
|
2015-03-11 10:15:40 +01:00
|
|
|
MACOSX_FRAMEWORK_BUNDLE_VERSION ${ZMQ_VERSION})
|
2016-02-11 13:32:01 +01:00
|
|
|
set_source_files_properties (${html-docs} PROPERTIES
|
2015-02-12 20:29:09 +01:00
|
|
|
MACOSX_PACKAGE_LOCATION doc)
|
2016-02-11 13:32:01 +01:00
|
|
|
set_source_files_properties (${readme-docs} PROPERTIES
|
2015-02-12 20:29:09 +01:00
|
|
|
MACOSX_PACKAGE_LOCATION etc)
|
2016-02-11 13:32:01 +01:00
|
|
|
set_source_files_properties (${zmq-pkgconfig} PROPERTIES
|
2015-02-12 20:29:09 +01:00
|
|
|
MACOSX_PACKAGE_LOCATION lib/pkgconfig)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2017-04-18 00:26:04 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (BUILD_STATIC)
|
2017-11-18 14:46:49 +01:00
|
|
|
add_library (libzmq-static STATIC $<TARGET_OBJECTS:objects> ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
2017-04-24 15:57:14 +02:00
|
|
|
set_target_properties (libzmq-static PROPERTIES
|
2014-07-02 21:51:34 +02:00
|
|
|
PUBLIC_HEADER "${public_headers}"
|
2015-03-11 10:03:21 +01:00
|
|
|
COMPILE_DEFINITIONS "ZMQ_STATIC"
|
2017-04-05 18:46:48 +02:00
|
|
|
OUTPUT_NAME "zmq"
|
|
|
|
PREFIX "lib")
|
2017-04-18 00:26:04 +02:00
|
|
|
endif()
|
2017-12-10 18:41:02 +01:00
|
|
|
|
|
|
|
target_include_directories (objects
|
|
|
|
PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2017-12-10 18:41:02 +01:00
|
|
|
foreach (target ${target_outputs})
|
2017-04-04 10:34:28 +02:00
|
|
|
target_include_directories (${target}
|
|
|
|
PUBLIC
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
|
2017-04-18 00:26:04 +02:00
|
|
|
if (BUILD_SHARED)
|
2017-04-24 15:57:14 +02:00
|
|
|
target_link_libraries (libzmq ${CMAKE_THREAD_LIBS_INIT})
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2017-04-18 00:26:04 +02:00
|
|
|
if (SODIUM_FOUND)
|
2017-04-24 15:57:14 +02:00
|
|
|
target_link_libraries (libzmq ${SODIUM_LIBRARIES})
|
2017-04-18 00:26:04 +02:00
|
|
|
endif ()
|
|
|
|
if (HAVE_WS2_32)
|
2017-04-24 15:57:14 +02:00
|
|
|
target_link_libraries (libzmq ws2_32)
|
2017-04-18 00:26:04 +02:00
|
|
|
elseif (HAVE_WS2)
|
2017-04-24 15:57:14 +02:00
|
|
|
target_link_libraries (libzmq ws2)
|
2017-04-18 00:26:04 +02:00
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2017-04-18 00:26:04 +02:00
|
|
|
if (HAVE_RPCRT4)
|
2017-04-24 15:57:14 +02:00
|
|
|
target_link_libraries (libzmq rpcrt4)
|
2017-04-18 00:26:04 +02:00
|
|
|
endif ()
|
2014-02-24 20:07:28 +01:00
|
|
|
|
2017-04-18 00:26:04 +02:00
|
|
|
if (HAVE_IPHLAPI)
|
2017-04-24 15:57:14 +02:00
|
|
|
target_link_libraries (libzmq iphlpapi)
|
2017-04-18 00:26:04 +02:00
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2017-04-18 00:26:04 +02:00
|
|
|
if (RT_LIBRARY)
|
2017-04-24 15:57:14 +02:00
|
|
|
target_link_libraries (libzmq ${RT_LIBRARY})
|
2017-04-18 00:26:04 +02:00
|
|
|
endif ()
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2015-05-06 17:25:26 +02:00
|
|
|
|
2017-04-18 00:26:04 +02:00
|
|
|
if (BUILD_SHARED)
|
|
|
|
set (perf-tools local_lat
|
|
|
|
remote_lat
|
|
|
|
local_thr
|
|
|
|
remote_thr
|
|
|
|
inproc_lat
|
|
|
|
inproc_thr)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2017-04-18 00:26:04 +02:00
|
|
|
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # Why?
|
|
|
|
option (WITH_PERF_TOOL "Build with perf-tools" ON)
|
|
|
|
else ()
|
|
|
|
option (WITH_PERF_TOOL "Build with perf-tools" OFF)
|
|
|
|
endif ()
|
2013-01-23 20:31:02 +01:00
|
|
|
|
2017-04-18 00:26:04 +02:00
|
|
|
if (WITH_PERF_TOOL)
|
|
|
|
foreach (perf-tool ${perf-tools})
|
|
|
|
add_executable (${perf-tool} perf/${perf-tool}.cpp)
|
2017-04-24 15:57:14 +02:00
|
|
|
target_link_libraries (${perf-tool} libzmq ${OPTIONAL_LIBRARIES})
|
2017-04-18 00:26:04 +02:00
|
|
|
|
|
|
|
if (RT_LIBRARY)
|
|
|
|
target_link_libraries (${perf-tool} ${RT_LIBRARY})
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (ZMQ_BUILD_FRAMEWORK)
|
|
|
|
# Copy perf-tools binaries into Framework
|
|
|
|
add_custom_command (
|
2017-04-24 15:57:14 +02:00
|
|
|
TARGET libzmq ${perf-tool}
|
2017-04-18 00:26:04 +02:00
|
|
|
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 ()
|
|
|
|
elseif (WITH_PERF_TOOL)
|
|
|
|
message(FATAL_ERROR "Shared library disabled - perf-tools unavailable.")
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2014-02-07 17:50:45 +01:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# tests
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
set (ZMQ_BUILD_TESTS ON CACHE BOOL "Build the tests for ZeroMQ")
|
2014-02-07 17:50:45 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (ZMQ_BUILD_TESTS)
|
|
|
|
enable_testing () # Enable testing only works in root scope
|
|
|
|
ADD_SUBDIRECTORY (tests)
|
|
|
|
endif ()
|
2013-12-06 23:28:44 +01:00
|
|
|
|
2012-11-09 14:48:59 +01:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# installer
|
2012-10-11 12:31:30 +02:00
|
|
|
|
2017-01-06 22:41:29 +01:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (MSVC)
|
2017-04-18 00:26:04 +02:00
|
|
|
install (TARGETS ${target_outputs}
|
2017-04-04 10:34:28 +02:00
|
|
|
EXPORT ${PROJECT_NAME}-targets
|
2017-01-06 22:41:29 +01:00
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
2015-02-12 20:29:09 +01:00
|
|
|
COMPONENT SDK)
|
2016-02-11 13:32:01 +01:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2017-04-18 00:26:04 +02:00
|
|
|
install (TARGETS ${target_outputs}
|
2017-01-06 22:41:29 +01:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
2012-12-31 23:52:32 +01:00
|
|
|
COMPONENT SDK)
|
2016-02-11 13:32:01 +01:00
|
|
|
if (NOT CMAKE_PDB_OUTPUT_DIRECTORY)
|
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/libzmq${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}.pdb DESTINATION lib
|
2015-02-12 20:29:09 +01:00
|
|
|
COMPONENT SDK)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2017-04-18 00:26:04 +02:00
|
|
|
elseif (BUILD_SHARED)
|
2017-04-24 15:57:14 +02:00
|
|
|
install (TARGETS libzmq
|
2017-01-06 22:41:29 +01:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
2015-02-12 20:29:09 +01:00
|
|
|
COMPONENT Runtime)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
|
|
|
else ()
|
2017-04-18 00:26:04 +02:00
|
|
|
install (TARGETS ${target_outputs}
|
2017-04-04 10:34:28 +02:00
|
|
|
EXPORT ${PROJECT_NAME}-targets
|
2017-01-06 22:41:29 +01:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2015-02-12 20:29:09 +01:00
|
|
|
FRAMEWORK DESTINATION "Library/Frameworks"
|
2017-01-06 22:41:29 +01:00
|
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
# install (FILES ${public_headers}
|
2015-02-12 20:29:09 +01:00
|
|
|
# DESTINATION include
|
|
|
|
# COMPONENT SDK)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
#if (NOT ZMQ_BUILD_FRAMEWORK)
|
|
|
|
# file (GLOB private_headers "${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp")
|
|
|
|
# install (FILES ${sources} ${private_headers} DESTINATION src/zmq
|
2015-03-11 09:50:39 +01:00
|
|
|
# COMPONENT SourceCode)
|
2016-02-11 13:32:01 +01:00
|
|
|
#endif ()
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
foreach (readme ${readme-docs})
|
|
|
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/${readme} ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt)
|
2012-12-31 23:52:32 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (NOT ZMQ_BUILD_FRAMEWORK)
|
2017-01-06 14:29:56 +01:00
|
|
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${readme}.txt DESTINATION share/zmq)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
|
|
|
endforeach ()
|
2012-10-11 12:31:30 +02:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (WITH_DOC)
|
|
|
|
if (NOT ZMQ_BUILD_FRAMEWORK)
|
|
|
|
install (FILES ${html-docs} DESTINATION doc/zmq COMPONENT RefGuide)
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2015-02-12 20:29:09 +01:00
|
|
|
|
2017-01-06 22:41:29 +01:00
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
|
2017-12-06 21:41:55 +01:00
|
|
|
if (WIN32)
|
|
|
|
set(ZEROMQ_CMAKECONFIG_INSTALL_DIR "CMake" CACHE STRING "install path for ZeroMQConfig.cmake")
|
|
|
|
else()
|
|
|
|
# GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share".
|
|
|
|
set(ZEROMQ_CMAKECONFIG_INSTALL_DIR "share/cmake/${PROJECT_NAME}" CACHE STRING "install path for ZeroMQConfig.cmake")
|
|
|
|
endif()
|
2017-01-06 22:41:29 +01:00
|
|
|
|
2017-04-04 10:34:28 +02:00
|
|
|
if (NOT CMAKE_VERSION VERSION_LESS 3.0)
|
|
|
|
export(EXPORT ${PROJECT_NAME}-targets
|
|
|
|
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
|
|
|
|
endif()
|
2017-01-06 22:41:29 +01:00
|
|
|
configure_package_config_file(${PROJECT_NAME}Config.cmake.in
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
|
|
|
INSTALL_DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
|
|
|
|
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
|
|
|
VERSION ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}
|
|
|
|
COMPATIBILITY AnyNewerVersion)
|
2017-04-04 10:34:28 +02:00
|
|
|
install(EXPORT ${PROJECT_NAME}-targets
|
|
|
|
FILE ${PROJECT_NAME}Targets.cmake
|
|
|
|
DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
|
2017-01-06 22:41:29 +01:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
|
|
|
DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
|
|
|
|
|
2017-01-06 14:29:56 +01:00
|
|
|
option(ENABLE_CPACK "Enables cpack rules" ON)
|
|
|
|
if (MSVC AND ENABLE_CPACK)
|
2016-02-11 13:32:01 +01:00
|
|
|
include (InstallRequiredSystemLibraries)
|
2015-02-12 20:29:09 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
if (CMAKE_CL_64)
|
|
|
|
set (arch_name "x64")
|
|
|
|
else ()
|
|
|
|
set (arch_name "x86")
|
|
|
|
endif ()
|
2015-02-12 20:29:09 +01:00
|
|
|
|
2016-02-11 13:32:01 +01:00
|
|
|
set (CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH} (${arch_name})")
|
|
|
|
set (CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-${arch_name}")
|
2015-02-12 20:29:09 +01:00
|
|
|
|
|
|
|
# TODO: I think this part was intended to be used when running cpack
|
|
|
|
# separately from cmake but I don't know how that works.
|
|
|
|
#
|
2016-02-11 13:32:01 +01:00
|
|
|
# macro (add_crt_version version)
|
|
|
|
# set (rel_dir "${CMAKE_CURRENT_BINARY_DIR}/build/${arch_name}/${version};ZeroMQ;ALL;/")
|
|
|
|
# set (debug_dir "${CMAKE_CURRENT_BINARY_DIR}/debug/${arch_name}/${version};ZeroMQ;ALL;/")
|
|
|
|
# if (EXISTS ${rel_dir})
|
|
|
|
# list (APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir})
|
|
|
|
# endif ()
|
|
|
|
|
|
|
|
# if (EXISTS ${debug_dir})
|
|
|
|
# list (APPEND CPACK_INSTALL_CMAKE_PROJECTS ${rel_dir})
|
|
|
|
# endmacro ()
|
|
|
|
# endmacro ()
|
|
|
|
|
|
|
|
# add_crt_version (v110)
|
|
|
|
# add_crt_version (v100)
|
|
|
|
# add_crt_version (v90)
|
|
|
|
|
|
|
|
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_VENDOR "Miru")
|
|
|
|
set (CPACK_NSIS_CONTACT "Steven McCoy <Steven.McCoy@miru.hk>")
|
|
|
|
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}\\\\COPYING.txt")
|
|
|
|
# set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_BINARY_DIR}\\\\README.txt")
|
|
|
|
# set (CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_BINARY_DIR}\\\\WELCOME.txt")
|
2015-02-12 20:29:09 +01:00
|
|
|
# There is a bug in NSI that does not handle full unix paths properly. Make
|
2016-02-11 13:32:01 +01:00
|
|
|
# sure there is at least one set of four (4) backslashes.
|
|
|
|
set (CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico")
|
|
|
|
set (CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\installer.ico")
|
|
|
|
|
|
|
|
set (CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\branding.bmp")
|
|
|
|
set (CPACK_NSIS_COMPRESSOR "/SOLID lzma")
|
|
|
|
set (CPACK_PACKAGE_VERSION ${ZMQ_VERSION})
|
|
|
|
set (CPACK_PACKAGE_VERSION_MAJOR ${ZMQ_VERSION_MAJOR})
|
|
|
|
set (CPACK_PACKAGE_VERSION_MINOR ${ZMQ_VERSION_MINOR})
|
|
|
|
set (CPACK_PACKAGE_VERSION_PATCH ${ZMQ_VERSION_PATCH})
|
|
|
|
# set (CPACK_PACKAGE_INSTALL_DIRECTORY "ZMQ Install Directory")
|
|
|
|
# set (CPACK_TEMPORARY_DIRECTORY "ZMQ Temporary CPack Directory")
|
|
|
|
|
|
|
|
include (CPack)
|
|
|
|
|
|
|
|
cpack_add_component_group (Development
|
2015-02-12 20:29:09 +01:00
|
|
|
DISPLAY_NAME "ZeroMQ software development kit"
|
|
|
|
EXPANDED)
|
2016-02-11 13:32:01 +01:00
|
|
|
cpack_add_component (PerfTools
|
2015-02-12 20:29:09 +01:00
|
|
|
DISPLAY_NAME "ZeroMQ performance tools"
|
|
|
|
INSTALL_TYPES FullInstall DevInstall)
|
2016-02-11 13:32:01 +01:00
|
|
|
cpack_add_component (SourceCode
|
2015-02-12 20:29:09 +01:00
|
|
|
DISPLAY_NAME "ZeroMQ source code"
|
|
|
|
DISABLED
|
|
|
|
INSTALL_TYPES FullInstall)
|
2016-02-11 13:32:01 +01:00
|
|
|
cpack_add_component (SDK
|
2015-02-12 20:29:09 +01:00
|
|
|
DISPLAY_NAME "ZeroMQ headers and libraries"
|
|
|
|
INSTALL_TYPES FullInstall DevInstall
|
|
|
|
GROUP Development)
|
2016-02-11 13:32:01 +01:00
|
|
|
if (WITH_DOC)
|
|
|
|
cpack_add_component (RefGuide
|
2015-02-12 20:29:09 +01:00
|
|
|
DISPLAY_NAME "ZeroMQ reference guide"
|
|
|
|
INSTALL_TYPES FullInstall DevInstall
|
|
|
|
GROUP Development)
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
|
|
|
cpack_add_component (Runtime
|
2015-02-12 20:29:09 +01:00
|
|
|
DISPLAY_NAME "ZeroMQ runtime files"
|
|
|
|
REQUIRED
|
|
|
|
INSTALL_TYPES FullInstall DevInstall MinInstall)
|
2016-02-11 13:32:01 +01:00
|
|
|
cpack_add_install_type (FullInstall
|
2015-02-12 20:29:09 +01:00
|
|
|
DISPLAY_NAME "Full install, including source code")
|
2016-02-11 13:32:01 +01:00
|
|
|
cpack_add_install_type (DevInstall
|
2015-02-12 20:29:09 +01:00
|
|
|
DISPLAY_NAME "Developer install, headers and libraries")
|
2016-02-11 13:32:01 +01:00
|
|
|
cpack_add_install_type (MinInstall
|
2015-02-12 20:29:09 +01:00
|
|
|
DISPLAY_NAME "Minimal install, runtime only")
|
2016-02-11 13:32:01 +01:00
|
|
|
endif ()
|
2015-02-12 20:29:09 +01:00
|
|
|
|
|
|
|
# Export this for library to help build this as a sub-project
|
2016-02-11 13:32:01 +01:00
|
|
|
set (ZEROMQ_LIBRARY libzmq CACHE STRING "ZeroMQ library")
|
2015-02-12 20:29:09 +01:00
|
|
|
|
|
|
|
# Workaround for MSVS10 to avoid the Dialog Hell
|
|
|
|
# FIXME: This could be removed with future version of CMake.
|
2016-02-11 13:32:01 +01:00
|
|
|
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 ()
|