mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-14 01:37:56 +08:00
Problem: no support for DRAFT API in build systems
Solution: add support for --enable-drafts/ENABLE_DRAFTS=ON in Autools and CMake.
This commit is contained in:
parent
f0a34e0ff5
commit
064cd1fbfb
@ -57,6 +57,20 @@ else ()
|
|||||||
set (ZMQ_HAVE_CURVE 1)
|
set (ZMQ_HAVE_CURVE 1)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
set (POLLER "" CACHE STRING "Choose polling system. valid values are
|
set (POLLER "" CACHE STRING "Choose polling system. valid values are
|
||||||
kqueue, epoll, devpoll, poll or select [default=autodetect]")
|
kqueue, epoll, devpoll, poll or select [default=autodetect]")
|
||||||
|
|
||||||
|
@ -740,6 +740,10 @@ test_reqrep_vmci_CXXFLAGS = @LIBZMQ_VMCI_CXXFLAGS@
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if ENABLE_DRAFTS
|
||||||
|
test_apps +=
|
||||||
|
endif
|
||||||
|
|
||||||
check_PROGRAMS = ${test_apps}
|
check_PROGRAMS = ${test_apps}
|
||||||
|
|
||||||
# Run the test cases
|
# Run the test cases
|
||||||
|
27
configure.ac
27
configure.ac
@ -605,6 +605,33 @@ LIBZMQ_CHECK_TCP_KEEPALIVE([
|
|||||||
|
|
||||||
AM_CONDITIONAL(HAVE_FORK, test "x$ac_cv_func_fork" = "xyes")
|
AM_CONDITIONAL(HAVE_FORK, test "x$ac_cv_func_fork" = "xyes")
|
||||||
|
|
||||||
|
if test "x$cross_compiling" = "xyes"; then
|
||||||
|
# Enable draft by default when cross-compiling
|
||||||
|
defaultval=yes
|
||||||
|
else
|
||||||
|
# enable draft API by default if we're in a git repository
|
||||||
|
# else disable it by default; then allow --enable-drafts=yes/no override
|
||||||
|
AC_CHECK_FILE($srcdir/.git, [defaultval=yes], [defaultval=no])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([drafts],
|
||||||
|
AS_HELP_STRING([--enable-drafts],
|
||||||
|
[Build and install draft classes and methods [default=yes]]),
|
||||||
|
[enable_drafts=$enableval],
|
||||||
|
[enable_drafts=$defaultval])
|
||||||
|
|
||||||
|
AM_CONDITIONAL([ENABLE_DRAFTS], [test x$enable_drafts != xno])
|
||||||
|
|
||||||
|
if test "x$enable_drafts" = "xyes"; then
|
||||||
|
AC_MSG_NOTICE([Building stable and legacy API + draft API])
|
||||||
|
AC_DEFINE(ZMQ_BUILD_DRAFT_API, 1, [Provide draft classes and methods])
|
||||||
|
AC_SUBST(pkg_config_defines, "-DZMQ_BUILD_DRAFT_API=1")
|
||||||
|
# CPPFLAGS="-DZMQ_BUILD_DRAFT_API=1 $CPPFLAGS"
|
||||||
|
else
|
||||||
|
AC_MSG_NOTICE([Building stable and legacy API (no draft API)])
|
||||||
|
AC_SUBST(pkg_config_defines, "")
|
||||||
|
fi
|
||||||
|
|
||||||
# Subst LIBZMQ_EXTRA_CFLAGS & CXXFLAGS & LDFLAGS
|
# Subst LIBZMQ_EXTRA_CFLAGS & CXXFLAGS & LDFLAGS
|
||||||
AC_SUBST(LIBZMQ_EXTRA_CFLAGS)
|
AC_SUBST(LIBZMQ_EXTRA_CFLAGS)
|
||||||
AC_SUBST(LIBZMQ_EXTRA_CXXFLAGS)
|
AC_SUBST(LIBZMQ_EXTRA_CXXFLAGS)
|
||||||
|
@ -575,6 +575,16 @@ ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn* func, void* arg);
|
|||||||
ZMQ_EXPORT void zmq_threadclose (void* thread);
|
ZMQ_EXPORT void zmq_threadclose (void* thread);
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* These functions are DRAFT and disabled in stable releases, and subject to */
|
||||||
|
/* change at ANY time until declared stable. */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#ifdef ZMQ_BUILD_DRAFT_API
|
||||||
|
|
||||||
|
#endif // ZMQ_BUILD_DRAFT_API
|
||||||
|
|
||||||
|
|
||||||
#undef ZMQ_EXPORT
|
#undef ZMQ_EXPORT
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -8,4 +8,4 @@ Description: 0MQ c++ library
|
|||||||
Version: @ZMQ_VERSION_MAJOR@.@ZMQ_VERSION_MINOR@.@ZMQ_VERSION_PATCH@
|
Version: @ZMQ_VERSION_MAJOR@.@ZMQ_VERSION_MINOR@.@ZMQ_VERSION_PATCH@
|
||||||
Libs: -L${libdir} -lzmq
|
Libs: -L${libdir} -lzmq
|
||||||
Libs.private: -lstdc++
|
Libs.private: -lstdc++
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir} @pkg_config_defines@
|
||||||
|
@ -8,4 +8,4 @@ Description: 0MQ c++ library
|
|||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Libs: -L${libdir} -lzmq
|
Libs: -L${libdir} -lzmq
|
||||||
Libs.private: -lstdc++
|
Libs.private: -lstdc++
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir} @pkg_config_defines@
|
||||||
|
@ -145,5 +145,13 @@
|
|||||||
#include "platform.hpp"
|
#include "platform.hpp"
|
||||||
#include "../include/zmq.h"
|
#include "../include/zmq.h"
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* These functions are DRAFT and disabled in stable releases, and subject to */
|
||||||
|
/* change at ANY time until declared stable. */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef ZMQ_BUILD_DRAFT_API
|
||||||
|
|
||||||
|
#endif // ZMQ_BUILD_DRAFT_API
|
||||||
|
|
||||||
#endif //ifndef __ZMQ_PRECOMPILED_HPP_INCLUDED__
|
#endif //ifndef __ZMQ_PRECOMPILED_HPP_INCLUDED__
|
||||||
|
@ -117,6 +117,12 @@ if(WITH_VMCI)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
IF (ENABLE_DRAFTS)
|
||||||
|
list(APPEND tests
|
||||||
|
)
|
||||||
|
ENDIF (ENABLE_DRAFTS)
|
||||||
|
|
||||||
# add location of platform.hpp for Windows builds
|
# add location of platform.hpp for Windows builds
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP)
|
add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user