From c87ac1ba320ba64b2d39d8d1fd34f2ecc2139859 Mon Sep 17 00:00:00 2001 From: Alexander Chemeris Date: Thu, 31 Oct 2019 18:13:32 +0300 Subject: [PATCH] Detect uhd/utils/thread_priority.hpp deprecation --- host/CMakeLists.txt | 7 +++++++ host/umtrx_io_impl.cpp | 6 +++++- host/utils/umtrx_pa_ctrl.cpp | 1 - host/utils/umtrx_test_chains.cpp | 6 +++++- host/utils/umtrx_test_gains.cpp | 1 - host/utils/usrp_cal_utils.hpp | 6 +++++- 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 81adc045..fa97a6f1 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -84,6 +84,13 @@ else() message(STATUS " use log.hpp for logging") endif() +if (EXISTS "${UHD_INCLUDE_DIRS}/uhd/utils/thread.hpp") + add_definitions(-DTHREAD_PRIORITY_HPP_DEPRECATED) + message(STATUS " use thread.hpp (new interface)") +else() + message(STATUS " use thread_priority.hpp (old interface)") +endif() + ######################################################################## # Setup Boost ######################################################################## diff --git a/host/umtrx_io_impl.cpp b/host/umtrx_io_impl.cpp index c950aab8..974896da 100644 --- a/host/umtrx_io_impl.cpp +++ b/host/umtrx_io_impl.cpp @@ -27,7 +27,11 @@ #include #include #include -#include +#ifdef THREAD_PRIORITY_HPP_DEPRECATED +# include +#else // THREAD_PRIORITY_HPP_DEPRECATED +# include +#endif // THREAD_PRIORITY_HPP_DEPRECATED //A reasonable number of frames for send/recv and async/sync static const size_t DEFAULT_NUM_FRAMES = 32; diff --git a/host/utils/umtrx_pa_ctrl.cpp b/host/utils/umtrx_pa_ctrl.cpp index 3317f696..7630886c 100644 --- a/host/utils/umtrx_pa_ctrl.cpp +++ b/host/utils/umtrx_pa_ctrl.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see . // -#include #include #include #include diff --git a/host/utils/umtrx_test_chains.cpp b/host/utils/umtrx_test_chains.cpp index 7ea513a3..76b8857f 100644 --- a/host/utils/umtrx_test_chains.cpp +++ b/host/utils/umtrx_test_chains.cpp @@ -15,7 +15,11 @@ // along with this program. If not, see . // -#include +#ifdef THREAD_PRIORITY_HPP_DEPRECATED +# include +#else // THREAD_PRIORITY_HPP_DEPRECATED +# include +#endif // THREAD_PRIORITY_HPP_DEPRECATED #include #include #include diff --git a/host/utils/umtrx_test_gains.cpp b/host/utils/umtrx_test_gains.cpp index 19aa7e32..5d46c359 100644 --- a/host/utils/umtrx_test_gains.cpp +++ b/host/utils/umtrx_test_gains.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see . // -#include #include #include #include diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp index e3507c26..726e3cbc 100644 --- a/host/utils/usrp_cal_utils.hpp +++ b/host/utils/usrp_cal_utils.hpp @@ -16,7 +16,11 @@ // #include -#include +#ifdef THREAD_PRIORITY_HPP_DEPRECATED +# include +#else // THREAD_PRIORITY_HPP_DEPRECATED +# include +#endif // THREAD_PRIORITY_HPP_DEPRECATED #include #include "umtrx_log_adapter.hpp" #include