From 6276d3b3315db73a10c69b08123b62b3e1817c8b Mon Sep 17 00:00:00 2001 From: Jim Melton Date: Fri, 27 Jan 2023 12:01:31 -0700 Subject: [PATCH 1/3] do not propagate tags --- src/algorithms/signal_source/adapters/zmq_signal_source.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algorithms/signal_source/adapters/zmq_signal_source.cc b/src/algorithms/signal_source/adapters/zmq_signal_source.cc index 5d51434ff..56456b2ef 100644 --- a/src/algorithms/signal_source/adapters/zmq_signal_source.cc +++ b/src/algorithms/signal_source/adapters/zmq_signal_source.cc @@ -44,6 +44,7 @@ ZmqSignalSource::ZmqSignalSource(const ConfigurationInterface* configuration, LOG(INFO) << "Connecting to ZMQ pub at " << endpoint; // work around gnuradio interface deficiency d_source_block = gr::zeromq::sub_source::make(d_item_size, vlen, const_cast(endpoint.data()), timeout_ms, pass_tags, hwm); + d_source_block->set_tag_propagation_policy(TPP_DONT); // GNSS-SDR doesn't do well with tags/ } else { From d644f7aba84fa02f146282fa79a4f04c2d5a3421 Mon Sep 17 00:00:00 2001 From: Jim Melton Date: Fri, 27 Jan 2023 13:30:32 -0700 Subject: [PATCH 2/3] make sure your changes are compiled --- CMakeLists.txt | 2 +- src/algorithms/signal_source/adapters/zmq_signal_source.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9c8f1465..f297fd7fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Tele option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF) -option(ENABLE_ZMQ "Enable GNU Radio ZeroMQ Messaging, requires gr-zeromq" OFF) +option(ENABLE_ZMQ "Enable GNU Radio ZeroMQ Messaging, requires gr-zeromq" ON) # Performance analysis tools option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) diff --git a/src/algorithms/signal_source/adapters/zmq_signal_source.cc b/src/algorithms/signal_source/adapters/zmq_signal_source.cc index 56456b2ef..48f8a9602 100644 --- a/src/algorithms/signal_source/adapters/zmq_signal_source.cc +++ b/src/algorithms/signal_source/adapters/zmq_signal_source.cc @@ -44,7 +44,7 @@ ZmqSignalSource::ZmqSignalSource(const ConfigurationInterface* configuration, LOG(INFO) << "Connecting to ZMQ pub at " << endpoint; // work around gnuradio interface deficiency d_source_block = gr::zeromq::sub_source::make(d_item_size, vlen, const_cast(endpoint.data()), timeout_ms, pass_tags, hwm); - d_source_block->set_tag_propagation_policy(TPP_DONT); // GNSS-SDR doesn't do well with tags/ + d_source_block->set_tag_propagation_policy(gr::block::TPP_DONT); // GNSS-SDR doesn't do well with tags/ } else { From d3506777726371f8fa52bb4586dfcb44859ace74 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 30 Jan 2023 09:15:43 +0100 Subject: [PATCH 3/3] Do not fail if gr-zeromq is not present. Make CI jobs happy. --- CMakeLists.txt | 11 ++- cmake/Modules/FindZEROMQ.cmake | 82 +++++++++++++++++++ .../adapters/zmq_signal_source.cc | 8 +- 3 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 cmake/Modules/FindZEROMQ.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f297fd7fe..2222702cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -613,8 +613,17 @@ if(ENABLE_UHD) endif() endif() +find_package(ZEROMQ) +set_package_properties(ZEROMQ PROPERTIES + PURPOSE "Used by the ZMQ_Signal_Source." + TYPE OPTIONAL +) if(ENABLE_ZMQ) - list(APPEND GR_REQUIRED_COMPONENTS ZEROMQ) + if(NOT ZEROMQ_FOUND) + set(ENABLE_ZMQ OFF) + else() + list(APPEND GR_REQUIRED_COMPONENTS ZEROMQ) + endif() endif() find_package(GNURADIO) diff --git a/cmake/Modules/FindZEROMQ.cmake b/cmake/Modules/FindZEROMQ.cmake new file mode 100644 index 000000000..0ef937139 --- /dev/null +++ b/cmake/Modules/FindZEROMQ.cmake @@ -0,0 +1,82 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2023 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +# +# Provides the following imported target: +# ZeroMQ::ZeroMQ +# + +if(NOT COMMAND feature_summary) + include(FeatureSummary) +endif() + +if(NOT PKG_CONFIG_FOUND) + include(FindPkgConfig) +endif() + +find_package(PkgConfig) +pkg_check_modules(PC_ZEROMQ "libzmq") + +find_path(ZEROMQ_INCLUDE_DIRS + NAMES zmq.hpp + HINTS ${PC_ZEROMQ_INCLUDE_DIR} ${CMAKE_INSTALL_PREFIX}/include + PATHS /usr/local/include /usr/include /opt/local/include +) + +find_library(ZEROMQ_LIBRARIES + NAMES zmq libzmq.so.5 ${ZEROMQ_LIBRARY_NAME} + HINTS ${PC_ZEROMQ_LIBDIR} ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 + PATHS /usr/lib + /usr/lib64 + /usr/lib/alpha-linux-gnu + /usr/lib/x86_64-linux-gnu + /usr/lib/aarch64-linux-gnu + /usr/lib/arm-linux-gnueabi + /usr/lib/arm-linux-gnueabihf + /usr/lib/hppa-linux-gnu + /usr/lib/i386-linux-gnu + /usr/lib/m68k-linux-gnu + /usr/lib/mips-linux-gnu + /usr/lib/mips64el-linux-gnuabi64 + /usr/lib/mipsel-linux-gnu + /usr/lib/powerpc-linux-gnuspe + /usr/lib/powerpc64-linux-gnu + /usr/lib/powerpc64le-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/s390x-linux-gnu + /usr/lib/sh4-linux-gnu + /usr/lib/sparc64-linux-gnu + /usr/lib/x86_64-linux-gnux32 + /usr/lib/x86_64-kfreebsd-gnu + /usr/lib/i386-kfreebsd-gnu + /usr/local/lib + /usr/local/lib64 + /opt/local/lib +) + +include(FindPackageHandleStandardArgs) +# This is just to detect presence, include files not required +find_package_handle_standard_args(ZEROMQ DEFAULT_MSG ZEROMQ_LIBRARIES) +mark_as_advanced(ZEROMQ_LIBRARIES ZEROMQ_INCLUDE_DIRS) + +set_package_properties(ZEROMQ PROPERTIES URL "https://zeromq.org/") +if(PC_ZEROMQ_VERSION) + set_package_properties(ZEROMQ PROPERTIES + DESCRIPTION "An open-source universal messaging library (found: v${PC_ZEROMQ_VERSION})" + ) +else() + set_package_properties(ZEROMQ PROPERTIES + DESCRIPTION "An open-source universal messaging library" + ) +endif() + +if(ZEROMQ_FOUND AND ZEROMQ_INCLUDE_DIRS AND NOT TARGET ZeroMQ::ZeroMQ) + add_library(ZeroMQ::ZeroMQ INTERFACE IMPORTED) + set_target_properties(ZeroMQ::ZeroMQ PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${ZEROMQ_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${ZEROMQ_LIBRARIES}" + ) +endif() \ No newline at end of file diff --git a/src/algorithms/signal_source/adapters/zmq_signal_source.cc b/src/algorithms/signal_source/adapters/zmq_signal_source.cc index 48f8a9602..7a6370000 100644 --- a/src/algorithms/signal_source/adapters/zmq_signal_source.cc +++ b/src/algorithms/signal_source/adapters/zmq_signal_source.cc @@ -95,9 +95,13 @@ auto ZmqSignalSource::get_right_block() -> gr::basic_block_sptr auto result = gr::basic_block_sptr(); if (d_vec_block) - result = d_vec_block; // NOLINT + { + result = d_vec_block; + } else - result = d_source_block; // NOLINT + { + result = d_source_block; + } return result; }