Merge branch 'jwmelto-tags' into next

This commit is contained in:
Carles Fernandez 2023-01-30 09:17:22 +01:00
commit 0d60e46390
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 100 additions and 4 deletions

View File

@ -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)
@ -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)

View File

@ -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()

View File

@ -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<char*>(endpoint.data()), timeout_ms, pass_tags, hwm);
d_source_block->set_tag_propagation_policy(gr::block::TPP_DONT); // GNSS-SDR doesn't do well with tags/
}
else
{
@ -94,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;
}