From 440ddf86b3b3b6be47943c5b6408d63b091f2c28 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 25 Dec 2019 09:45:12 -0800 Subject: fixes #1040 Convert rest of the protocols to new CMake infra --- src/CMakeLists.txt | 5 +---- src/protocol/bus0/CMakeLists.txt | 12 ++++-------- src/protocol/pair0/CMakeLists.txt | 12 ++++-------- src/protocol/pipeline0/CMakeLists.txt | 24 +++++++----------------- src/protocol/pubsub0/CMakeLists.txt | 25 ++++++------------------- src/protocol/reqrep0/CMakeLists.txt | 2 +- src/protocol/survey0/CMakeLists.txt | 28 +++++++--------------------- src/supplemental/tcp/CMakeLists.txt | 5 +---- src/supplemental/util/CMakeLists.txt | 11 +++-------- src/supplemental/websocket/CMakeLists.txt | 9 +++------ src/transport/inproc/CMakeLists.txt | 2 +- src/transport/ipc/CMakeLists.txt | 12 ++++-------- src/transport/tcp/CMakeLists.txt | 12 ++++-------- src/transport/tls/CMakeLists.txt | 12 ++++-------- 14 files changed, 50 insertions(+), 121 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e8d171c9..f5e2eca0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,9 +36,6 @@ if (NNG_TESTS) ${PROJECT_SOURCE_DIR}/include/nng/nng.h) endif() - -#nng.c -#${PROJECT_SOURCE_DIR}/include/nng/nng.h set (NNG_SRCS core/defs.h @@ -221,7 +218,7 @@ if (NNG_TESTS) target_sources(${PROJECT_NAME}_testlib PRIVATE ${NNG_SRCS}) target_link_libraries (${PROJECT_NAME}_testlib PUBLIC ${NNG_LIBS}) target_compile_definitions(${PROJECT_NAME}_testlib PUBLIC NNG_STATIC_LIB NNG_TEST_LIB) - target_include_directories (${PROJECT_NAME}_testlib PRIVATE ${PROJECT_SOURCE_DIR}/include) + target_include_directories (${PROJECT_NAME}_testlib PUBLIC ${PROJECT_SOURCE_DIR}/include) endif() # When building shared libraries we prefer to suppress default symbol diff --git a/src/protocol/bus0/CMakeLists.txt b/src/protocol/bus0/CMakeLists.txt index 1f144438..1115e2ec 100644 --- a/src/protocol/bus0/CMakeLists.txt +++ b/src/protocol/bus0/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. +# Copyright 2019 Staysail Systems, Inc. # Copyright 2018 Capitar IT Group BV # # This software is supplied under the terms of the MIT License, a @@ -12,10 +12,6 @@ option (NNG_PROTO_BUS0 "Enable BUSv0 protocol." ON) mark_as_advanced(NNG_PROTO_BUS0) -if (NNG_PROTO_BUS0) - set(_DEFS -DNNG_HAVE_BUS0) - set(_SRCS protocol/bus0/bus.c ${PROJECT_SOURCE_DIR}/include/nng/protocol/bus0/bus.h) - - set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) - set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) -endif() +nng_sources_if(NNG_PROTO_BUS0 bus.c) +nng_headers_if(NNG_PROTO_BUS0 nng/protocol/bus0/bus.h) +nng_defines_if(NNG_PROTO_BUS0 NNG_HAVE_BUS0) \ No newline at end of file diff --git a/src/protocol/pair0/CMakeLists.txt b/src/protocol/pair0/CMakeLists.txt index 72d04888..c3da1b07 100644 --- a/src/protocol/pair0/CMakeLists.txt +++ b/src/protocol/pair0/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. +# Copyright 2019 Staysail Systems, Inc. # Copyright 2018 Capitar IT Group BV # # This software is supplied under the terms of the MIT License, a @@ -12,10 +12,6 @@ option (NNG_PROTO_PAIR0 "Enable PAIRv0 protocol." ON) mark_as_advanced(NNG_PROTO_PAIR0) -if (NNG_PROTO_PAIR0) - set(_DEFS -DNNG_HAVE_PAIR0) - set(_SRCS protocol/pair0/pair.c ${PROJECT_SOURCE_DIR}/include/nng/protocol/pair0/pair.h) - - set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) - set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) -endif() +nng_sources_if(NNG_PROTO_PAIR0 pair.c) +nng_headers_if(NNG_PROTO_PAIR0 nng/protocol/pair0/pair.h) +nng_defines_if(NNG_PROTO_PAIR0 NNG_HAVE_PAIR0) \ No newline at end of file diff --git a/src/protocol/pipeline0/CMakeLists.txt b/src/protocol/pipeline0/CMakeLists.txt index f4de4475..0e211cf5 100644 --- a/src/protocol/pipeline0/CMakeLists.txt +++ b/src/protocol/pipeline0/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. +# Copyright 2019 Staysail Systems, Inc. # Copyright 2018 Capitar IT Group BV # # This software is supplied under the terms of the MIT License, a @@ -15,20 +15,10 @@ mark_as_advanced(NNG_PROTO_PUSH0) option (NNG_PROTO_PULL0 "Enable PULLv0 protocol." ON) mark_as_advanced(NNG_PROTO_PULL0) -set(_DEFS) -set(_SRCS) +nng_sources_if(NNG_PROTO_PUSH0 push.c) +nng_headers_if(NNG_PROTO_PUSH0 nng/protocol/pipeline0/push.h) +nng_defines_if(NNG_PROTO_PUSH0 NNG_HAVE_PUSH0) -if (NNG_PROTO_PUSH0) - list(APPEND _SRCS protocol/pipeline0/push.c ${PROJECT_SOURCE_DIR}/include/nng/protocol/pipeline0/push.h) - - list(APPEND _DEFS -DNNG_HAVE_PUSH0) -endif() - -if (NNG_PROTO_PULL0) - list(APPEND _SRCS protocol/pipeline0/pull.c ${PROJECT_SOURCE_DIR}/include/nng/protocol/pipeline0/pull.h) - - list(APPEND _DEFS -DNNG_HAVE_PULL0) -endif() - -set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) +nng_sources_if(NNG_PROTO_PULL0 pull.c) +nng_headers_if(NNG_PROTO_PULL0 nng/protocol/pipeline0/pull.h) +nng_defines_if(NNG_PROTO_PULL0 NNG_HAVE_PULL0) \ No newline at end of file diff --git a/src/protocol/pubsub0/CMakeLists.txt b/src/protocol/pubsub0/CMakeLists.txt index 12872063..23874662 100644 --- a/src/protocol/pubsub0/CMakeLists.txt +++ b/src/protocol/pubsub0/CMakeLists.txt @@ -15,23 +15,10 @@ mark_as_advanced(NNG_PROTO_PUB0) option (NNG_PROTO_SUB0 "Enable SUBv0 protocol." ON) mark_as_advanced(NNG_PROTO_SUB0) -set(_DEFS) -set(_SRCS) +nng_sources_if(NNG_PROTO_PUB0 pub.c) +nng_headers_if(NNG_PROTO_PUB0 nng/protocol/pubsub0/pub.h) +nng_defines_if(NNG_PROTO_PUB0 NNG_HAVE_PUB0) -if (NNG_PROTO_PUB0) - list(APPEND _DEFS -DNNG_HAVE_PUB0) - list(APPEND _SRCS protocol/pubsub0/pub.c ${PROJECT_SOURCE_DIR}/include/nng/protocol/pubsub0/pub.h) - -endif() - -if (NNG_PROTO_SUB0) - list(APPEND _DEFS -DNNG_HAVE_SUB0) - list(APPEND _SRCS - protocol/pubsub0/sub.c - protocol/pubsub0/xsub.c - ${PROJECT_SOURCE_DIR}/include/nng/protocol/pubsub0/sub.h) - -endif() - -set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) +nng_sources_if(NNG_PROTO_SUB0 sub.c xsub.c) +nng_headers_if(NNG_PROTO_SUB0 nng/protocol/pubsub0/sub.h) +nng_defines_if(NNG_PROTO_SUB0 NNG_HAVE_SUB0) \ No newline at end of file diff --git a/src/protocol/reqrep0/CMakeLists.txt b/src/protocol/reqrep0/CMakeLists.txt index 4778f4ea..84c25c0e 100644 --- a/src/protocol/reqrep0/CMakeLists.txt +++ b/src/protocol/reqrep0/CMakeLists.txt @@ -23,4 +23,4 @@ nng_sources_if(NNG_PROTO_REP0 rep.c xrep.c) nng_headers_if(NNG_PROTO_REP0 nng/protocol/reqrep0/rep.h) nng_defines_if(NNG_PROTO_REP0 NNG_HAVE_REP0) -nng_test(reqrep_test) +nng_test(reqrep_test) \ No newline at end of file diff --git a/src/protocol/survey0/CMakeLists.txt b/src/protocol/survey0/CMakeLists.txt index 260c3e58..271afabf 100644 --- a/src/protocol/survey0/CMakeLists.txt +++ b/src/protocol/survey0/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. +# Copyright 2019 Staysail Systems, Inc. # Copyright 2018 Capitar IT Group BV # # This software is supplied under the terms of the MIT License, a @@ -15,24 +15,10 @@ mark_as_advanced(NNG_PROTO_RESPONDENT0) option (NNG_PROTO_SURVEYOR0 "Enable SURVEYORv0 protocol." ON) mark_as_advanced(NNG_PROTO_SURVEYOR0) -set(_DEFS) -set(_SRCS) +nng_sources_if(NNG_PROTO_SURVEYOR0 survey.c xsurvey.c) +nng_headers_if(NNG_PROTO_SURVEYOR0 nng/protocol/survey0/survey.h) +nng_defines_if(NNG_PROTO_SURVEYOR0 NNG_HAVE_SURVEYOR0) -if (NNG_PROTO_SURVEYOR0) - list(APPEND _DEFS -DNNG_HAVE_SURVEYOR0) - list(APPEND _SRCS - protocol/survey0/survey.c protocol/survey0/xsurvey.c - ${PROJECT_SOURCE_DIR}/include/nng/protocol/survey0/survey.h) - -endif() - -if (NNG_PROTO_RESPONDENT0) - list(APPEND _DEFS -DNNG_HAVE_RESPONDENT0) - list(APPEND _SRCS - protocol/survey0/respond.c protocol/survey0/xrespond.c - ${PROJECT_SOURCE_DIR}/include/nng/protocol/survey0/respond.h) - -endif() - -set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) +nng_sources_if(NNG_PROTO_RESPONDENT0 respond.c xrespond.c) +nng_headers_if(NNG_PROTO_RESPONDENT0 nng/protocol/survey0/respond.h) +nng_defines_if(NNG_PROTO_RESPONDENT0 NNG_HAVE_RESPONDENT0) \ No newline at end of file diff --git a/src/supplemental/tcp/CMakeLists.txt b/src/supplemental/tcp/CMakeLists.txt index 09f917f8..d6b3b531 100644 --- a/src/supplemental/tcp/CMakeLists.txt +++ b/src/supplemental/tcp/CMakeLists.txt @@ -1,5 +1,4 @@ # -# Copyright 2018 Capitar IT Group BV # Copyright 2019 Staysail Systems, Inc. # # This software is supplied under the terms of the MIT License, a @@ -8,6 +7,4 @@ # found online at https://opensource.org/licenses/MIT. # -set(_SRCS supplemental/tcp/tcp.c) - -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) +nng_sources(tcp.c) \ No newline at end of file diff --git a/src/supplemental/util/CMakeLists.txt b/src/supplemental/util/CMakeLists.txt index 64374d69..5a144da9 100644 --- a/src/supplemental/util/CMakeLists.txt +++ b/src/supplemental/util/CMakeLists.txt @@ -1,6 +1,5 @@ # -# Copyright 2018 Capitar IT Group BV -# Copyright 2018 Staysail Systems, Inc. +# Copyright 2019 Staysail Systems, Inc. # # This software is supplied under the terms of the MIT License, a # copy of which should be located in the distribution where this @@ -8,9 +7,5 @@ # found online at https://opensource.org/licenses/MIT. # -set(_SRCS supplemental/util/options.c - ${PROJECT_SOURCE_DIR}/include/nng/supplemental/util/options.h - supplemental/util/platform.c - ${PROJECT_SOURCE_DIR}/include/nng/supplemental/util/platform.h) - -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) +nng_sources(options.c platform.c) +nng_headers(nng/supplemental/util/options.h nng/supplemental/util/platform.h) diff --git a/src/supplemental/websocket/CMakeLists.txt b/src/supplemental/websocket/CMakeLists.txt index 913544dd..74438cd5 100644 --- a/src/supplemental/websocket/CMakeLists.txt +++ b/src/supplemental/websocket/CMakeLists.txt @@ -1,6 +1,6 @@ # +# Copyright 2019 Staysail Systems, Inc. # Copyright 2017 Capitar IT Group BV -# Copyright 2018 Staysail Systems, Inc. # # This software is supplied under the terms of the MIT License, a # copy of which should be located in the distribution where this @@ -9,10 +9,7 @@ # if (NNG_SUPP_WEBSOCKET) - set(_SRCS - supplemental/websocket/websocket.c - supplemental/websocket/websocket.h) + nng_sources(websocket.c websocket.h) else() - set(_SRCS supplemental/websocket/stub.c) + nng_sources(stub.c) endif() -set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) diff --git a/src/transport/inproc/CMakeLists.txt b/src/transport/inproc/CMakeLists.txt index 3249649e..e440fe31 100644 --- a/src/transport/inproc/CMakeLists.txt +++ b/src/transport/inproc/CMakeLists.txt @@ -14,4 +14,4 @@ mark_as_advanced(NNG_TRANSPORT_INPROC) nng_sources_if(NNG_TRANSPORT_INPROC inproc.c) nng_headers_if(NNG_TRANSPORT_INPROC nng/transport/inproc/inproc.h) -nng_defines_if(NNG_TRANSPORT_INPROC NNG_TRANSPORT_INPROC) +nng_defines_if(NNG_TRANSPORT_INPROC NNG_TRANSPORT_INPROC) \ No newline at end of file diff --git a/src/transport/ipc/CMakeLists.txt b/src/transport/ipc/CMakeLists.txt index 0fd31984..7405e765 100644 --- a/src/transport/ipc/CMakeLists.txt +++ b/src/transport/ipc/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. +# Copyright 2019 Staysail Systems, Inc. # Copyright 2018 Capitar IT Group BV # # This software is supplied under the terms of the MIT License, a @@ -12,10 +12,6 @@ option (NNG_TRANSPORT_IPC "Enable IPC transport." ON) mark_as_advanced(NNG_TRANSPORT_IPC) -if (NNG_TRANSPORT_IPC) - set(_DEFS -DNNG_TRANSPORT_IPC) - set(_SRCS transport/ipc/ipc.c ${PROJECT_SOURCE_DIR}/include/nng/transport/ipc/ipc.h) - - set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) - set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) -endif() +nng_sources_if(NNG_TRANSPORT_IPC ipc.c) +nng_headers_if(NNG_TRANSPORT_IPC nng/transport/ipc/ipc.h) +nng_defines_if(NNG_TRANSPORT_IPC NNG_TRANSPORT_IPC) \ No newline at end of file diff --git a/src/transport/tcp/CMakeLists.txt b/src/transport/tcp/CMakeLists.txt index c36584b5..f3daa0a4 100644 --- a/src/transport/tcp/CMakeLists.txt +++ b/src/transport/tcp/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. +# Copyright 2019 Staysail Systems, Inc. # Copyright 2018 Capitar IT Group BV # # This software is supplied under the terms of the MIT License, a @@ -12,10 +12,6 @@ option (NNG_TRANSPORT_TCP "Enable TCP transport." ON) mark_as_advanced(NNG_TRANSPORT_TCP) -if (NNG_TRANSPORT_TCP) - set(_DEFS -DNNG_TRANSPORT_TCP) - set(_SRCS transport/tcp/tcp.c ${PROJECT_SOURCE_DIR}/include/nng/transport/tcp/tcp.h) - - set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) - set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) -endif() +nng_sources_if(NNG_TRANSPORT_TCP tcp.c) +nng_headers_if(NNG_TRANSPORT_TCP nng/transport/tcp/tcp.h) +nng_defines_if(NNG_TRANSPORT_TCP NNG_TRANSPORT_TCP) \ No newline at end of file diff --git a/src/transport/tls/CMakeLists.txt b/src/transport/tls/CMakeLists.txt index 8668ee4a..1603908a 100644 --- a/src/transport/tls/CMakeLists.txt +++ b/src/transport/tls/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright 2018 Staysail Systems, Inc. +# Copyright 2019 Staysail Systems, Inc. # Copyright 2018 Capitar IT Group BV # # This software is supplied under the terms of the MIT License, a @@ -13,10 +13,6 @@ CMAKE_DEPENDENT_OPTION(NNG_TRANSPORT_TLS "Enable TLS transport" ON "NNG_ENABLE_TLS" OFF) mark_as_advanced(NNG_TRANSPORT_TLS) -if (NNG_TRANSPORT_TLS) - set(_DEFS -DNNG_TRANSPORT_TLS) - set(_SRCS transport/tls/tls.c ${PROJECT_SOURCE_DIR}/include/nng/transport/tls/tls.h) - - set(NNG_DEFS ${NNG_DEFS} ${_DEFS} PARENT_SCOPE) - set(NNG_SRCS ${NNG_SRCS} ${_SRCS} PARENT_SCOPE) -endif() +nng_sources_if(NNG_TRANSPORT_TLS tls.c) +nng_headers_if(NNG_TRANSPORT_TLS nng/transport/tls/tls.h) +nng_defines_if(NNG_TRANSPORT_TLS NNG_TRANSPORT_TLS) \ No newline at end of file -- cgit v1.2.3-70-g09d2