Fixes for building against GNU Radio master

Log4cpp has been replaced by spdlog
This commit is contained in:
Carles Fernandez 2021-11-23 13:30:48 +01:00
parent c2a23dd372
commit cc38d6bc08
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 32 additions and 9 deletions

View File

@ -609,13 +609,12 @@ endif()
################################################################################
# Log4cpp - http://log4cpp.sourceforge.net/
################################################################################
find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
if(NOT LOG4CPP_FOUND)
message(FATAL_ERROR "*** Log4cpp is required to build gnss-sdr")
if(GNURADIO_USES_LOG4CPP)
find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES
PURPOSE "Required by GNU Radio."
TYPE OPTIONAL
)
endif()

View File

@ -392,6 +392,23 @@ if(GNURADIO_PMT_INCLUDE_DIRS)
endif()
endif()
# Check if GNU Radio uses log4cpp or spdlog
if(GNURADIO_RUNTIME_INCLUDE_DIRS)
if(EXISTS "${GNURADIO_RUNTIME_INCLUDE_DIRS}/gnuradio/logger.h")
file(STRINGS ${GNURADIO_RUNTIME_INCLUDE_DIRS}/gnuradio/logger.h _logger_content)
set(_uses_log4cpp FALSE)
foreach(_loop_var IN LISTS _logger_content)
string(STRIP "${_loop_var}" _file_line)
if("#include <log4cpp/Category.hh>" STREQUAL "${_file_line}")
set(_uses_log4cpp TRUE)
endif()
endforeach()
if(${_uses_log4cpp})
set(GNURADIO_USES_LOG4CPP TRUE)
endif()
endif()
endif()
set_package_properties(GNURADIO PROPERTIES
URL "https://www.gnuradio.org/"
)

View File

@ -46,9 +46,15 @@ target_link_libraries(input_filter_gr_blocks
algorithms_libs
PRIVATE
Volk::volk
Log4cpp::log4cpp
)
if(LOG4CPP_FOUND)
target_link_libraries(input_filter_gr_blocks
PRIVATE
Log4cpp::log4cpp
)
endif()
target_include_directories(input_filter_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/core/interfaces

View File

@ -21,12 +21,12 @@
#include "INIReader.h"
#include "command_event.h"
#include "gnss_sdr_make_unique.h"
#include <boost/any.hpp>
#include <gnuradio/io_signature.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <exception>
#include <iomanip>
#include <iostream>
#include <memory>
#include <sstream>

View File

@ -53,6 +53,7 @@
#include <algorithm>
#include <array>
#include <fstream>
#include <iomanip>
#include <map>
#include <set>
#include <stdexcept>