1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-02-23 22:40:07 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2019-05-26 21:12:21 +02:00
commit d4f20a165e
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
14 changed files with 153 additions and 43 deletions

View File

@ -690,6 +690,17 @@ if(CMAKE_VERSION VERSION_LESS 3.5)
endif()
endif()
# Fix for Boost Asio < 1.70 when using Clang in macOS
if(${Boost_VERSION} VERSION_LESS 107000)
# Check if we have std::string_view
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <string_view>
int main()
{ std::string_view sv; }"
has_string_view
)
endif()
################################################################################

View File

@ -35,6 +35,22 @@ find_path(IIO_INCLUDE_DIRS
$ENV{GRIIO_ROOT}/include
)
if(IIO_INCLUDE_DIRS)
set(GR_IIO_INCLUDE_HAS_GNURADIO TRUE)
else()
find_path(IIO_INCLUDE_DIRS
NAMES iio/api.h
HINTS $ENV{IIO_DIR}/include
${PC_IIO_INCLUDEDIR}
PATHS ${CMAKE_INSTALL_PREFIX}/include
/usr/local/include
/usr/include
${GRIIO_ROOT}/include
$ENV{GRIIO_ROOT}/include
)
set(GR_IIO_INCLUDE_HAS_GNURADIO FALSE)
endif()
find_library(IIO_LIBRARIES
NAMES gnuradio-iio
HINTS $ENV{IIO_DIR}/lib
@ -86,4 +102,4 @@ if(GRIIO_FOUND AND NOT TARGET Gnuradio::iio)
)
endif()
mark_as_advanced(IIO_LIBRARIES IIO_INCLUDE_DIRS)
mark_as_advanced(IIO_LIBRARIES IIO_INCLUDE_DIRS GR_IIO_INCLUDE_HAS_GNURADIO)

View File

@ -76,6 +76,12 @@ find_library(
$ENV{LIBIIO_ROOT}/lib64
)
if(LIBIIO_LIBRARIES AND APPLE)
if(LIBIIO_LIBRARIES MATCHES "framework")
set(LIBIIO_LIBRARIES ${LIBIIO_LIBRARIES}/iio)
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBIIO DEFAULT_MSG LIBIIO_LIBRARIES LIBIIO_INCLUDE_DIRS)

View File

@ -94,12 +94,20 @@ if(Boost_VERSION VERSION_GREATER "106599")
)
endif()
# Fix for Boost Asio < 1.70
if(OS_IS_MACOSX)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_definitions(pvt_libs
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW
)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (${Boost_VERSION} VERSION_LESS 107000))
if(${has_string_view})
target_compile_definitions(pvt_libs
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW=1
)
else()
target_compile_definitions(pvt_libs
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW=0
)
endif()
endif()
endif()

View File

@ -20,3 +20,32 @@ get_filename_component(VOLK_GNSSSDR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(NOT TARGET VolkGnsssdr::volkgnsssdr)
include("${VOLK_GNSSSDR_CMAKE_DIR}/VolkGnsssdrTargets.cmake")
endif()
# set VOLKGNSSSDR_FOUND to be set globally, for whether a compatible Volk GNSS-SDR
# was found -- could be a correct enough version or any version depending
# on how find_package was called.
if(NOT TARGET Volkgnsssdr::volkgnsssdr)
set(VOLKGNSSSDR_FOUND FALSE)
else()
set(VOLKGNSSSDR_FOUND TRUE)
endif()
# cache whether a compatible VolkGnsssdr was found for
# use anywhere in the calling project
set(VOLKGNSSSDR_FOUND ${VOLKGNSSSDR_FOUND} CACHE BOOL "Whether a compatible Volk GNSS-SDR was found" FORCE)
if(VOLKGNSSSDR_FOUND)
# use the new target library, regardless of whether new or old style
# we still need to set a variable with the library name so that there
# is a variable to reference in the using-project's cmake scripts!
set(VOLK_GNSSSDR_LIBRARIES Volkgnsssdr::volkgnsssdr CACHE STRING "Volk GNSS-SDR Library" FORCE)
# INTERFACE_INCLUDE_DIRECTORIES should always be set
get_target_property(VOLK_GNSSSDR_INCLUDE_DIRS Volkgnsssdr::volkgnsssdr INTERFACE_INCLUDE_DIRECTORIES)
set(VOLK_GNSSSDR_INCLUDE_DIRS ${VOLK_GNSSSDR_INCLUDE_DIRS} CACHE STRING "Volk GNSS-SDR Include Directories" FORCE)
# for backward compatibility with old-CMake non-target project finding
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VOLKGNSSSDR DEFAULT_MSG VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS)
mark_as_advanced(VOLK_GNSSSDR_LIBRARIES VOLK_GNSSSDR_INCLUDE_DIRS)
endif()

View File

