From 182b87c0228ab95c2930e4dd6a4c84980e966099 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 26 Aug 2022 09:43:11 +0200 Subject: [PATCH] Make use of std::lcm instead of Boost when possible --- src/algorithms/PVT/adapters/CMakeLists.txt | 11 +++++++++-- src/algorithms/PVT/adapters/rtklib_pvt.cc | 5 +++++ src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt | 11 +++++++++-- src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 5 +++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/algorithms/PVT/adapters/CMakeLists.txt b/src/algorithms/PVT/adapters/CMakeLists.txt index 6b9ff33e6..658e493ac 100644 --- a/src/algorithms/PVT/adapters/CMakeLists.txt +++ b/src/algorithms/PVT/adapters/CMakeLists.txt @@ -32,11 +32,18 @@ target_include_directories(pvt_adapters ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) -if(USE_OLD_BOOST_MATH_COMMON_FACTOR) +if((NOT (CMAKE_VERSION VERSION_LESS "3.1")) AND NOT (CMAKE_CXX_STANDARD VERSION_LESS 17)) target_compile_definitions(pvt_adapters PRIVATE - -DUSE_OLD_BOOST_MATH_COMMON_FACTOR=1 + -DUSE_STD_COMMON_FACTOR=1 ) +else() + if(USE_OLD_BOOST_MATH_COMMON_FACTOR) + target_compile_definitions(pvt_adapters + PRIVATE + -DUSE_OLD_BOOST_MATH_COMMON_FACTOR=1 + ) + endif() endif() if(ENABLE_CLANG_TIDY) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index aef8a6e58..ccc6bcfac 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -28,6 +28,10 @@ #include "rtklib_rtkpos.h" // for rtkfree, rtkinit #include // for LOG #include // for std::cout +#if USE_STD_COMMON_FACTOR +#include +namespace bc = std; +#else #if USE_OLD_BOOST_MATH_COMMON_FACTOR #include namespace bc = boost::math; @@ -35,6 +39,7 @@ namespace bc = boost::math; #include namespace bc = boost::integer; #endif +#endif using namespace std::string_literals; diff --git a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt index 3cfae32f6..ae1b728bf 100644 --- a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt @@ -74,11 +74,18 @@ if(ENABLE_CLANG_TIDY) endif() endif() -if(USE_OLD_BOOST_MATH_COMMON_FACTOR) +if((NOT (CMAKE_VERSION VERSION_LESS "3.1")) AND NOT (CMAKE_CXX_STANDARD VERSION_LESS 17)) target_compile_definitions(pvt_gr_blocks PRIVATE - -DUSE_OLD_BOOST_MATH_COMMON_FACTOR=1 + -DUSE_STD_COMMON_FACTOR=1 ) +else() + if(USE_OLD_BOOST_MATH_COMMON_FACTOR) + target_compile_definitions(pvt_gr_blocks + PRIVATE + -DUSE_OLD_BOOST_MATH_COMMON_FACTOR=1 + ) + endif() endif() if(USE_BOOST_BIND_PLACEHOLDERS) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index a12949e0f..b4c87afd9 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -86,6 +86,10 @@ #include #endif +#if USE_STD_COMMON_FACTOR +#include +namespace bc = std; +#else #if USE_OLD_BOOST_MATH_COMMON_FACTOR #include namespace bc = boost::math; @@ -93,6 +97,7 @@ namespace bc = boost::math; #include namespace bc = boost::integer; #endif +#endif #if PMT_USES_BOOST_ANY #include