aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-10-31 13:06:38 -0700
committerGarrett D'Amore <garrett@damore.org>2017-11-02 16:10:26 -0700
commit7bf591e20a94b8d926f92ab9b320f3b75d342345 (patch)
treed67ce7cab328a004346419047feede7d579dad77 /CMakeLists.txt
parentd340af7dc250388f48d36c5078c4857c51bb6121 (diff)
downloadnng-7bf591e20a94b8d926f92ab9b320f3b75d342345.tar.gz
nng-7bf591e20a94b8d926f92ab9b320f3b75d342345.tar.bz2
nng-7bf591e20a94b8d926f92ab9b320f3b75d342345.zip
fixes #143 Protocols and transports should be "configurable"
This makes all the protocols and transports optional. All of them except ZeroTier are enabled by default, but you can now disable them (remove from the build) with cmake options. The test suite is modified so that tests still run as much as they can, but skip over things caused by missing functionality from the library (due to configuration). Further, the constant definitions and prototypes for functions that are specific to transports or protocols are moved into appropriate headers, which should be included directly by applications wishing to use these. We have also added and improved documentation -- all of the transports are documented, and several more man pages for protocols have been added. (Req/Rep and Surveyor are still missing.)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt109
1 files changed, 74 insertions, 35 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2815ca3..6cd49b9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -93,11 +93,83 @@ option (NNG_TESTS "Build and run tests" ON)
option (NNG_TOOLS "Build extra tools" OFF)
option (NNG_ENABLE_NNGCAT "Enable building nngcat utility." ${NNG_TOOLS})
option (NNG_ENABLE_COVERAGE "Enable coverage reporting." OFF)
-option (NNG_ENABLE_ZEROTIER "Enable ZeroTier transport (requires libzerotiercore)." OFF)
-set (NNG_ZEROTIER_SOURCE "" CACHE PATH "Location of ZeroTier source tree.")
# Enable access to private APIs for our own use.
add_definitions (-DNNG_PRIVATE)
+option (NNG_PROTO_BUS0 "Enable BUSv0 protocol." ON)
+if (NNG_PROTO_BUS0)
+ add_definitions (-DNNG_HAVE_BUS0)
+endif ()
+
+option (NNG_PROTO_PAIR0 "Enable PAIRv0 protocol." ON)
+if (NNG_PROTO_PAIR0)
+ add_definitions (-DNNG_HAVE_PAIR0)
+endif ()
+
+option (NNG_PROTO_PAIR1 "Enable PAIRv1 protocol." ON)
+if (NNG_PROTO_PAIR1)
+ add_definitions (-DNNG_HAVE_PAIR1)
+endif ()
+
+option (NNG_PROTO_REQ0 "Enable REQv0 protocol." ON)
+if (NNG_PROTO_REQ0)
+ add_definitions (-DNNG_HAVE_REQ0)
+endif ()
+
+option (NNG_PROTO_REP0 "Enable REPv0 protocol." ON)
+if (NNG_PROTO_REP0)
+ add_definitions (-DNNG_HAVE_REP0)
+endif ()
+
+option (NNG_PROTO_PUB0 "Enable PUBv0 protocol." ON)
+if (NNG_PROTO_PUB0)
+ add_definitions (-DNNG_HAVE_PUB0)
+endif ()
+
+option (NNG_PROTO_SUB0 "Enable SUBv0 protocol." ON)
+if (NNG_PROTO_SUB0)
+ add_definitions (-DNNG_HAVE_SUB0)
+endif ()
+
+option (NNG_PROTO_PUSH0 "Enable PUSHv0 protocol." ON)
+if (NNG_PROTO_PUSH0)
+ add_definitions (-DNNG_HAVE_PUSH0)
+endif ()
+
+option (NNG_PROTO_PULL0 "Enable PULLv0 protocol." ON)
+if (NNG_PROTO_PULL0)
+ add_definitions (-DNNG_HAVE_PULL0)
+endif ()
+
+option (NNG_PROTO_SURVEYOR0 "Enable SURVEYORv0 protocol." ON)
+if (NNG_PROTO_SURVEYOR0)
+ add_definitions (-DNNG_HAVE_SURVEYOR0)
+endif ()
+
+option (NNG_PROTO_RESPONDENT0 "Enable RESPONDENTv0 protocol." ON)
+if (NNG_PROTO_RESPONDENT0)
+ add_definitions (-DNNG_HAVE_RESPONDENT0)
+endif ()
+
+option (NNG_TRANSPORT_INPROC "Enable inproc transport." ON)
+if (NNG_TRANSPORT_INPROC)
+ add_definitions (-DNNG_HAVE_INPROC)
+endif ()
+
+option (NNG_TRANSPORT_IPC "Enable IPC transport." ON)
+if (NNG_TRANSPORT_IPC)
+ add_definitions (-DNNG_HAVE_IPC)
+endif ()
+
+option (NNG_TRANSPORT_TCP "Enable TCP transport." ON)
+if (NNG_TRANSPORT_TCP)
+ add_definitions (-DNNG_HAVE_TCP)
+endif ()
+
+option (NNG_TRANSPORT_ZEROTIER "Enable ZeroTier transport (requires libzerotiercore)." OFF)
+if (NNG_TRANSPORT_ZEROTIER)
+ add_definitions (-DNNG_HAVE_ZEROTIER)
+endif ()
# Platform checks.
if (NNG_ENABLE_COVERAGE)
@@ -247,39 +319,6 @@ nng_check_sym (strlcat string.h NNG_HAVE_STRLCAT)
nng_check_sym (strlcpy string.h NNG_HAVE_STRLCPY)
nng_check_sym (strnlen string.h NNG_HAVE_STRNLEN)
-# Search for ZeroTier
-# We use the libzerotiercore.a library, which is unfortunately a C++ object
-# even though it exposes only public C symbols. It would be extremely
-# helpful if libzerotiercore didn't make us carry the whole C++ runtime
-# behind us. The user must specify the location of the ZeroTier source
-# tree (dev branch for now, and already compiled please) by setting the
-# NNG_ZEROTIER_SOURCE macro.
-# NB: This needs to be the zerotierone tree, not the libzt library.
-# This is because we don't access the API, but instead use the low
-# level zerotiercore functionality directly.
-# NB: As we wind up linking libzerotiercore.a into the application,
-# this means that your application will *also* need to either be licensed
-# under the GPLv3, or you will need to have a commercial license from
-# ZeroTier permitting its use elsewhere.
-if (NNG_ENABLE_ZEROTIER)
- enable_language(CXX)
- find_library(NNG_LIBZTCORE zerotiercore PATHS ${NNG_ZEROTIER_SOURCE})
- if (NNG_LIBZTCORE)
- set(CMAKE_REQUIRED_INCLUDES ${NNG_ZEROTIER_SOURCE}/include)
-# set(CMAKE_REQUIRED_LIBRARIES ${NNG_LIBZTCORE} c++)
-# set(NNG_REQUIRED_LIBRARIES ${NNG_REQUIRED_LIBRARIES} ${NNG_LIBZTCORE} c++)
- message(STATUS "C++ ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}")
- set(CMAKE_REQUIRED_LIBRARIES ${NNG_LIBZTCORE} ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})
- set(NNG_REQUIRED_LIBRARIES ${NNG_REQUIRED_LIBRARIES} ${NNG_LIBZTCORE} ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})
- set(NNG_REQUIRED_INCLUDES ${NNG_REQUIRED_INCLUDES} ${NNG_ZEROTIER_SOURCE}/include)
- nng_check_sym(ZT_Node_join ZeroTierOne.h NNG_HAVE_ZEROTIER)
- endif()
- if (NOT NNG_HAVE_ZEROTIER)
- message (FATAL_ERROR "Cannot find ZeroTier components")
- endif()
- message(STATUS "Found ZeroTier at ${NNG_LIBZTCORE}")
-endif()
-
add_subdirectory (src)
if (NNG_TESTS)