@ -32,24 +32,18 @@
#include <vector> // for vector
float uniform()
template <typename T>
void random_values(T *buf, unsigned int n, std::default_random_engine &e1)
{
std::random_device r;
std::default_random_engine e1(r());
std::uniform_real_distribution<float> uniform_dist(-1, 1);
return uniform_dist(e1); // uniformly (-1, 1)
}
template <class t>
void random_floats(t *buf, unsigned n)
{
for (unsigned i = 0; i < n; i++)
buf[i] = uniform();
std::uniform_real_distribution<T> uniform_dist(T(-1), T(1));
for (unsigned int i = 0; i < n; i++)
buf[i] = uniform_dist(e1);
}
void load_random_data(void *data, volk_gnsssdr_type_t type, unsigned int n)
{
std::random_device r;
std::default_random_engine e1(r());
std::default_random_engine e2(r());
if (type.is_complex) n *= 2;
@ -57,9 +51,9 @@ void load_random_data(void *data, volk_gnsssdr_type_t type, unsigned int n)
if (type.is_float)
{
if (type.size == 8)
random_floats<double>((double *)data, n);
random_values<double>((double *)data, n, e1);
else
random_floats<float>((float *)data, n);
random_values<float>((float *)data, n, e1);
}
else
{

View File

@ -124,9 +124,6 @@ public:
************************************************/
volk_gnsssdr_type_t volk_gnsssdr_type_from_string(std::string);
float uniform(void);
void random_floats(float *buf, unsigned n);
bool run_volk_gnsssdr_tests(
volk_gnsssdr_func_desc_t,
void (*)(),

View File

@ -238,6 +238,14 @@ target_compile_definitions(signal_source_adapters
PRIVATE -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}"
)
if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
if(GR_IIO_INCLUDE_HAS_GNURADIO)
target_compile_definitions(signal_source_adapters
PUBLIC -DGRIIO_INCLUDE_HAS_GNURADIO=1
)
endif()
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(signal_source_adapters

View File

@ -36,7 +36,11 @@
#include "gnss_block_interface.h"
#include <boost/shared_ptr.hpp>
#include <gnuradio/blocks/file_sink.h>
#if GRIIO_INCLUDE_HAS_GNURADIO
#include <gnuradio/iio/fmcomms2_source.h>
#else
#include <iio/fmcomms2_source.h>
#endif
#include <gnuradio/msg_queue.h>
#include <string>

View File

@ -35,7 +35,11 @@
#include "gnss_block_interface.h"
#include <boost/shared_ptr.hpp>
#include <gnuradio/blocks/file_sink.h>
#if GRIIO_INCLUDE_HAS_GNURADIO
#include <gnuradio/iio/pluto_source.h>
#else
#include <iio/pluto_source.h>
#endif
#include <gnuradio/msg_queue.h>
#include <string>

View File

@ -76,12 +76,20 @@ if(ENABLE_RAW_UDP AND PCAP_FOUND)
)
endif()
# Fix for Boost Asio < 1.70
if(OS_IS_MACOSX)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_definitions(signal_source_gr_blocks
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW
)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (${Boost_VERSION} VERSION_LESS 107000))
if(${has_string_view})
target_compile_definitions(signal_source_gr_blocks
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW=1
)
else()
target_compile_definitions(signal_source_gr_blocks
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW=0
)
endif()
endif()
endif()

View File

@ -100,12 +100,20 @@ if(Boost_VERSION VERSION_GREATER "106599")
)
endif()
# Fix for Boost Asio < 1.70
if(OS_IS_MACOSX)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_definitions(tracking_libs
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW
)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (${Boost_VERSION} VERSION_LESS 107000))
if(${has_string_view})
target_compile_definitions(tracking_libs
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW=1
)
else()
target_compile_definitions(tracking_libs
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW=0
)
endif()
endif()
endif()

View File

@ -68,15 +68,24 @@ if(Boost_VERSION VERSION_GREATER "106599")
endif()
# Fix for Boost Asio < 1.70
if(OS_IS_MACOSX)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_definitions(core_monitor
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW
)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (${Boost_VERSION} VERSION_LESS 107000))
if(${has_string_view})
target_compile_definitions(core_monitor
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW=1
)
else()
target_compile_definitions(core_monitor
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW=0
)
endif()
endif()
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(core_monitor

View File

@ -162,12 +162,20 @@ target_link_libraries(core_receiver
pvt_adapters
)
# Fix for Boost Asio < 1.70
if(OS_IS_MACOSX)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_definitions(core_receiver
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW
)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (${Boost_VERSION} VERSION_LESS 107000))
if(${has_string_view})
target_compile_definitions(core_receiver
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW=1
)
else()
target_compile_definitions(core_receiver
PUBLIC
-DBOOST_ASIO_HAS_STD_STRING_VIEW=0
)
endif()
endif()
endif()