From f73862b500a3a8b21cf8865418fb3f42d18b183c Mon Sep 17 00:00:00 2001 From: Bastian Bloessl Date: Fri, 16 Dec 2016 09:37:52 +0100 Subject: [PATCH] add UHD compile switches --- CMakeLists.txt | 8 +++++++- lib/packet_pad2.cc | 4 ++++ lib/packet_pad_impl.cc | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b43f4eb..8caa947 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,13 @@ endif() find_package(UHD) if(NOT UHD_FOUND) - message(FATAL_ERROR "UHD library not found.") + message(STATUS "UHD library not found, no support for timed TX.") + set(UHD_INCLUDE_DIRS "") + set(UHD_LIBRARY_DIRS "") + set(UHD_LIBRARIES "") +else() + message(STATUS "UHD library found.") + add_definitions(-DFOO_UHD) endif() ######################################################################## diff --git a/lib/packet_pad2.cc b/lib/packet_pad2.cc index c2887b0..4d3fd2e 100644 --- a/lib/packet_pad2.cc +++ b/lib/packet_pad2.cc @@ -18,7 +18,9 @@ #include #include +#ifdef FOO_UHD #include +#endif using namespace gr::foo; @@ -60,6 +62,7 @@ int work (int noutput_items, gr_vector_int& ninput_items, int produced = ninput_items[0] + d_pad_front + d_pad_tail; const pmt::pmt_t src = pmt::string_to_symbol(alias()); + #ifdef FOO_UHD if(d_delay) { static const pmt::pmt_t time_key = pmt::string_to_symbol("tx_time"); struct timeval t; @@ -73,6 +76,7 @@ int work (int noutput_items, gr_vector_int& ninput_items, ); add_item_tag(0, nitems_written(0), time_key, time_value, src); } + #endif std::vector tags; get_tags_in_range(tags, 0, nitems_read(0), nitems_read(0) + ninput_items[0]); diff --git a/lib/packet_pad_impl.cc b/lib/packet_pad_impl.cc index c0fc3c4..f26b426 100644 --- a/lib/packet_pad_impl.cc +++ b/lib/packet_pad_impl.cc @@ -19,7 +19,9 @@ #include #include #include +#ifdef FOO_UHD #include +#endif using namespace gr::foo; @@ -53,6 +55,7 @@ packet_pad_impl::add_sob(uint64_t item) { static const pmt::pmt_t srcid = pmt::string_to_symbol(alias()); add_item_tag(0, item, sob_key, value, srcid); + #ifdef FOO_UHD if(d_delay) { static const pmt::pmt_t time_key = pmt::string_to_symbol("tx_time"); struct timeval t; @@ -66,6 +69,7 @@ packet_pad_impl::add_sob(uint64_t item) { ); add_item_tag(0, item, time_key, time_value, srcid); } + #endif } void