mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 12:40:35 +00:00
Merge branch 'protobuf' of https://github.com/carlesfernandez/gnss-sdr into protobuf
This commit is contained in:
commit
6b574fc977
230
CMakeLists.txt
230
CMakeLists.txt
@ -1789,128 +1789,126 @@ endif()
|
||||
################################################################################
|
||||
# Protocol Buffers https://github.com/protocolbuffers/protobuf
|
||||
################################################################################
|
||||
option(ENABLE_PROTOBUF "Enable Protocol Buffers" ON)
|
||||
if(ENABLE_PROTOBUF)
|
||||
set(Protobuf_VERSION "0.0.0")
|
||||
find_package(Protobuf)
|
||||
set_package_properties(Protobuf PROPERTIES
|
||||
URL "https://developers.google.com/protocol-buffers/"
|
||||
DESCRIPTION "A language-neutral, platform-neutral extensible mechanism for serializing structured data"
|
||||
PURPOSE "Used to serialize output data in a way that can be read by other applications."
|
||||
TYPE REQUIRED
|
||||
set(Protobuf_VERSION "0.0.0")
|
||||
find_package(Protobuf)
|
||||
set_package_properties(Protobuf PROPERTIES
|
||||
URL "https://developers.google.com/protocol-buffers/"
|
||||
DESCRIPTION "A language-neutral, platform-neutral extensible mechanism for serializing structured data"
|
||||
PURPOSE "Used to serialize output data in a way that can be read by other applications."
|
||||
TYPE REQUIRED
|
||||
)
|
||||
if(Protobuf_FOUND AND CMAKE_VERSION VERSION_LESS 3.9)
|
||||
add_library(protobuf::libprotobuf SHARED IMPORTED)
|
||||
set_target_properties(protobuf::libprotobuf PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${Protobuf_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${Protobuf_LIBRARY}"
|
||||
)
|
||||
if(Protobuf_FOUND AND CMAKE_VERSION VERSION_LESS 3.9)
|
||||
add_library(protobuf::libprotobuf SHARED IMPORTED)
|
||||
set_target_properties(protobuf::libprotobuf PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${Protobuf_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${Protobuf_LIBRARY}"
|
||||
)
|
||||
add_executable(protobuf::protoc IMPORTED)
|
||||
add_executable(protobuf::protoc IMPORTED)
|
||||
set_target_properties(protobuf::protoc PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${Protobuf_PROTOC_EXECUTABLE}"
|
||||
INTERFACE_LINK_LIBRARIES "${Protobuf_PROTOC_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
if(Protobuf_FOUND AND CMAKE_CROSSCOMPILING)
|
||||
find_program(PROTOC_EXECUTABLE protoc
|
||||
HINTS
|
||||
/usr/local/bin/
|
||||
/usr/bin/
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
if(PROTOC_EXECUTABLE)
|
||||
set_target_properties(protobuf::protoc PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${Protobuf_PROTOC_EXECUTABLE}"
|
||||
INTERFACE_LINK_LIBRARIES "${Protobuf_PROTOC_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
if(Protobuf_FOUND AND CMAKE_CROSSCOMPILING)
|
||||
find_program(PROTOC_EXECUTABLE protoc
|
||||
HINTS
|
||||
/usr/local/bin/
|
||||
/usr/bin/
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
if(PROTOC_EXECUTABLE)
|
||||
set_target_properties(protobuf::protoc PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION ${PROTOC_EXECUTABLE}
|
||||
)
|
||||
else()
|
||||
message(FATAL ERROR "Please install the Protocol Buffers compiter v{${Protobuf_VERSION}} in the host machine")
|
||||
endif()
|
||||
endif()
|
||||
if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION}))
|
||||
unset(Protobuf_PROTOC_EXECUTABLE)
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
if(NOT Protobuf_FOUND)
|
||||
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
|
||||
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
UPDATE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh
|
||||
CONFIGURE_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} --host=$ENV{OECORE_TARGET_ARCH} --with-protoc=${PROTOC_EXECUTABLE}"
|
||||
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
|
||||
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_VERSION VERSION_LESS 3.2)
|
||||
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
|
||||
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
UPDATE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh
|
||||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
|
||||
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
|
||||
)
|
||||
else()
|
||||
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
|
||||
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
UPDATE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh
|
||||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
|
||||
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET protobuf::protoc)
|
||||
add_executable(protobuf::protoc IMPORTED)
|
||||
add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
|
||||
endif()
|
||||
unset(Protobuf_PROTOC_EXECUTABLE)
|
||||
set(PROTOBUF_PROTOC_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc")
|
||||
set_target_properties(protobuf::protoc PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc"
|
||||
INTERFACE_LINK_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protoc${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
)
|
||||
endif()
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include)
|
||||
if(NOT TARGET protobuf::libprotobuf)
|
||||
add_library(protobuf::libprotobuf STATIC IMPORTED)
|
||||
add_dependencies(protobuf::libprotobuf protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
|
||||
endif()
|
||||
set_target_properties(protobuf::libprotobuf PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include"
|
||||
INTERFACE_LINK_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
)
|
||||
|
||||
if(${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION})
|
||||
set_package_properties(Protobuf PROPERTIES
|
||||
PURPOSE "Protocol Buffers found (v${Protobuf_VERSION}) is too old (> v${GNSSSDR_PROTOBUF_MIN_VERSION} needed)."
|
||||
)
|
||||
endif()
|
||||
set_package_properties(Protobuf PROPERTIES
|
||||
PURPOSE "Protocol Buffers v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} will be downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'."
|
||||
IMPORTED_LOCATION ${PROTOC_EXECUTABLE}
|
||||
)
|
||||
else()
|
||||
message(FATAL ERROR "Please install the Protocol Buffers compiter v{${Protobuf_VERSION}} in the host machine")
|
||||
endif()
|
||||
endif()
|
||||
if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION}))
|
||||
unset(Protobuf_PROTOC_EXECUTABLE)
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
if(NOT Protobuf_FOUND)
|
||||
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
|
||||
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
UPDATE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh
|
||||
CONFIGURE_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} --host=$ENV{OECORE_TARGET_ARCH} --with-protoc=${PROTOC_EXECUTABLE}"
|
||||
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
|
||||
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_VERSION VERSION_LESS 3.2)
|
||||
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
|
||||
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
UPDATE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh
|
||||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
|
||||
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
|
||||
)
|
||||
else()
|
||||
ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
|
||||
GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
UPDATE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh
|
||||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
|
||||
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
|
||||
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET protobuf::protoc)
|
||||
add_executable(protobuf::protoc IMPORTED)
|
||||
add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
|
||||
endif()
|
||||
unset(Protobuf_PROTOC_EXECUTABLE)
|
||||
set(PROTOBUF_PROTOC_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc")
|
||||
set_target_properties(protobuf::protoc PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc"
|
||||
INTERFACE_LINK_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protoc${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
)
|
||||
endif()
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include)
|
||||
if(NOT TARGET protobuf::libprotobuf)
|
||||
add_library(protobuf::libprotobuf STATIC IMPORTED)
|
||||
add_dependencies(protobuf::libprotobuf protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
|
||||
endif()
|
||||
set_target_properties(protobuf::libprotobuf PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include"
|
||||
INTERFACE_LINK_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}"
|
||||
)
|
||||
|
||||
if(${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION})
|
||||
set_package_properties(Protobuf PROPERTIES
|
||||
PURPOSE "Protocol Buffers found (v${Protobuf_VERSION}) is too old (> v${GNSSSDR_PROTOBUF_MIN_VERSION} needed)."
|
||||
)
|
||||
endif()
|
||||
set_package_properties(Protobuf PROPERTIES
|
||||
PURPOSE "Protocol Buffers v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} will be downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'."
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -286,6 +286,14 @@ In case the GnuTLS library with openssl extensions package is not available in y
|
||||
|
||||
#### Install [Protocol Buffers](https://developers.google.com/protocol-buffers/ "Protocol Buffers' Homepage"), a portable mechanism for serialization of structured data:
|
||||
|
||||
GNSS-SDR requires Protocol Buffers v3.0.0 or later. If the packages that come with your distribution are older, you will need to install it manually. First, install the dependencies:
|
||||
|
||||
~~~~~~
|
||||
$ sudo apt-get install autoconf automake libtool curl make g++ unzip
|
||||
~~~~~~
|
||||
|
||||
and then:
|
||||
|
||||
~~~~~~
|
||||
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protobuf-cpp-3.7.1.tar.gz
|
||||
$ tar xvfz protobuf-cpp-3.7.1.tar.gz
|
||||
@ -294,6 +302,7 @@ $ ./autogen.sh
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
$ sudo ldconfig
|
||||
~~~~~~
|
||||
|
||||
|
||||
|
@ -741,6 +741,11 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
|
||||
pvt_output_parameters.monitor_enabled = configuration->property(role + ".enable_monitor", false);
|
||||
pvt_output_parameters.udp_addresses = configuration->property(role + ".monitor_client_addresses", std::string("127.0.0.1"));
|
||||
pvt_output_parameters.udp_port = configuration->property(role + ".monitor_udp_port", 1234);
|
||||
pvt_output_parameters.protobuf_enabled = configuration->property(role + ".enable_protobuf", true);
|
||||
if (configuration->property("Monitor.enable_protobuf", false) == true)
|
||||
{
|
||||
pvt_output_parameters.protobuf_enabled = true;
|
||||
}
|
||||
|
||||
// Show time in local zone
|
||||
pvt_output_parameters.show_local_time_zone = configuration->property(role + ".show_local_time_zone", false);
|
||||
|
@ -347,7 +347,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
||||
udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end());
|
||||
|
||||
udp_sink_ptr = std::unique_ptr<Monitor_Pvt_Udp_Sink>(new Monitor_Pvt_Udp_Sink(udp_addr_vec, conf_.udp_port));
|
||||
udp_sink_ptr = std::unique_ptr<Monitor_Pvt_Udp_Sink>(new Monitor_Pvt_Udp_Sink(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <sstream>
|
||||
|
||||
|
||||
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port) : socket{io_service}
|
||||
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_service}
|
||||
{
|
||||
for (const auto& address : addresses)
|
||||
{
|
||||
@ -71,14 +71,18 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, c
|
||||
monitor_pvt.hdop = 0.0;
|
||||
monitor_pvt.vdop = 0.0;
|
||||
|
||||
serdes = Serdes_Monitor_Pvt();
|
||||
use_protobuf = protobuf_enabled;
|
||||
if (use_protobuf)
|
||||
{
|
||||
serdes = Serdes_Monitor_Pvt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt& monitor_pvt, bool protobuf)
|
||||
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt& monitor_pvt)
|
||||
{
|
||||
std::string outbound_data;
|
||||
if (protobuf == false)
|
||||
if (use_protobuf == false)
|
||||
{
|
||||
std::ostringstream archive_stream;
|
||||
boost::archive::binary_oarchive oa{archive_stream};
|
||||
|
@ -39,8 +39,8 @@
|
||||
class Monitor_Pvt_Udp_Sink
|
||||
{
|
||||
public:
|
||||
Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t &port);
|
||||
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt, bool protobuf = false);
|
||||
Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t &port, bool protobuf_enabled);
|
||||
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt);
|
||||
|
||||
private:
|
||||
boost::asio::io_service io_service;
|
||||
@ -49,6 +49,7 @@ private:
|
||||
std::vector<boost::asio::ip::udp::endpoint> endpoints;
|
||||
Monitor_Pvt monitor_pvt;
|
||||
Serdes_Monitor_Pvt serdes;
|
||||
bool use_protobuf;
|
||||
};
|
||||
|
||||
|
||||
|
@ -69,6 +69,7 @@ Pvt_Conf::Pvt_Conf()
|
||||
rtcm_output_file_path = std::string(".");
|
||||
|
||||
monitor_enabled = false;
|
||||
protobuf_enabled = true;
|
||||
udp_port = 0;
|
||||
|
||||
show_local_time_zone = false;
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
std::string rtcm_output_file_path;
|
||||
|
||||
bool monitor_enabled;
|
||||
bool protobuf_enabled;
|
||||
std::string udp_addresses;
|
||||
int udp_port;
|
||||
|
||||
|
@ -41,26 +41,29 @@
|
||||
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
|
||||
int decimation_factor,
|
||||
int udp_port,
|
||||
const std::vector<std::string>& udp_addresses)
|
||||
const std::vector<std::string>& udp_addresses,
|
||||
bool enable_protobuf)
|
||||
{
|
||||
return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels,
|
||||
decimation_factor,
|
||||
udp_port,
|
||||
udp_addresses));
|
||||
udp_addresses,
|
||||
enable_protobuf));
|
||||
}
|
||||
|
||||
|
||||
gnss_synchro_monitor::gnss_synchro_monitor(unsigned int n_channels,
|
||||
int decimation_factor,
|
||||
int udp_port,
|
||||
const std::vector<std::string>& udp_addresses) : gr::sync_block("gnss_synchro_monitor",
|
||||
gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(0, 0, 0))
|
||||
const std::vector<std::string>& udp_addresses,
|
||||
bool enable_protobuf) : gr::sync_block("gnss_synchro_monitor",
|
||||
gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
d_decimation_factor = decimation_factor;
|
||||
d_nchannels = n_channels;
|
||||
|
||||
udp_sink_ptr = std::unique_ptr<Gnss_Synchro_Udp_Sink>(new Gnss_Synchro_Udp_Sink(udp_addresses, udp_port));
|
||||
udp_sink_ptr = std::unique_ptr<Gnss_Synchro_Udp_Sink>(new Gnss_Synchro_Udp_Sink(udp_addresses, udp_port, enable_protobuf));
|
||||
|
||||
count = 0;
|
||||
}
|
||||
|
@ -50,7 +50,8 @@ using gnss_synchro_monitor_sptr = boost::shared_ptr<gnss_synchro_monitor>;
|
||||
gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
|
||||
int decimation_factor,
|
||||
int udp_port,
|
||||
const std::vector<std::string>& udp_addresses);
|
||||
const std::vector<std::string>& udp_addresses,
|
||||
bool enable_protobuf);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a monitoring block which allows sending
|
||||
@ -63,12 +64,14 @@ private:
|
||||
friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
|
||||
int decimation_factor,
|
||||
int udp_port,
|
||||
const std::vector<std::string>& udp_addresses);
|
||||
const std::vector<std::string>& udp_addresses,
|
||||
bool enable_protobuf);
|
||||
|
||||
gnss_synchro_monitor(unsigned int n_channels,
|
||||
int decimation_factor,
|
||||
int udp_port,
|
||||
const std::vector<std::string>& udp_addresses);
|
||||
const std::vector<std::string>& udp_addresses,
|
||||
bool enable_protobuf);
|
||||
|
||||
unsigned int d_nchannels;
|
||||
int d_decimation_factor;
|
||||
|
@ -35,9 +35,13 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port) : socket{io_service}
|
||||
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool enable_protobuf) : socket{io_service}
|
||||
{
|
||||
serdes = Serdes_Gnss_Synchro();
|
||||
use_protobuf = enable_protobuf;
|
||||
if (enable_protobuf)
|
||||
{
|
||||
serdes = Serdes_Gnss_Synchro();
|
||||
}
|
||||
for (const auto& address : addresses)
|
||||
{
|
||||
boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port);
|
||||
@ -46,10 +50,10 @@ Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses,
|
||||
}
|
||||
|
||||
|
||||
bool Gnss_Synchro_Udp_Sink::write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks, bool protocolbuffers)
|
||||
bool Gnss_Synchro_Udp_Sink::write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks)
|
||||
{
|
||||
std::string outbound_data;
|
||||
if (protocolbuffers == false)
|
||||
if (use_protobuf == false)
|
||||
{
|
||||
std::ostringstream archive_stream;
|
||||
boost::archive::binary_oarchive oa{archive_stream};
|
||||
|
@ -48,8 +48,8 @@
|
||||
class Gnss_Synchro_Udp_Sink
|
||||
{
|
||||
public:
|
||||
Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port);
|
||||
bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks, bool protocolbuffers = false);
|
||||
Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool enable_protobuf);
|
||||
bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks);
|
||||
|
||||
private:
|
||||
boost::asio::io_service io_service;
|
||||
@ -58,6 +58,7 @@ private:
|
||||
std::vector<boost::asio::ip::udp::endpoint> endpoints;
|
||||
std::vector<Gnss_Synchro> stocks;
|
||||
Serdes_Gnss_Synchro serdes;
|
||||
bool use_protobuf;
|
||||
};
|
||||
|
||||
|
||||
|
@ -215,7 +215,7 @@ void GNSSFlowgraph::connect()
|
||||
}
|
||||
|
||||
DLOG(INFO) << "blocks connected internally";
|
||||
// Signal Source (i) > Signal conditioner (i) >
|
||||
// Signal Source (i) > Signal conditioner (i) >
|
||||
#ifndef ENABLE_FPGA
|
||||
int RF_Channels = 0;
|
||||
int signal_conditioner_ID = 0;
|
||||
@ -444,20 +444,20 @@ void GNSSFlowgraph::connect()
|
||||
// create a FIR low pass filter
|
||||
std::vector<float> taps;
|
||||
|
||||
// float beta = 7.0;
|
||||
// float halfband = 0.5;
|
||||
// float fractional_bw = 0.4;
|
||||
// float rate = 1.0 / static_cast<float>(decimation);
|
||||
// float beta = 7.0;
|
||||
// float halfband = 0.5;
|
||||
// float fractional_bw = 0.4;
|
||||
// float rate = 1.0 / static_cast<float>(decimation);
|
||||
//
|
||||
// float trans_width = rate * (halfband - fractional_bw);
|
||||
// float mid_transition_band = rate * halfband - trans_width / 2.0;
|
||||
// float trans_width = rate * (halfband - fractional_bw);
|
||||
// float mid_transition_band = rate * halfband - trans_width / 2.0;
|
||||
//
|
||||
// taps = gr::filter::firdes::low_pass(1.0,
|
||||
// 1.0,
|
||||
// mid_transition_band,
|
||||
// trans_width,
|
||||
// gr::filter::firdes::win_type::WIN_KAISER,
|
||||
// beta);
|
||||
// taps = gr::filter::firdes::low_pass(1.0,
|
||||
// 1.0,
|
||||
// mid_transition_band,
|
||||
// trans_width,
|
||||
// gr::filter::firdes::win_type::WIN_KAISER,
|
||||
// beta);
|
||||
|
||||
taps = gr::filter::firdes::low_pass(1.0,
|
||||
fs,
|
||||
@ -526,7 +526,6 @@ void GNSSFlowgraph::connect()
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Signal Source > Signal conditioner >> Channels >> Observables
|
||||
try
|
||||
{
|
||||
@ -556,6 +555,7 @@ void GNSSFlowgraph::connect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Put channels fixed to a given satellite at the beginning of the vector, then the rest
|
||||
std::vector<unsigned int> vector_of_channels;
|
||||
for (unsigned int i = 0; i < channels_count_; i++)
|
||||
@ -1169,7 +1169,6 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
|
||||
}
|
||||
acq_channels_count_++;
|
||||
DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str();
|
||||
|
||||
#ifndef ENABLE_FPGA
|
||||
channels_[ch_index]->start_acquisition();
|
||||
#else
|
||||
@ -1704,7 +1703,11 @@ void GNSSFlowgraph::init()
|
||||
* Instantiate the receiver monitor block, if required
|
||||
*/
|
||||
enable_monitor_ = configuration_->property("Monitor.enable_monitor", false);
|
||||
|
||||
bool enable_protobuf = configuration_->property("Monitor.enable_protobuf", true);
|
||||
if (configuration_->property("PVT.enable_protobuf", false) == true)
|
||||
{
|
||||
enable_protobuf = true;
|
||||
}
|
||||
std::string address_string = configuration_->property("Monitor.client_addresses", std::string("127.0.0.1"));
|
||||
std::vector<std::string> udp_addr_vec = split_string(address_string, '_');
|
||||
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
|
||||
@ -1715,7 +1718,7 @@ void GNSSFlowgraph::init()
|
||||
GnssSynchroMonitor_ = gnss_synchro_make_monitor(channels_count_,
|
||||
configuration_->property("Monitor.decimation_factor", 1),
|
||||
configuration_->property("Monitor.udp_port", 1234),
|
||||
udp_addr_vec);
|
||||
udp_addr_vec, enable_protobuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,7 @@ DECLARE_string(log_dir);
|
||||
#include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/pvt/rtcm_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc"
|
||||
#include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc"
|
||||
#include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc"
|
||||
|
@ -0,0 +1,47 @@
|
||||
/*!
|
||||
* \file serdes_monitor_pvt_test.cc
|
||||
* \brief Implements Unit Test for the serdes_monitor_pvt class.
|
||||
* \author Carles Fernandez_prades, 2019. cfernandez(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "serdes_monitor_pvt.h"
|
||||
|
||||
TEST(Serdes_Monitor_Pvt_Test, Simpletest)
|
||||
{
|
||||
Monitor_Pvt monitor = Monitor_Pvt();
|
||||
double true_latitude = 23.4;
|
||||
monitor.latitude = true_latitude;
|
||||
|
||||
Serdes_Monitor_Pvt serdes = Serdes_Monitor_Pvt();
|
||||
std::string serialized_data = serdes.createProtobuffer(monitor);
|
||||
|
||||
gnss_sdr::MonitorPvt mon;
|
||||
mon.ParseFromString(serialized_data);
|
||||
|
||||
double read_latitude = mon.latitude();
|
||||
EXPECT_NEAR(true_latitude, read_latitude, 0.000001);
|
||||
}
|
Loading…
Reference in New Issue
Block a user