summaryrefslogtreecommitdiff
path: root/gr-uhd
diff options
context:
space:
mode:
Diffstat (limited to 'gr-uhd')
-rw-r--r--gr-uhd/lib/CMakeLists.txt3
-rw-r--r--gr-uhd/lib/Makefile.am5
-rw-r--r--gr-uhd/lib/gr_uhd_amsg_source.cc4
-rw-r--r--gr-uhd/lib/gr_uhd_common.h42
-rw-r--r--gr-uhd/lib/gr_uhd_usrp_sink.cc4
-rw-r--r--gr-uhd/lib/gr_uhd_usrp_source.cc2
6 files changed, 55 insertions, 5 deletions
diff --git a/gr-uhd/lib/CMakeLists.txt b/gr-uhd/lib/CMakeLists.txt
index 432ed1ab6..1f44b0630 100644
--- a/gr-uhd/lib/CMakeLists.txt
+++ b/gr-uhd/lib/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011-2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -23,6 +23,7 @@
include_directories(
${GNURADIO_CORE_INCLUDE_DIRS}
${GR_UHD_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
)
include_directories(${UHD_INCLUDE_DIRS})
diff --git a/gr-uhd/lib/Makefile.am b/gr-uhd/lib/Makefile.am
index c322c6124..41ce79d87 100644
--- a/gr-uhd/lib/Makefile.am
+++ b/gr-uhd/lib/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2010-2011 Free Software Foundation, Inc.
+# Copyright 2010-2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -25,6 +25,7 @@ AM_CPPFLAGS = \
$(STD_DEFINES_AND_INCLUDES) \
$(WITH_INCLUDES) \
$(UHD_CPPFLAGS) \
+ -I$(srcdir) \
-Dgnuradio_uhd_EXPORTS
lib_LTLIBRARIES = libgnuradio-uhd.la
@@ -40,4 +41,4 @@ libgnuradio_uhd_la_LIBADD = \
libgnuradio_uhd_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
-noinst_HEADERS =
+noinst_HEADERS = gr_uhd_common.h
diff --git a/gr-uhd/lib/gr_uhd_amsg_source.cc b/gr-uhd/lib/gr_uhd_amsg_source.cc
index 08941584b..67e402f6b 100644
--- a/gr-uhd/lib/gr_uhd_amsg_source.cc
+++ b/gr-uhd/lib/gr_uhd_amsg_source.cc
@@ -1,5 +1,5 @@
/*
- * Copyright 2011 Free Software Foundation, Inc.
+ * Copyright 2011-2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,6 +22,7 @@
#include <gr_uhd_amsg_source.h>
#include <boost/bind.hpp>
#include <gruel/thread.h>
+#include "gr_uhd_common.h"
/***********************************************************************
* UHD Asynchronous Message Source Impl
@@ -87,6 +88,7 @@ boost::shared_ptr<uhd_amsg_source> uhd_make_amsg_source(
const uhd::device_addr_t &device_addr,
gr_msg_queue_sptr msgq
){
+ gr_uhd_check_abi();
return boost::shared_ptr<uhd_amsg_source>(
new uhd_amsg_source_impl(device_addr, msgq)
);
diff --git a/gr-uhd/lib/gr_uhd_common.h b/gr-uhd/lib/gr_uhd_common.h
new file mode 100644
index 000000000..940f17692
--- /dev/null
+++ b/gr-uhd/lib/gr_uhd_common.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_UHD_COMMON_H
+#define INCLUDED_GR_UHD_COMMON_H
+
+#include <uhd/version.hpp>
+#include <boost/format.hpp>
+#include <stdexcept>
+
+static inline void gr_uhd_check_abi(void){
+ #ifdef UHD_VERSION_ABI_STRING
+ if (std::string(UHD_VERSION_ABI_STRING) == uhd::get_abi_string()) return;
+ throw std::runtime_error(str(boost::format(
+ "\nGR-UHD detected ABI compatibility mismatch with UHD library.\n"
+ "GR-UHD was build against ABI: %s,\n"
+ "but UHD library reports ABI: %s\n"
+ "Suggestion: install an ABI compatible version of UHD,\n"
+ "or rebuild GR-UHD component against this ABI version.\n"
+ ) % UHD_VERSION_ABI_STRING % uhd::get_abi_string()));
+ #endif
+}
+
+#endif /* INCLUDED_GR_UHD_COMMON_H */
diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc
index 5d8d235a1..ab5c771c7 100644
--- a/gr-uhd/lib/gr_uhd_usrp_sink.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2011 Free Software Foundation, Inc.
+ * Copyright 2010-2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,6 +23,7 @@
#include <gr_io_signature.h>
#include <stdexcept>
#include <boost/make_shared.hpp>
+#include "gr_uhd_common.h"
static const pmt::pmt_t SOB_KEY = pmt::pmt_string_to_symbol("tx_sob");
static const pmt::pmt_t EOB_KEY = pmt::pmt_string_to_symbol("tx_eob");
@@ -474,6 +475,7 @@ boost::shared_ptr<uhd_usrp_sink> uhd_make_usrp_sink(
const uhd::device_addr_t &device_addr,
const uhd::stream_args_t &stream_args
){
+ gr_uhd_check_abi();
return boost::shared_ptr<uhd_usrp_sink>(
new uhd_usrp_sink_impl(device_addr, stream_args)
);
diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc
index e52782847..9fd2d175a 100644
--- a/gr-uhd/lib/gr_uhd_usrp_source.cc
+++ b/gr-uhd/lib/gr_uhd_usrp_source.cc
@@ -25,6 +25,7 @@
#include <iostream>
#include <boost/format.hpp>
#include <boost/make_shared.hpp>
+#include "gr_uhd_common.h"
static const pmt::pmt_t TIME_KEY = pmt::pmt_string_to_symbol("rx_time");
@@ -513,6 +514,7 @@ boost::shared_ptr<uhd_usrp_source> uhd_make_usrp_source(
const uhd::device_addr_t &device_addr,
const uhd::stream_args_t &stream_args
){
+ gr_uhd_check_abi();
return boost::shared_ptr<uhd_usrp_source>(
new uhd_usrp_source_impl(device_addr, stream_args)
);