aboutsummaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-11-05 13:54:40 -0800
committerGarrett D'Amore <garrett@damore.org>2018-11-05 16:20:23 -0800
commit77984b14a65c0a7387c97f3d36f947dd17358744 (patch)
treed95ad88933c9fe8853cbc74fe8dc1492d60ad443 /src/protocol
parentdb92342b43d429b8b07244cc003a8589a1b1c542 (diff)
downloadnng-77984b14a65c0a7387c97f3d36f947dd17358744.tar.gz
nng-77984b14a65c0a7387c97f3d36f947dd17358744.tar.bz2
nng-77984b14a65c0a7387c97f3d36f947dd17358744.zip
fixes #577 target library dependencies should be public
This is a significant refactor of the library configuration. We use the modern package configuration helper, with a template script that also does the find_package dance for any of our dependencies. We also have restructured the code so that most protocols and transports have their configuration isolated to their own CMakeLists file, reducing the size of the global CMakeLists file.
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/bus0/CMakeLists.txt14
-rw-r--r--src/protocol/pair0/CMakeLists.txt14
-rw-r--r--src/protocol/pair1/CMakeLists.txt14
-rw-r--r--src/protocol/pipeline0/CMakeLists.txt26
-rw-r--r--src/protocol/pubsub0/CMakeLists.txt24
-rw-r--r--src/protocol/reqrep0/CMakeLists.txt30
-rw-r--r--src/protocol/survey0/CMakeLists.txt30
7 files changed, 108 insertions, 44 deletions
diff --git a/src/protocol/bus0/CMakeLists.txt b/src/protocol/bus0/CMakeLists.txt
index 06c44111..73acdf11 100644
--- a/src/protocol/bus0/CMakeLists.txt
+++ b/src/protocol/bus0/CMakeLists.txt
@@ -9,11 +9,15 @@
#
# Bus protocol
+option (NNG_PROTO_BUS0 "Enable BUSv0 protocol." ON)
+mark_as_advanced(NNG_PROTO_BUS0)
if (NNG_PROTO_BUS0)
- set(BUS0_SOURCES protocol/bus0/bus.c protocol/bus0/bus.h)
- set(BUS0_HEADERS protocol/bus0/bus.h)
-endif()
+ set(_DEFS -DNNG_HAVE_BUS0)
+ set(_SRCS protocol/bus0/bus.c protocol/bus0/bus.h)
+ set(_HDRS protocol/bus0/bus.h)
-set(NNG_SOURCES ${NNG_SOURCES} ${BUS0_SOURCES} PARENT_SCOPE)
-set(NNG_HEADERS ${NNG_HEADERS} ${BUS0_HEADERS} PARENT_SCOPE)
+ set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE)
+ set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
+ set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE)
+endif()
diff --git a/src/protocol/pair0/CMakeLists.txt b/src/protocol/pair0/CMakeLists.txt
index 2ba8d374..c453b07f 100644
--- a/src/protocol/pair0/CMakeLists.txt
+++ b/src/protocol/pair0/CMakeLists.txt
@@ -9,11 +9,15 @@
#
# PAIRv0 protocol
+option (NNG_PROTO_PAIR0 "Enable PAIRv0 protocol." ON)
+mark_as_advanced(NNG_PROTO_PAIR0)
if (NNG_PROTO_PAIR0)
- set(PAIR0_SOURCES protocol/pair0/pair.c protocol/pair0/pair.h)
- set(PAIR0_HEADERS protocol/pair0/pair.h)
-endif()
+ set(_DEFS -DNNG_HAVE_PAIR0)
+ set(_SRCS protocol/pair0/pair.c protocol/pair0/pair.h)
+ set(_HDRS protocol/pair0/pair.h)
-set(NNG_SOURCES ${NNG_SOURCES} ${PAIR0_SOURCES} PARENT_SCOPE)
-set(NNG_HEADERS ${NNG_HEADERS} ${PAIR0_HEADERS} PARENT_SCOPE)
+ set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE)
+ set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
+ set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE)
+endif()
diff --git a/src/protocol/pair1/CMakeLists.txt b/src/protocol/pair1/CMakeLists.txt
index 9c0ca09f..5c8813bf 100644
--- a/src/protocol/pair1/CMakeLists.txt
+++ b/src/protocol/pair1/CMakeLists.txt
@@ -9,11 +9,15 @@
#
# PAIRv1 protocol
+option (NNG_PROTO_PAIR1 "Enable PAIRv1 protocol." ON)
+mark_as_advanced(NNG_PROTO_PAIR1)
if (NNG_PROTO_PAIR1)
- set(PAIR1_SOURCES protocol/pair1/pair.c protocol/pair1/pair.h)
- set(PAIR1_HEADERS protocol/pair1/pair.h)
-endif()
+ set(_DEFS -DNNG_HAVE_PAIR1)
+ set(_SRCS protocol/pair1/pair.c protocol/pair1/pair.h)
+ set(_HDRS protocol/pair1/pair.h)
-set(NNG_SOURCES ${NNG_SOURCES} ${PAIR1_SOURCES} PARENT_SCOPE)
-set(NNG_HEADERS ${NNG_HEADERS} ${PAIR1_HEADERS} PARENT_SCOPE)
+ set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE)
+ set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
+ set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE)
+endif()
diff --git a/src/protocol/pipeline0/CMakeLists.txt b/src/protocol/pipeline0/CMakeLists.txt
index 669fb9dc..675cb961 100644
--- a/src/protocol/pipeline0/CMakeLists.txt
+++ b/src/protocol/pipeline0/CMakeLists.txt
@@ -8,17 +8,29 @@
# found online at https://opensource.org/licenses/MIT.
#
-# Pub/Sub protocol
+# Pipeline protocol
+option (NNG_PROTO_PUSH0 "Enable PUSHv0 protocol." ON)
+mark_as_advanced(NNG_PROTO_PUSH0)
+
+option (NNG_PROTO_PULL0 "Enable PULLv0 protocol." ON)
+mark_as_advanced(NNG_PROTO_PULL0)
+
+set(_DEFS)
+set(_HDRS)
+set(_SRCS)
if (NNG_PROTO_PUSH0)
- set(PUSH0_SOURCES protocol/pipeline0/push.c protocol/pipeline0/push.h)
- set(PUSH0_HEADERS protocol/pipeline0/push.h)
+ list(APPEND _SRCS protocol/pipeline0/push.c protocol/pipeline0/push.h)
+ list(APPEND _HDRS protocol/pipeline0/push.h)
+ list(APPEND _DEFS -DNNG_HAVE_PUSH0)
endif()
if (NNG_PROTO_PULL0)
- set(PULL0_SOURCES protocol/pipeline0/pull.c protocol/pipeline0/pull.h)
- set(PULL0_HEADERS protocol/pipeline0/pull.h)
+ list(APPEND _SRCS protocol/pipeline0/pull.c protocol/pipeline0/pull.h)
+ list(APPEND _HDRS protocol/pipeline0/pull.h)
+ list(APPEND _DEFS -DNNG_HAVE_PULL0)
endif()
-set(NNG_SOURCES ${NNG_SOURCES} ${PUSH0_SOURCES} ${PULL0_SOURCES} PARENT_SCOPE)
-set(NNG_HEADERS ${NNG_HEADERS} ${PUSH0_HEADERS} ${PULL0_HEADERS} PARENT_SCOPE)
+set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE)
+set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
+set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE)
diff --git a/src/protocol/pubsub0/CMakeLists.txt b/src/protocol/pubsub0/CMakeLists.txt
index 49ec8913..29f64049 100644
--- a/src/protocol/pubsub0/CMakeLists.txt
+++ b/src/protocol/pubsub0/CMakeLists.txt
@@ -9,16 +9,28 @@
#
# Pub/Sub protocol
+option (NNG_PROTO_PUB0 "Enable PUBv0 protocol." ON)
+mark_as_advanced(NNG_PROTO_PUB0)
+
+option (NNG_PROTO_SUB0 "Enable SUBv0 protocol." ON)
+mark_as_advanced(NNG_PROTO_SUB0)
+
+set(_DEFS)
+set(_SRCS)
+set(_HDRS)
if (NNG_PROTO_PUB0)
- set(PUB0_SOURCES protocol/pubsub0/pub.c protocol/pubsub0/pub.h)
- set(PUB0_HEADERS protocol/pubsub0/pub.h)
+ list(APPEND _DEFS -DNNG_HAVE_PUB0)
+ list(APPEND _SRCS protocol/pubsub0/pub.c protocol/pubsub0/pub.h)
+ list(APPEND _HDRS protocol/pubsub0/pub.h)
endif()
if (NNG_PROTO_SUB0)
- set(SUB0_SOURCES protocol/pubsub0/sub.c protocol/pubsub0/sub.h)
- set(SUB0_HEADERS protocol/pubsub0/sub.h)
+ list(APPEND _DEFS -DNNG_HAVE_SUB0)
+ list(APPEND _SRCS protocol/pubsub0/sub.c protocol/pubsub0/sub.h)
+ list(APPEND _HDRS protocol/pubsub0/sub.h)
endif()
-set(NNG_SOURCES ${NNG_SOURCES} ${PUB0_SOURCES} ${SUB0_SOURCES} PARENT_SCOPE)
-set(NNG_HEADERS ${NNG_HEADERS} ${PUB0_HEADERS} ${SUB0_HEADERS} PARENT_SCOPE)
+set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE)
+set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
+set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE)
diff --git a/src/protocol/reqrep0/CMakeLists.txt b/src/protocol/reqrep0/CMakeLists.txt
index 071c28f1..70c075c1 100644
--- a/src/protocol/reqrep0/CMakeLists.txt
+++ b/src/protocol/reqrep0/CMakeLists.txt
@@ -9,18 +9,32 @@
#
# Req/Rep protocol
+option (NNG_PROTO_REQ0 "Enable REQv0 protocol." ON)
+mark_as_advanced(NNG_PROTO_REQ0)
+
+option (NNG_PROTO_REP0 "Enable REPv0 protocol." ON)
+mark_as_advanced(NNG_PROTO_REP0)
+
+set(_DEFS)
+set(_SRCS)
+set(_HDRS)
if (NNG_PROTO_REQ0)
- set(REQ0_SOURCES protocol/reqrep0/req.c protocol/reqrep0/xreq.c
- protocol/reqrep0/req.h)
- set(REQ0_HEADERS protocol/reqrep0/req.h)
+ list(APPEND _DEFS -DNNG_HAVE_REQ0)
+ list(APPEND _SRCS
+ protocol/reqrep0/req.c protocol/reqrep0/xreq.c
+ protocol/reqrep0/req.h)
+ list(APPEND _HDRS protocol/reqrep0/req.h)
endif()
if (NNG_PROTO_REP0)
- set(REP0_SOURCES protocol/reqrep0/rep.c protocol/reqrep0/xrep.c
- protocol/reqrep0/rep.h)
- set(REP0_HEADERS protocol/reqrep0/rep.h)
+ list(APPEND _DEFS -DNNG_HAVE_REP0)
+ list(APPEND _SRCS
+ protocol/reqrep0/rep.c protocol/reqrep0/xrep.c
+ protocol/reqrep0/rep.h)
+ list(APPEND _HDRS protocol/reqrep0/rep.h)
endif()
-set(NNG_SOURCES ${NNG_SOURCES} ${REQ0_SOURCES} ${REP0_SOURCES} PARENT_SCOPE)
-set(NNG_HEADERS ${NNG_HEADERS} ${REQ0_HEADERS} ${REP0_HEADERS} PARENT_SCOPE)
+set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE)
+set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
+set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE)
diff --git a/src/protocol/survey0/CMakeLists.txt b/src/protocol/survey0/CMakeLists.txt
index 0a82463c..b6104a54 100644
--- a/src/protocol/survey0/CMakeLists.txt
+++ b/src/protocol/survey0/CMakeLists.txt
@@ -9,18 +9,32 @@
#
# Surveyor/Respondent protocol
+option (NNG_PROTO_RESPONDENT0 "Enable RESPONDENTv0 protocol." ON)
+mark_as_advanced(NNG_PROTO_RESPONDENT0)
+
+option (NNG_PROTO_SURVEYOR0 "Enable SURVEYORv0 protocol." ON)
+mark_as_advanced(NNG_PROTO_SURVEYOR0)
+
+set(_DEFS)
+set(_HDRS)
+set(_SRCS)
if (NNG_PROTO_SURVEYOR0)
- set(SURV0_SOURCES protocol/survey0/survey.c protocol/survey0/xsurvey.c
- protocol/survey0/survey.h)
- set(SURV0_HEADERS protocol/survey0/survey.h)
+ list(APPEND _DEFS -DNNG_HAVE_SURVEYOR0)
+ list(APPEND _SRCS
+ protocol/survey0/survey.c protocol/survey0/xsurvey.c
+ protocol/survey0/survey.h)
+ list(APPEND _HDRS protocol/survey0/survey.h)
endif()
if (NNG_PROTO_RESPONDENT0)
- set(RESP0_SOURCES protocol/survey0/respond.c protocol/survey0/xrespond.c
- protocol/survey0/respond.h)
- set(RESP0_HEADERS protocol/survey0/respond.h)
+ list(APPEND _DEFS -DNNG_HAVE_RESPONDENT0)
+ list(APPEND _SRCS
+ protocol/survey0/respond.c protocol/survey0/xrespond.c
+ protocol/survey0/respond.h)
+ list(APPEND _HDRS protocol/survey0/respond.h)
endif()
-set(NNG_SOURCES ${NNG_SOURCES} ${SURV0_SOURCES} ${RESP0_SOURCES} PARENT_SCOPE)
-set(NNG_HEADERS ${NNG_HEADERS} ${SURV0_HEADERS} ${RESP0_HEADERS} PARENT_SCOPE)
+set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE)
+set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE)
+set(NNG_HDRS ${NNG_HDRS} ${_HDRS} PARENT_SCOPE)