mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 18:40:27 +01:00
First pass at getting cmake build to work with non-Windows systems.
Make doc building option dependent on asciidoc being installed Fix MSVC build requiring cygwin. Don't use try_run to get the version
This commit is contained in:
parent
73c370dd17
commit
0362c310a5
913
CMakeLists.txt
913
CMakeLists.txt
@ -1,49 +1,236 @@
|
|||||||
# CMake build script for ZeroMQ on Windows
|
# CMake build script for ZeroMQ
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
project (ZeroMQ)
|
project(ZeroMQ)
|
||||||
|
|
||||||
include (${CMAKE_SOURCE_DIR}/cmake/Modules/TestZMQVersion.cmake)
|
option(WITH_OPENPGM "Build with support for OpenPGM" OFF)
|
||||||
|
|
||||||
option (WITH_DOC "Build Reference Guide documentation (requires DocBook)" OFF)
|
if(APPLE)
|
||||||
option (WITH_OPENPGM "Build with support for OpenPGM" OFF)
|
option(ZMQ_BUILD_FRAMEWORK "Build as OS X framework" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
# WARNING: Windows Python will override Cygwin yet not work with Asciidoc.
|
|
||||||
#find_package (PythonInterp REQUIRED)
|
|
||||||
# Workaround, manually set Python location
|
|
||||||
set(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")
|
|
||||||
|
|
||||||
if (WITH_OPENPGM)
|
set(POLLER "" CACHE STRING "Choose polling system manually. valid values are
|
||||||
# set(OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM")
|
kqueue, epoll, devpoll, poll or select [default=autodetect]")
|
||||||
set(OPENPGM_VERSION_MAJOR 5)
|
|
||||||
set(OPENPGM_VERSION_MINOR 2)
|
if( NOT POLLER STREQUAL ""
|
||||||
set(OPENPGM_VERSION_MICRO 122)
|
AND NOT POLLER STREQUAL "kqueue"
|
||||||
if (CMAKE_CL_64)
|
AND NOT POLLER STREQUAL "epoll"
|
||||||
find_path(OPENPGM_ROOT include/pgm/pgm.h
|
AND NOT POLLER STREQUAL "devpoll"
|
||||||
PATHS
|
AND NOT POLLER STREQUAL "poll"
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
|
AND NOT POLLER STREQUAL "select")
|
||||||
NO_DEFAULT_PATH
|
message(FATAL_ERROR "Invalid polling method")
|
||||||
)
|
endif()
|
||||||
message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
|
|
||||||
else (CMAKE_CL_64)
|
if(NOT ${POLLER} STREQUAL "")
|
||||||
find_path(OPENPGM_ROOT include/pgm/pgm.h
|
string(TOUPPER ${POLLER} UPPER_POLLER)
|
||||||
PATHS
|
set(ZMQ_FORCE_${UPPER_POLLER} 1)
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
|
endif()
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
|
|
||||||
NO_DEFAULT_PATH
|
set(ZMQ_CMAKE_MODULES_DIR ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
||||||
)
|
list(APPEND CMAKE_MODULE_PATH ${ZMQ_CMAKE_MODULES_DIR})
|
||||||
message(STATUS "OpenPGM x86 detected - ${OPENPGM_ROOT}")
|
|
||||||
endif (CMAKE_CL_64)
|
include(TestZMQVersion)
|
||||||
set(OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include)
|
include(ZMQSourceRunChecks)
|
||||||
set(OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib)
|
include(CheckIncludeFiles)
|
||||||
set(OPENPGM_LIBRARIES
|
include(CheckLibraryExists)
|
||||||
optimized libpgm${_zmq_COMPILER}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib
|
include(CheckFunctionExists)
|
||||||
debug libpgm${_zmq_COMPILER}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
|
include(CheckCCompilerFlag)
|
||||||
endif (WITH_OPENPGM)
|
include(CheckCXXCompilerFlag)
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
include(CheckCSourceRuns)
|
||||||
|
include(AutoconfHelper)
|
||||||
|
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 WSAStartup "" HAVE_WS2_32)
|
||||||
|
check_library_exists(rpcrt4 UuidCreateSequential "" HAVE_RPCRT4)
|
||||||
|
check_library_exists(iphlpapi GetAdaptersAddresses "" HAVE_IPHLAPI)
|
||||||
|
find_package(Threads)
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
if(NOT HAVE_WS2_32)
|
||||||
|
message(FATAL_ERROR "Cannot link to ws2_32")
|
||||||
|
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") # GCC
|
||||||
|
zmq_check_cxx_flag_prepend("-strict-ansi") # ICC
|
||||||
|
zmq_check_cxx_flag_prepend("-compat=5") # Sun Studio
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(LIBZMQ_WERROR)
|
||||||
|
zmq_check_cxx_flag_prepend("-Werror")
|
||||||
|
zmq_check_cxx_flag_prepend("-errwarn=%all")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(${CMAKE_C_COMPILER_ID} STREQUAL "Intel")
|
||||||
|
# 279: controlling expression is constant
|
||||||
|
# Fixes build with ICC 12.x
|
||||||
|
zmq_check_cxx_flag_prepend("-wd279")
|
||||||
|
ac_type_size_t()
|
||||||
|
ac_type_ssize_t()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
|
||||||
|
zmq_check_cxx_flag_prepend("-mcpu=v9")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "SunOS" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
||||||
|
message(STATUS "Checking whether atomic operations can be used")
|
||||||
|
check_c_source_compiles(
|
||||||
|
"
|
||||||
|
#include <atomic.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
uint32_t value;
|
||||||
|
atomic_cas_32(&value, 0, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
HAVE_ATOMIC_H)
|
||||||
|
|
||||||
|
if(NOT HAVE_ATOMIC_H)
|
||||||
|
set(ZMQ_FORCE_MUTEXES 1)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
zmq_check_sock_cloexec()
|
||||||
|
zmq_check_so_keepalive()
|
||||||
|
zmq_check_tcp_keepcnt()
|
||||||
|
zmq_check_tcp_keepidle()
|
||||||
|
zmq_check_tcp_keepintvl()
|
||||||
|
zmq_check_tcp_keepalive()
|
||||||
|
|
||||||
|
|
||||||
|
if( CMAKE_SYSTEM_NAME MATCHES "Linux"
|
||||||
|
OR CMAKE_SYSTEM_NAME MATCHES "GNU/kFreeBSD"
|
||||||
|
OR CMAKE_SYSTEM_NAME MATCHES "GNU/Hurd"
|
||||||
|
OR CYGWIN)
|
||||||
|
add_definitions(-D_GNU_SOURCE)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||||
|
add_definitions(-D__BSD_VISIBLE)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
||||||
|
add_definitions(-D_NETBSD_SOURCE)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
||||||
|
add_definitions(-D_OPENBSD_SOURCE)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||||
|
add_definitions(-D_PTHREADS)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
|
||||||
|
add_definitions(-D_POSIX_C_SOURCE=200112L)
|
||||||
|
zmq_check_cxx_flag_prepend(-Ae)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
add_definitions(-D_DARWIN_C_SOURCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_PYTHON_VERSION 2.7 2.6 2.5 2.4)
|
||||||
|
find_package(PythonInterp)
|
||||||
|
find_package(AsciiDoc)
|
||||||
|
|
||||||
|
cmake_dependent_option(WITH_DOC "Build Reference Guide documentation(requires DocBook)" ON
|
||||||
|
"PYTHON_FOUND;ASCIIDOC_FOUND" OFF)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
if(WITH_OPENPGM)
|
||||||
|
# set(OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM")
|
||||||
|
set(OPENPGM_VERSION_MAJOR 5)
|
||||||
|
set(OPENPGM_VERSION_MINOR 2)
|
||||||
|
set(OPENPGM_VERSION_MICRO 122)
|
||||||
|
if(CMAKE_CL_64)
|
||||||
|
find_path(OPENPGM_ROOT include/pgm/pgm.h
|
||||||
|
PATHS
|
||||||
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
message(STATUS "OpenPGM x64 detected - ${OPENPGM_ROOT}")
|
||||||
|
else()
|
||||||
|
find_path(OPENPGM_ROOT include/pgm/pgm.h
|
||||||
|
PATHS
|
||||||
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
|
||||||
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
message(STATUS "OpenPGM x86 detected - ${OPENPGM_ROOT}")
|
||||||
|
endif(CMAKE_CL_64)
|
||||||
|
set(OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include)
|
||||||
|
set(OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib)
|
||||||
|
set(OPENPGM_LIBRARIES
|
||||||
|
optimized libpgm${_zmq_COMPILER}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib
|
||||||
|
debug libpgm${_zmq_COMPILER}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(WITH_OPENPGM)
|
||||||
|
message(FATAL_ERROR "WITH_OPENPGM not implemented")
|
||||||
|
# DSO symbol visibility for openpgm
|
||||||
|
check_c_compiler_flag("-fvisibility=hidden" HAVE_FLAG_VISIBILITY_HIDDEN)
|
||||||
|
check_c_compiler_flag("-xldscope=hidden" HAVE_FLAG_LDSCOPE_HIDDEN)
|
||||||
|
|
||||||
|
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
|
||||||
@ -52,12 +239,12 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_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,7 +253,7 @@ 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_BINARY_DIR}/bin)
|
||||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
||||||
@ -74,322 +261,430 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# platform specifics
|
# platform specifics
|
||||||
|
|
||||||
add_definitions(
|
if(MSVC)
|
||||||
-DWIN32
|
add_definitions(
|
||||||
-DDLL_EXPORT
|
-DWIN32
|
||||||
# NB: May require tweaking for highly connected applications.
|
-DDLL_EXPORT
|
||||||
-DFD_SETSIZE=1024
|
# NB: May require tweaking for highly connected applications.
|
||||||
-D_CRT_SECURE_NO_WARNINGS
|
-DFD_SETSIZE=1024
|
||||||
)
|
-D_CRT_SECURE_NO_WARNINGS
|
||||||
|
)
|
||||||
|
|
||||||
# Parallel make.
|
# Parallel make.
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||||
|
|
||||||
|
# Optimization flags.
|
||||||
|
# http://msdn.microsoft.com/en-us/magazine/cc301698.aspx
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
|
||||||
|
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Optimization flags.
|
|
||||||
# http://msdn.microsoft.com/en-us/magazine/cc301698.aspx
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
|
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# source files
|
# source files
|
||||||
|
|
||||||
set(cxx-sources
|
set(cxx-sources
|
||||||
address.cpp
|
address.cpp
|
||||||
clock.cpp
|
clock.cpp
|
||||||
ctx.cpp
|
ctx.cpp
|
||||||
dealer.cpp
|
dealer.cpp
|
||||||
decoder.cpp
|
decoder.cpp
|
||||||
devpoll.cpp
|
devpoll.cpp
|
||||||
dist.cpp
|
dist.cpp
|
||||||
encoder.cpp
|
encoder.cpp
|
||||||
epoll.cpp
|
epoll.cpp
|
||||||
err.cpp
|
err.cpp
|
||||||
fq.cpp
|
fq.cpp
|
||||||
io_object.cpp
|
io_object.cpp
|
||||||
io_thread.cpp
|
io_thread.cpp
|
||||||
ip.cpp
|
ip.cpp
|
||||||
ipc_address.cpp
|
ipc_address.cpp
|
||||||
ipc_connecter.cpp
|
ipc_connecter.cpp
|
||||||
ipc_listener.cpp
|
ipc_listener.cpp
|
||||||
kqueue.cpp
|
kqueue.cpp
|
||||||
lb.cpp
|
lb.cpp
|
||||||
mailbox.cpp
|
mailbox.cpp
|
||||||
msg.cpp
|
msg.cpp
|
||||||
mtrie.cpp
|
mtrie.cpp
|
||||||
object.cpp
|
object.cpp
|
||||||
options.cpp
|
options.cpp
|
||||||
own.cpp
|
own.cpp
|
||||||
pair.cpp
|
pair.cpp
|
||||||
pgm_receiver.cpp
|
pgm_receiver.cpp
|
||||||
pgm_sender.cpp
|
pgm_sender.cpp
|
||||||
pgm_socket.cpp
|
pgm_socket.cpp
|
||||||
pipe.cpp
|
pipe.cpp
|
||||||
poll.cpp
|
poll.cpp
|
||||||
poller_base.cpp
|
poller_base.cpp
|
||||||
precompiled.cpp
|
precompiled.cpp
|
||||||
proxy.cpp
|
proxy.cpp
|
||||||
pub.cpp
|
pub.cpp
|
||||||
pull.cpp
|
pull.cpp
|
||||||
push.cpp
|
push.cpp
|
||||||
random.cpp
|
random.cpp
|
||||||
raw_encoder.cpp
|
raw_encoder.cpp
|
||||||
raw_decoder.cpp
|
raw_decoder.cpp
|
||||||
reaper.cpp
|
reaper.cpp
|
||||||
rep.cpp
|
rep.cpp
|
||||||
req.cpp
|
req.cpp
|
||||||
router.cpp
|
router.cpp
|
||||||
select.cpp
|
select.cpp
|
||||||
session_base.cpp
|
session_base.cpp
|
||||||
signaler.cpp
|
signaler.cpp
|
||||||
socket_base.cpp
|
socket_base.cpp
|
||||||
stream_engine.cpp
|
stream_engine.cpp
|
||||||
sub.cpp
|
sub.cpp
|
||||||
tcp.cpp
|
tcp.cpp
|
||||||
tcp_address.cpp
|
tcp_address.cpp
|
||||||
tcp_connecter.cpp
|
tcp_connecter.cpp
|
||||||
tcp_listener.cpp
|
tcp_listener.cpp
|
||||||
thread.cpp
|
thread.cpp
|
||||||
trie.cpp
|
trie.cpp
|
||||||
v1_decoder.cpp
|
v1_decoder.cpp
|
||||||
v1_encoder.cpp
|
v1_encoder.cpp
|
||||||
xpub.cpp
|
xpub.cpp
|
||||||
xsub.cpp
|
xsub.cpp
|
||||||
zmq.cpp
|
zmq.cpp
|
||||||
zmq_utils.cpp
|
zmq_utils.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(rc-sources
|
set(rc-sources
|
||||||
version.rc
|
version.rc
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
include
|
include
|
||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
)
|
)
|
||||||
set(headers
|
set(public_headers
|
||||||
include/zmq.h
|
include/zmq.h
|
||||||
include/zmq_utils.h
|
include/zmq_utils.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(readme-docs
|
set(readme-docs
|
||||||
AUTHORS
|
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(
|
include_directories(
|
||||||
${OPENPGM_INCLUDE_DIRS}
|
${OPENPGM_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
link_directories(
|
link_directories(
|
||||||
${OPENPGM_LIBRARY_DIRS}
|
${OPENPGM_LIBRARY_DIRS}
|
||||||
)
|
)
|
||||||
set(OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES})
|
set(OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES})
|
||||||
endif(WITH_OPENPGM)
|
endif(WITH_OPENPGM)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# source generators
|
# source generators
|
||||||
|
|
||||||
foreach (source ${cxx-sources})
|
foreach(source ${cxx-sources})
|
||||||
list(APPEND sources ${CMAKE_SOURCE_DIR}/src/${source})
|
list(APPEND sources ${CMAKE_SOURCE_DIR}/src/${source})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach (source ${rc-sources})
|
foreach(source ${rc-sources})
|
||||||
list(APPEND sources ${CMAKE_BINARY_DIR}/${source})
|
list(APPEND sources ${CMAKE_BINARY_DIR}/${source})
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/src/${source}.in ${CMAKE_BINARY_DIR}/${source})
|
configure_file(${CMAKE_SOURCE_DIR}/src/${source}.in ${CMAKE_BINARY_DIR}/${source})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_custom_command(
|
configure_file(${CMAKE_SOURCE_DIR}/builds/cmake/platform.hpp.in ${CMAKE_BINARY_DIR}/platform.hpp)
|
||||||
OUTPUT ${CMAKE_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)
|
list(APPEND sources ${CMAKE_BINARY_DIR}/platform.hpp)
|
||||||
|
|
||||||
if (CMAKE_CL_64)
|
configure_file(${CMAKE_SOURCE_DIR}/src/libzmq.pc.cmake.in ${CMAKE_BINARY_DIR}/libzmq.pc)
|
||||||
set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template64.in)
|
set(zmq-pkgconfig ${CMAKE_BINARY_DIR}/libzmq.pc)
|
||||||
else (CMAKE_CL_64)
|
|
||||||
set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template32.in)
|
if(NOT ZMQ_BUILD_FRAMEWORK)
|
||||||
endif (CMAKE_CL_64)
|
install(FILES ${CMAKE_BINARY_DIR}/libzmq.pc DESTINATION lib/pkgconfig)
|
||||||
add_custom_command(
|
endif()
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/NSIS.template.in
|
|
||||||
COMMAND ${CMAKE_COMMAND}
|
|
||||||
ARGS -E
|
|
||||||
copy
|
if(MSVC)
|
||||||
${nsis-template}
|
if(CMAKE_CL_64)
|
||||||
${CMAKE_BINARY_DIR}/NSIS.template.in
|
set(nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template64.in)
|
||||||
DEPENDS ${nsis-template}
|
else()
|
||||||
)
|
set(nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template32.in)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${CMAKE_BINARY_DIR}/NSIS.template.in
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
ARGS -E
|
||||||
|
copy
|
||||||
|
${nsis-template}
|
||||||
|
${CMAKE_BINARY_DIR}/NSIS.template.in
|
||||||
|
DEPENDS ${nsis-template})
|
||||||
|
endif()
|
||||||
|
|
||||||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc)
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc)
|
||||||
file(GLOB docs RELATIVE ${CMAKE_BINARY_DIR}/ "${CMAKE_SOURCE_DIR}/doc/*.txt")
|
file(GLOB docs RELATIVE ${CMAKE_BINARY_DIR}/ "${CMAKE_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})
|
||||||
set (src ${txt})
|
set(src ${txt})
|
||||||
set (dst doc/${html})
|
set(dst doc/${html})
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${dst}
|
OUTPUT ${dst}
|
||||||
COMMAND ${PYTHON_EXECUTABLE}
|
COMMAND ${PYTHON_EXECUTABLE}
|
||||||
ARGS -x
|
ARGS -x
|
||||||
${ASCIIDOC_EXECUTABLE}
|
${ASCIIDOC_EXECUTABLE}
|
||||||
-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}
|
||||||
-o ${dst}
|
-o ${dst}
|
||||||
${src}
|
${src}
|
||||||
DEPENDS ${CMAKE_BINARY_DIR}/${src}
|
DEPENDS ${CMAKE_BINARY_DIR}/${src}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_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_BINARY_DIR}/${dst})
|
endif()
|
||||||
endif (WITH_DOC)
|
endforeach()
|
||||||
endforeach (txt ${docs})
|
|
||||||
|
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_BINARY_DIR}/NSIS.template.in)
|
||||||
set_target_properties(libzmq PROPERTIES
|
target_link_libraries(libzmq ws2_32.lib rpcrt4.lib ${OPTIONAL_LIBRARIES})
|
||||||
RELEASE_POSTFIX "${_zmq_COMPILER}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
set_target_properties(libzmq PROPERTIES
|
||||||
DEBUG_POSTFIX "${_zmq_COMPILER}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}")
|
PUBLIC_HEADER "${public_headers}"
|
||||||
|
RELEASE_POSTFIX "${_zmq_COMPILER}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
||||||
|
DEBUG_POSTFIX "${_zmq_COMPILER}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}")
|
||||||
|
else()
|
||||||
|
add_library(libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig})
|
||||||
|
if(ZMQ_BUILD_FRAMEWORK)
|
||||||
|
set_target_properties(libzmq PROPERTIES
|
||||||
|
FRAMEWORK TRUE
|
||||||
|
OUTPUT_NAME "ZeroMQ"
|
||||||
|
PUBLIC_HEADER "${public_headers}"
|
||||||
|
MACOSX_FRAMEWORK_IDENTIFIER "org.zeromq.libzmq"
|
||||||
|
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${ZMQ_VERSION}
|
||||||
|
MACOSX_FRAMEWORK_BUNDLE_VERSION ${ZMQ_VERSION}
|
||||||
|
VERSION ${ZMQ_VERSION}
|
||||||
|
SOVERSION "${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.0")
|
||||||
|
set_source_files_properties(${html-docs} PROPERTIES
|
||||||
|
MACOSX_PACKAGE_LOCATION doc)
|
||||||
|
set_source_files_properties(${readme-docs} PROPERTIES
|
||||||
|
MACOSX_PACKAGE_LOCATION etc)
|
||||||
|
set_source_files_properties(${zmq-pkgconfig} PROPERTIES
|
||||||
|
MACOSX_PACKAGE_LOCATION lib/pkgconfig)
|
||||||
|
else()
|
||||||
|
set_target_properties(libzmq PROPERTIES
|
||||||
|
OUTPUT_NAME "zmq"
|
||||||
|
PUBLIC_HEADER "${public_headers}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
if(HAVE_WS2_32)
|
||||||
|
target_link_libraries(libzmq ws2_32)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_RPCRT4)
|
||||||
|
target_link_libraries(libzmq rpcrt4)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_IPHLAPI)
|
||||||
|
target_link_libraries(libzmq iphlpapi)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(perf-tools local_lat
|
||||||
|
remote_lat
|
||||||
|
local_thr
|
||||||
|
remote_thr
|
||||||
|
inproc_lat
|
||||||
|
inproc_thr)
|
||||||
|
|
||||||
|
#get_target_property
|
||||||
|
|
||||||
|
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # Why?
|
||||||
|
foreach(perf-tool ${perf-tools})
|
||||||
|
add_executable(${perf-tool} perf/${perf-tool}.cpp)
|
||||||
|
target_link_libraries(${perf-tool} libzmq)
|
||||||
|
|
||||||
|
if(ZMQ_BUILD_FRAMEWORK)
|
||||||
|
# Copy perf-tools binaries into Framework
|
||||||
|
add_custom_command(
|
||||||
|
TARGET libzmq ${perf-tool}
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
ARGS -E copy "$<TARGET_FILE:${perf-tool}>" "${LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION_STRING}/MacOS/${perf-tool}"
|
||||||
|
VERBATIM
|
||||||
|
COMMENT "Perf tools")
|
||||||
|
else()
|
||||||
|
install(TARGETS ${perf-tool}
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
COMPONENT PerfTools)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# installer
|
# installer
|
||||||
|
|
||||||
install (TARGETS libzmq ARCHIVE DESTINATION lib COMPONENT SDK)
|
if(MSVC)
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
install(TARGETS libzmq
|
||||||
install (TARGETS libzmq RUNTIME DESTINATION bin COMPONENT SDK)
|
ARCHIVE DESTINATION lib
|
||||||
install (FILES ${CMAKE_BINARY_DIR}/lib/libzmq${_zmq_COMPILER}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}.pdb DESTINATION lib COMPONENT SDK)
|
LIBRARY DESTINATION lib
|
||||||
else (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
PUBLIC_HEADER DESTINATION include
|
||||||
install (TARGETS libzmq RUNTIME DESTINATION bin COMPONENT Runtime)
|
COMPONENT SDK)
|
||||||
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
install (FILES ${headers} DESTINATION include COMPONENT SDK)
|
install(TARGETS libzmq
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
PUBLIC_HEADER DESTINATION include
|
||||||
|
COMPONENT SDK)
|
||||||
|
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()
|
||||||
|
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()
|
||||||
|
|
||||||
set (perf-tools
|
# install(FILES ${public_headers}
|
||||||
local_lat
|
# DESTINATION include
|
||||||
remote_lat
|
# COMPONENT SDK)
|
||||||
local_thr
|
|
||||||
remote_thr
|
|
||||||
inproc_lat
|
|
||||||
inproc_thr
|
|
||||||
)
|
|
||||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
foreach (perf-tool ${perf-tools})
|
|
||||||
add_executable (${perf-tool} perf/${perf-tool}.cpp)
|
|
||||||
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(NOT ZMQ_BUILD_FRAMEWORK)
|
||||||
install (FILES ${sources} ${headers} DESTINATION src COMPONENT SourceCode)
|
file(GLOB private_headers "${CMAKE_SOURCE_DIR}/src/*.hpp")
|
||||||
|
install(FILES ${sources} ${private_headers} DESTINATION src
|
||||||
|
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_SOURCE_DIR}/${readme} ${CMAKE_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)
|
|
||||||
|
|
||||||
include (InstallRequiredSystemLibraries)
|
if(NOT ZMQ_BUILD_FRAMEWORK)
|
||||||
|
install(FILES ${CMAKE_BINARY_DIR}/${readme}.txt DESTINATION etc/zmq)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
if (CMAKE_CL_64)
|
if(WITH_DOC)
|
||||||
set (CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH} (x64)")
|
if(NOT ZMQ_BUILD_FRAMEWORK)
|
||||||
set (CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-x64")
|
install(FILES ${html-docs} DESTINATION doc/zmq COMPONENT RefGuide)
|
||||||
set (CPACK_INSTALL_CMAKE_PROJECTS
|
endif()
|
||||||
"${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;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x64/v100;ZeroMQ;ALL;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/build/x64/v90;ZeroMQ;ALL;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x64/v90;ZeroMQ;ALL;/"
|
|
||||||
)
|
|
||||||
else (CMAKE_CL_64)
|
|
||||||
set (CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}")
|
|
||||||
set (CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-x86")
|
|
||||||
set (CPACK_INSTALL_CMAKE_PROJECTS
|
|
||||||
"${CMAKE_SOURCE_DIR}/build/x86/v110;ZeroMQ;ALL;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x86/v110;ZeroMQ;ALL;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/build/x86/v100;ZeroMQ;ALL;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x86/v100;ZeroMQ;ALL;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/build/x86/v90;ZeroMQ;ALL;/"
|
|
||||||
"${CMAKE_SOURCE_DIR}/debug/x86/v90;ZeroMQ;ALL;/"
|
|
||||||
)
|
|
||||||
endif (CMAKE_CL_64)
|
|
||||||
set (CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}")
|
|
||||||
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_BINARY_DIR}/COPYING.txt")
|
|
||||||
# There is a bug in NSI that does not handle full unix paths properly. Make
|
|
||||||
# sure there is at least one set of four (4) backlasshes.
|
|
||||||
set (CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}\\\\installer.ico")
|
|
||||||
set (CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}\\\\installer.ico")
|
|
||||||
set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\branding.bmp")
|
|
||||||
set (CPACK_NSIS_COMPRESSOR "/SOLID lzma")
|
|
||||||
set (CPACK_PACKAGE_VERSION_MAJOR "${ZMQ_VERSION_MAJOR}")
|
|
||||||
set (CPACK_PACKAGE_VERSION_MINOR "${ZMQ_VERSION_MINOR}")
|
|
||||||
set (CPACK_PACKAGE_VERSION_PATCH "${ZMQ_VERSION_PATCH}")
|
|
||||||
|
|
||||||
include (CPack)
|
|
||||||
|
|
||||||
cpack_add_component_group (Development
|
if(MSVC)
|
||||||
DISPLAY_NAME "ZeroMQ software development kit"
|
include(InstallRequiredSystemLibraries)
|
||||||
EXPANDED
|
|
||||||
)
|
|
||||||
cpack_add_component (PerfTools
|
|
||||||
DISPLAY_NAME "ZeroMQ performance tools"
|
|
||||||
INSTALL_TYPES FullInstall DevInstall
|
|
||||||
)
|
|
||||||
cpack_add_component (SourceCode
|
|
||||||
DISPLAY_NAME "ZeroMQ source code"
|
|
||||||
DISABLED
|
|
||||||
INSTALL_TYPES FullInstall
|
|
||||||
)
|
|
||||||
cpack_add_component (SDK
|
|
||||||
DISPLAY_NAME "ZeroMQ headers and libraries"
|
|
||||||
INSTALL_TYPES FullInstall DevInstall
|
|
||||||
GROUP Development
|
|
||||||
)
|
|
||||||
if (WITH_DOC)
|
|
||||||
cpack_add_component (RefGuide
|
|
||||||
DISPLAY_NAME "ZeroMQ reference guide"
|
|
||||||
INSTALL_TYPES FullInstall DevInstall
|
|
||||||
GROUP Development
|
|
||||||
)
|
|
||||||
endif (WITH_DOC)
|
|
||||||
cpack_add_component (Runtime
|
|
||||||
DISPLAY_NAME "ZeroMQ runtime files"
|
|
||||||
REQUIRED
|
|
||||||
INSTALL_TYPES FullInstall DevInstall MinInstall
|
|
||||||
)
|
|
||||||
cpack_add_install_type (FullInstall
|
|
||||||
DISPLAY_NAME "Full install, including source code"
|
|
||||||
)
|
|
||||||
cpack_add_install_type (DevInstall
|
|
||||||
DISPLAY_NAME "Developer install, headers and libraries"
|
|
||||||
)
|
|
||||||
cpack_add_install_type (MinInstall
|
|
||||||
DISPLAY_NAME "Minimal install, runtime only"
|
|
||||||
)
|
|
||||||
|
|
||||||
# end of file
|
if(CMAKE_CL_64)
|
||||||
|
set(CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}(x64)")
|
||||||
|
set(CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-x64")
|
||||||
|
set(CPACK_INSTALL_CMAKE_PROJECTS
|
||||||
|
"${CMAKE_SOURCE_DIR}/build/x64/v110;ZeroMQ;ALL;/"
|
||||||
|
"${CMAKE_SOURCE_DIR}/debug/x64/v110;ZeroMQ;ALL;/"
|
||||||
|
"${CMAKE_SOURCE_DIR}/build/x64/v100;ZeroMQ;ALL;/"
|
||||||
|
"${CMAKE_SOURCE_DIR}/debug/x64/v100;ZeroMQ;ALL;/"
|
||||||
|
"${CMAKE_SOURCE_DIR}/build/x64/v90;ZeroMQ;ALL;/"
|
||||||
|
"${CMAKE_SOURCE_DIR}/debug/x64/v90;ZeroMQ;ALL;/")
|
||||||
|
else()
|
||||||
|
set(CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}")
|
||||||
|
set(CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-x86")
|
||||||
|
set(CPACK_INSTALL_CMAKE_PROJECTS
|
||||||
|
"${CMAKE_SOURCE_DIR}/build/x86/v110;ZeroMQ;ALL;/"
|
||||||
|
"${CMAKE_SOURCE_DIR}/debug/x86/v110;ZeroMQ;ALL;/"
|
||||||
|
"${CMAKE_SOURCE_DIR}/build/x86/v100;ZeroMQ;ALL;/"
|
||||||
|
"${CMAKE_SOURCE_DIR}/debug/x86/v100;ZeroMQ;ALL;/"
|
||||||
|
"${CMAKE_SOURCE_DIR}/build/x86/v90;ZeroMQ;ALL;/"
|
||||||
|
"${CMAKE_SOURCE_DIR}/debug/x86/v90;ZeroMQ;ALL;/")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}")
|
||||||
|
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_BINARY_DIR}/COPYING.txt")
|
||||||
|
# There is a bug in NSI that does not handle full unix paths properly. Make
|
||||||
|
# sure there is at least one set of four(4) backslashes.
|
||||||
|
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}\\\\installer.ico")
|
||||||
|
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}\\\\installer.ico")
|
||||||
|
set(CPACK_PACKAGE_ICON "${CMAKE_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
|
||||||
|
DISPLAY_NAME "ZeroMQ software development kit"
|
||||||
|
EXPANDED)
|
||||||
|
cpack_add_component(PerfTools
|
||||||
|
DISPLAY_NAME "ZeroMQ performance tools"
|
||||||
|
INSTALL_TYPES FullInstall DevInstall)
|
||||||
|
cpack_add_component(SourceCode
|
||||||
|
DISPLAY_NAME "ZeroMQ source code"
|
||||||
|
DISABLED
|
||||||
|
INSTALL_TYPES FullInstall)
|
||||||
|
cpack_add_component(SDK
|
||||||
|
DISPLAY_NAME "ZeroMQ headers and libraries"
|
||||||
|
INSTALL_TYPES FullInstall DevInstall
|
||||||
|
GROUP Development)
|
||||||
|
if(WITH_DOC)
|
||||||
|
cpack_add_component(RefGuide
|
||||||
|
DISPLAY_NAME "ZeroMQ reference guide"
|
||||||
|
INSTALL_TYPES FullInstall DevInstall
|
||||||
|
GROUP Development)
|
||||||
|
endif(WITH_DOC)
|
||||||
|
cpack_add_component(Runtime
|
||||||
|
DISPLAY_NAME "ZeroMQ runtime files"
|
||||||
|
REQUIRED
|
||||||
|
INSTALL_TYPES FullInstall DevInstall MinInstall)
|
||||||
|
cpack_add_install_type(FullInstall
|
||||||
|
DISPLAY_NAME "Full install, including source code")
|
||||||
|
cpack_add_install_type(DevInstall
|
||||||
|
DISPLAY_NAME "Developer install, headers and libraries")
|
||||||
|
cpack_add_install_type(MinInstall
|
||||||
|
DISPLAY_NAME "Minimal install, runtime only")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Export this for library to help build this as a sub-project
|
||||||
|
set(ZEROMQ_LIBRARY libzmq CACHE STRING "ZeroMQ library")
|
||||||
|
|
||||||
|
# Workaround for MSVS10 to avoid the Dialog Hell
|
||||||
|
# FIXME: This could be removed with future version of CMake.
|
||||||
|
if(MSVC_VERSION EQUAL 1600)
|
||||||
|
set(ZMQ_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/ZeroMQ.sln")
|
||||||
|
if(EXISTS "${ZMQ_SLN_FILENAME}")
|
||||||
|
file(APPEND "${ZMQ_SLN_FILENAME}" "\n# This should be regenerated!\n")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
90
builds/cmake/platform.hpp.in
Normal file
90
builds/cmake/platform.hpp.in
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
#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
|
||||||
|
|
||||||
|
#cmakedefine size_t
|
||||||
|
#cmakedefine ssize_t
|
||||||
|
|
||||||
|
|
||||||
|
#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(__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
|
298
cmake/Modules/AutoconfHelper.cmake
Normal file
298
cmake/Modules/AutoconfHelper.cmake
Normal file
@ -0,0 +1,298 @@
|
|||||||
|
# Helper functions for translating autoconf projects. Several functions
|
||||||
|
# are lifted from the Mono sources
|
||||||
|
|
||||||
|
include (CheckCSourceCompiles)
|
||||||
|
include (CheckIncludeFile)
|
||||||
|
include (TestBigEndian)
|
||||||
|
include (CheckFunctionExists)
|
||||||
|
include (CheckTypeSize)
|
||||||
|
include (CheckCSourceRuns)
|
||||||
|
|
||||||
|
|
||||||
|
# Function to get the version information from the configure.ac file in the
|
||||||
|
# current directory. Its argument is the name of the library as passed to
|
||||||
|
# AC_INIT. It will set the variables ${LIBNAME}_VERSION and ${LIBNAME}_SOVERSION
|
||||||
|
function (ac_get_version libname)
|
||||||
|
string(TOUPPER "${libname}" libname_upper)
|
||||||
|
|
||||||
|
# Read the relevant content from configure.ac
|
||||||
|
file (STRINGS configure.ac tmp_configure_ac
|
||||||
|
REGEX "${libname_upper}_[_A-Z]+=[ \\t]*[0-9]+")
|
||||||
|
|
||||||
|
# Product version
|
||||||
|
string (REGEX REPLACE ".+MAJOR[_A-Z]+=([0-9]+).+MINOR[_A-Z]+=([0-9]+).+MICRO[_A-Z]+=([0-9]+).*"
|
||||||
|
"\\1.\\2.\\3" ${libname_upper}_VERSION "${tmp_configure_ac}")
|
||||||
|
|
||||||
|
# Library version for libtool
|
||||||
|
string (REGEX REPLACE ".+CURRENT=([0-9]+).+REVISION=([0-9]+).+AGE=([0-9]+).*"
|
||||||
|
"\\1.\\2.\\3" ${libname_upper}_SOVERSION "${tmp_configure_ac}")
|
||||||
|
|
||||||
|
# Checks if the string needs to be displayed
|
||||||
|
set (${libname_upper}_DISPLAYSTR_AUX
|
||||||
|
"Found ${libname} version ${${libname_upper}_VERSION}, soversion ${${libname_upper}_SOVERSION} from configure.ac"
|
||||||
|
)
|
||||||
|
if ((NOT ${libname_upper}_DISPLAYSTR) OR (NOT ${libname_upper}_DISPLAYSTR STREQUAL ${libname_upper}_DISPLAYSTR_AUX))
|
||||||
|
set (${libname_upper}_DISPLAYSTR ${${libname_upper}_DISPLAYSTR_AUX}
|
||||||
|
CACHE INTERNAL "Version string from ${libname}" FORCE)
|
||||||
|
message (STATUS ${${libname_upper}_DISPLAYSTR})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Export the result to the caller
|
||||||
|
set(${libname_upper}_VERSION "${${libname_upper}_VERSION}" PARENT_SCOPE)
|
||||||
|
set(${libname_upper}_SOVERSION "${${libname_upper}_SOVERSION}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Also from mono's source code
|
||||||
|
# Implementation of AC_CHECK_HEADERS
|
||||||
|
# In addition, it also records the list of variables in the variable
|
||||||
|
# 'autoheader_vars', and for each variable, a documentation string in the
|
||||||
|
# variable ${var}_doc
|
||||||
|
function(ac_check_headers)
|
||||||
|
foreach (header ${ARGV})
|
||||||
|
string(TOUPPER ${header} header_var)
|
||||||
|
string(REPLACE "." "_" header_var ${header_var})
|
||||||
|
string(REPLACE "/" "_" header_var ${header_var})
|
||||||
|
set(header_var "HAVE_${header_var}")
|
||||||
|
check_include_file (${header} ${header_var})
|
||||||
|
set("${header_var}_doc" "Define to 1 if you have the <${header}> header file." PARENT_SCOPE)
|
||||||
|
if (${header_var})
|
||||||
|
set("${header_var}_defined" "1" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
set("${header_var}_val" "1" PARENT_SCOPE)
|
||||||
|
set (autoheader_vars ${autoheader_vars} ${header_var})
|
||||||
|
endforeach()
|
||||||
|
set (autoheader_vars ${autoheader_vars} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Function taken from mono's source code
|
||||||
|
function (ac_check_funcs)
|
||||||
|
foreach (func ${ARGV})
|
||||||
|
string(TOUPPER ${func} var)
|
||||||
|
set(var "HAVE_${var}")
|
||||||
|
set(${var})
|
||||||
|
check_function_exists (${func} ${var})
|
||||||
|
set("${var}_doc" "Define to 1 if you have the '${func}' function." PARENT_SCOPE)
|
||||||
|
if (${var})
|
||||||
|
set("${var}_defined" "1" PARENT_SCOPE)
|
||||||
|
set(${var} yes PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
set("${var}_val" "1" PARENT_SCOPE)
|
||||||
|
set (autoheader_vars ${autoheader_vars} ${var})
|
||||||
|
endforeach()
|
||||||
|
set (autoheader_vars ${autoheader_vars} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Specifically, this macro checks for stdlib.h', stdarg.h',
|
||||||
|
# string.h', and float.h'; if the system has those, it probably
|
||||||
|
# has the rest of the ANSI C header files. This macro also checks
|
||||||
|
# whether string.h' declares memchr' (and thus presumably the
|
||||||
|
# other mem' functions), whether stdlib.h' declare free' (and
|
||||||
|
# thus presumably malloc' and other related functions), and whether
|
||||||
|
# the ctype.h' macros work on characters with the high bit set, as
|
||||||
|
# ANSI C requires.
|
||||||
|
function (ac_header_stdc)
|
||||||
|
if (STDC_HEADERS)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
message(STATUS "Looking for ANSI-C headers")
|
||||||
|
set(code "
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
void *ptr;
|
||||||
|
free((void*)1);
|
||||||
|
ptr = memchr((void*)1, 0, 0);
|
||||||
|
|
||||||
|
return (int)ptr;
|
||||||
|
}
|
||||||
|
")
|
||||||
|
# FIXME Check the ctype.h high bit
|
||||||
|
CHECK_C_SOURCE_COMPILES("${code}" STDC_HEADERS)
|
||||||
|
if (STDC_HEADERS)
|
||||||
|
set(STDC_HEADERS 1 PARENT_SCOPE)
|
||||||
|
message(STATUS "Looking for ANSI-C headers - found")
|
||||||
|
else()
|
||||||
|
message(STATUS "Looking for ANSI-C headers - not found")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Also from the mono sources, kind of implements AC_SYS_LARGEFILE
|
||||||
|
function (ac_sys_largefile)
|
||||||
|
CHECK_C_SOURCE_RUNS("
|
||||||
|
#include <sys/types.h>
|
||||||
|
#define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
|
||||||
|
int main (int argc, char **argv) {
|
||||||
|
int big_off_t=((BIG_OFF_T%2147483629==721) &&
|
||||||
|
(BIG_OFF_T%2147483647==1));
|
||||||
|
return big_off ? 0 : 1;
|
||||||
|
}
|
||||||
|
" HAVE_LARGE_FILE_SUPPORT)
|
||||||
|
|
||||||
|
# Check if it makes sense to define _LARGE_FILES or _FILE_OFFSET_BITS
|
||||||
|
if (HAVE_LARGE_FILE_SUPPORT)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set (_LARGE_FILE_EXTRA_SRC "
|
||||||
|
#include <sys/types.h>
|
||||||
|
int main (int argc, char **argv) {
|
||||||
|
return sizeof(off_t) == 8 ? 0 : 1;
|
||||||
|
}
|
||||||
|
")
|
||||||
|
CHECK_C_SOURCE_RUNS ("#define _LARGE_FILES\n${_LARGE_FILE_EXTRA_SRC}"
|
||||||
|
HAVE_USEFUL_D_LARGE_FILES)
|
||||||
|
if (NOT HAVE_USEFUL_D_LARGE_FILES)
|
||||||
|
if (NOT DEFINED HAVE_USEFUL_D_FILE_OFFSET_BITS)
|
||||||
|
set (SHOW_LARGE_FILE_WARNING TRUE)
|
||||||
|
endif ()
|
||||||
|
CHECK_C_SOURCE_RUNS ("#define _FILE_OFFSET_BITS 64\n${_LARGE_FILE_EXTRA_SRC}"
|
||||||
|
HAVE_USEFUL_D_FILE_OFFSET_BITS)
|
||||||
|
if (HAVE_USEFUL_D_FILE_OFFSET_BITS)
|
||||||
|
set (_FILE_OFFSET_BITS 64 PARENT_SCOPE)
|
||||||
|
elseif (SHOW_LARGE_FILE_WARNING)
|
||||||
|
message (WARNING "No 64 bit file support through off_t available.")
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
set (_LARGE_FILES 1 PARENT_SCOPE)
|
||||||
|
endif ()
|
||||||
|
endfunction ()
|
||||||
|
|
||||||
|
|
||||||
|
# Quick way to set some basic variables
|
||||||
|
# FIXME add support for variable number of arguments: only package and version are mandatory
|
||||||
|
function (ac_init package version bug_report tarname)
|
||||||
|
set(PACKAGE_NAME "\"${package}\"" PARENT_SCOPE)
|
||||||
|
set(PACKAGE_VERSION "\"${version}\"" PARENT_SCOPE)
|
||||||
|
set(VERSION "\"${version}\"" PARENT_SCOPE)
|
||||||
|
set(PACKAGE_STRING "\"${package} ${version}\"" PARENT_SCOPE)
|
||||||
|
|
||||||
|
if (bug_report)
|
||||||
|
set(PACKAGE_BUGREPORT "\"${bug_report}\"" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
if (tarname)
|
||||||
|
set(PACKAGE_TARNAME "\"${tarname}\"" PARENT_SCOPE)
|
||||||
|
set(PACKAGE "\"${tarname}\"" PARENT_SCOPE)
|
||||||
|
set(PACKAGE_UNQUOTED "${tarname}" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Checks for the const keyword, defining "HAS_CONST_SUPPORT"
|
||||||
|
# If it does not have support, defines "const" to 0 in the parent scope
|
||||||
|
function (ac_c_const)
|
||||||
|
CHECK_C_SOURCE_COMPILES(
|
||||||
|
"int main(int argc, char **argv){const int r = 0;return r;}"
|
||||||
|
HAS_CONST_SUPPORT)
|
||||||
|
if (NOT HAS_CONST_SUPPORT)
|
||||||
|
set(const 0 PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Inline keyword support. Defines "inline" in the parent scope to the
|
||||||
|
# compiler internal keyword for inline in C
|
||||||
|
# TODO write a better test!
|
||||||
|
function (ac_c_inline)
|
||||||
|
if (MSVC)
|
||||||
|
set (inline __inline)
|
||||||
|
elseif(CMAKE_COMPILER_IS_GNUC)
|
||||||
|
set (inline __inline__)
|
||||||
|
endif()
|
||||||
|
set(inline "${inline}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Test if you can safely include both <sys/time.h> and <time.h>
|
||||||
|
function (ac_header_time)
|
||||||
|
CHECK_C_SOURCE_COMPILES(
|
||||||
|
"#include <sys/time.h>\n#include <time.h>\nint main(int argc, char **argv) { return 0; }"
|
||||||
|
TIME_WITH_SYS_TIME)
|
||||||
|
set(TIME_WITH_SYS_TIME ${TIME_WITH_SYS_TIME} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
|
||||||
|
# (Intel), setting "WORDS_BIGENDIAN" to 1 if big endian
|
||||||
|
function (ac_c_bigendian)
|
||||||
|
TEST_BIG_ENDIAN(HOST_BIGENDIAN)
|
||||||
|
if (HOST_BIGENDIAN)
|
||||||
|
set(WORDS_BIGENDIAN 1 PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Check for off_t, setting "off_t" in the parent scope
|
||||||
|
function(ac_type_off_t)
|
||||||
|
CHECK_TYPE_SIZE("off_t" SIZEOF_OFF_T)
|
||||||
|
if (NOT SIZEOF_OFF_T)
|
||||||
|
set(off_t "long int")
|
||||||
|
endif()
|
||||||
|
set(off_t ${off_t} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Check for size_t, setting "size_t" in the parent scope
|
||||||
|
function(ac_type_size_t)
|
||||||
|
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
|
||||||
|
if (NOT SIZEOF_SIZE_T)
|
||||||
|
set(size_t "unsigned int")
|
||||||
|
endif()
|
||||||
|
set(size_t ${size_t} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Define "TM_IN_SYS_TIME" to 1 if <sys/time.h> declares "struct tm"
|
||||||
|
function(ac_struct_tm)
|
||||||
|
CHECK_C_SOURCE_COMPILES(
|
||||||
|
"#include <sys/time.h>\nint main(int argc, char **argv) { struct tm x; return 0; }"
|
||||||
|
TM_IN_SYS_TIME
|
||||||
|
)
|
||||||
|
if (TM_IN_SYS_TIME)
|
||||||
|
set (TM_IN_SYS_TIME 1 PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Obtain size of an 'type' and define as SIZEOF_TYPE
|
||||||
|
function (ac_check_sizeof typename)
|
||||||
|
string(TOUPPER "SIZEOF_${typename}" varname)
|
||||||
|
string(REPLACE " " "_" varname "${varname}")
|
||||||
|
string(REPLACE "*" "p" varname "${varname}")
|
||||||
|
CHECK_TYPE_SIZE("${typename}" ${varname} BUILTIN_TYPES_ONLY)
|
||||||
|
if(NOT ${varname})
|
||||||
|
set(${varname} 0 PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Check if the type exists, defines HAVE_<type>
|
||||||
|
function (ac_check_type typename)
|
||||||
|
string(TOUPPER "${typename}" varname)
|
||||||
|
string(REPLACE " " "_" varname "${varname}")
|
||||||
|
string(REPLACE "*" "p" varname "${varname}")
|
||||||
|
CHECK_TYPE_SIZE("${typename}" ${varname})
|
||||||
|
if (NOT "${varname}" STREQUAL "")
|
||||||
|
set("HAVE_${varname}" 1 PARENT_SCOPE)
|
||||||
|
set("${varname}" "${typename}" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set("${varname}" "unknown" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
# Verifies if each type on the list exists, using the given prelude
|
||||||
|
function (ac_check_types type_list prelude)
|
||||||
|
foreach(typename ${type_list})
|
||||||
|
string(TOUPPER "HAVE_${typename}" varname)
|
||||||
|
string(REPLACE " " "_" varname "${varname}")
|
||||||
|
string(REPLACE "*" "p" varname "${varname}")
|
||||||
|
CHECK_C_SOURCE_COMPILES("${prelude}\n ${typename} foo;" ${varname})
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
19
cmake/Modules/FindAsciiDoc.cmake
Normal file
19
cmake/Modules/FindAsciiDoc.cmake
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# - 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)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_ARGS(AsciiDoc REQUIRED_VARS ASCIIDOC_EXECUTABLE)
|
||||||
|
mark_as_advanced(ASCIIDOC_EXECUTABLE A2X_EXECUTABLE)
|
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;
|
|
||||||
}
|
|
||||||
|
|
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
|
Loading…
Reference in New Issue
Block a user