Permalink
Browse files

1) Updates for GR 3.7.0git. This should compile against both recent 3.6

(tested against 3.6.4.2) and current 3.7.

This makes things a bit ugly, as the main cmake file now both looks for
gnuradio-core (which is an indicator of 3.6) and tries the new 3.7 way
of locating GR.  The results are chosen and passed on to other cmake
files, and a new macro (GR_OLD) should be defined iff 3.6 is detected.

2) In pocencode_impl.cc, return the number of bytes actually
transferred fro work().
  • Loading branch information...
1 parent eef8b4d commit d17b79b9f8b86408c8bd0c4671bbdcfa6dba659a @unsynchronized committed Jun 11, 2013
Showing with 55 additions and 14 deletions.
  1. +19 −8 CMakeLists.txt
  2. +8 −0 include/mixalot/pocencode.h
  3. +4 −3 lib/CMakeLists.txt
  4. +13 −2 lib/pocencode_impl.cc
  5. +4 −0 lib/test_mixalot.cc
  6. +5 −0 lib/utils.h
  7. +2 −1 swig/CMakeLists.txt
View
@@ -83,17 +83,28 @@ set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
########################################################################
# Find gnuradio build dependencies
########################################################################
+set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS FILTER PMT)
+find_package(Gnuradio "3.7.0")
find_package(Gruel)
find_package(GnuradioCore)
find_package(CppUnit)
find_package(ITPP)
-if(NOT GRUEL_FOUND)
- message(FATAL_ERROR "Gruel required to compile mixalot")
-endif()
-
-if(NOT GNURADIO_CORE_FOUND)
- message(FATAL_ERROR "GnuRadio Core required to compile mixalot")
+if(GNURADIO_CORE_FOUND)
+ if(NOT GRUEL_FOUND)
+ message(FATAL_ERROR "Gruel required to compile mixalot against GNU Radio 3.6.x.")
+ endif()
+ set(GR_LIBS ${GNURADIO_CORE_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES})
+ set(GR_LIBDIRS ${GNURADIO_CORE_LIBRARY_DIRS})
+ set(GR_INCLUDES ${GNURADIO_CORE_INCLUDE_DIRS} ${GRUEL_INCLUDE_DIRS} "${GRUEL_INCLUDE_DIRS}/gruel")
+ add_definitions(-DGR_OLD)
+ list(APPEND GR_SWIG_FLAGS "-DGR_OLD")
+elseif(GNURADIO_RUNTIME_FOUND)
+ set(GR_LIBS ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES})
+ set(GR_LIBDIRS ${GNURADIO_RUNTIME_LIBRARY_DIRS} ${GNURADIO_PMT_LIBRARY_DIRS} ${GNURADIO_FILTER_LIBRARY_DIRS})
+ set(GR_INCLUDES ${GNURADIO_RUNTIME_INCLUDE_DIRS})
+else()
+ message(FATAL_ERROR "Need either gnuradio-core+gruel (3.6.x) or gnuradio-runtime (3.7.x).")
endif()
if(NOT CPPUNIT_FOUND)
@@ -108,14 +119,14 @@ include_directories(
${Boost_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
${CPPUNIT_INCLUDE_DIRS}
- ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${GR_INCLUDES}
)
link_directories(
${Boost_LIBRARY_DIRS}
${GRUEL_LIBRARY_DIRS}
${CPPUNIT_LIBRARY_DIRS}
- ${GNURADIO_CORE_LIBRARY_DIRS}
+ ${GR_LIBDIRS}
)
# Set component parameters
@@ -8,13 +8,21 @@
#define INCLUDED_MIXALOT_POCENCODE_H
#include <mixalot/api.h>
+#ifdef GR_OLD
#include <gr_sync_block.h>
+#else
+#include <gnuradio/sync_block.h>
+#endif
namespace gr {
namespace mixalot {
+#ifdef GR_OLD
class MIXALOT_API pocencode : virtual public gr_sync_block
+#else
+ class MIXALOT_API pocencode : virtual public sync_block
+#endif
{
public:
typedef boost::shared_ptr<pocencode> sptr;
View
@@ -23,17 +23,18 @@
include(GrPlatform) #define LIB_SUFFIX
include_directories(
+ ${GR_INCLUDES}
${Boost_INCLUDE_DIR}
${ITPP_INCLUDE_DIR}
)
-link_directories(${Boost_LIBRARY_DIRS})
+link_directories(${Boost_LIBRARY_DIRS} ${GR_LIBDIRS})
list(APPEND mixalot_sources
utils.cc
pocencode_impl.cc
)
add_library(gnuradio-mixalot SHARED ${mixalot_sources})
-target_link_libraries(gnuradio-mixalot ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES} ${ITPP_LIBRARY_NORMAL})
+target_link_libraries(gnuradio-mixalot ${Boost_LIBRARIES} ${GR_LIBS} ${ITPP_LIBRARY_NORMAL})
set_target_properties(gnuradio-mixalot PROPERTIES DEFINE_SYMBOL "gnuradio_mixalot_EXPORTS")
########################################################################
@@ -61,7 +62,7 @@ add_executable(test-mixalot ${test_mixalot_sources})
target_link_libraries(
test-mixalot
- ${GNURADIO_CORE_LIBRARIES}
+ ${GR_LIBS}
${Boost_LIBRARIES}
${CPPUNIT_LIBRARIES}
${ITPP_LIBRARY_NORMAL}
View
@@ -8,7 +8,11 @@
#include "config.h"
#endif
+#ifdef GR_OLD
#include <gr_io_signature.h>
+#else
+#include <gnuradio/io_signature.h>
+#endif
#include "pocencode_impl.h"
#include <iostream>
#include <sstream>
@@ -113,9 +117,16 @@ namespace gr {
pocencode_impl::pocencode_impl(msgtype_t msgtype, unsigned int baudrate, unsigned int capcode, std::string message, unsigned long symrate)
- : d_baudrate(baudrate), d_capcode(capcode), d_msgtype(msgtype), d_message(message), d_symrate(symrate), gr_sync_block("pocencode",
+ : d_baudrate(baudrate), d_capcode(capcode), d_msgtype(msgtype), d_message(message), d_symrate(symrate),
+#ifdef GR_OLD
+ gr_sync_block("pocencode",
gr_make_io_signature(0, 0, 0),
gr_make_io_signature(1, 1, sizeof (unsigned char)))
+#else
+ sync_block("pocencode",
+ io_signature::make(0, 0, 0),
+ io_signature::make(1, 1, sizeof (unsigned char)))
+#endif
{
if(d_symrate % d_baudrate != 0) {
std::cerr << "Output symbol rate must be evenly divisible by baud rate!" << std::endl;
@@ -174,7 +185,7 @@ namespace gr {
d_bitqueue.pop();
}
std::cout << "returning " << toxfer << " bvec bytes" << std::endl;
- return noutput_items;
+ return toxfer;
}
} /* namespace mixalot */
View
@@ -23,7 +23,11 @@
#include <cppunit/TextTestRunner.h>
#include <cppunit/XmlOutputter.h>
+#ifdef GR_OLD
#include <gr_unittests.h>
+#else
+#include <gnuradio/unittests.h>
+#endif
#include "qa_mixalot.h"
#include <iostream>
View
@@ -2,8 +2,13 @@
#include "config.h"
#endif
+#ifdef GR_OLD
#include <gr_types.h>
#include <gr_io_signature.h>
+#else
+#include <gnuradio/types.h>
+#include <gnuradio/io_signature.h>
+#endif
#include <itpp/comm/bch.h>
#include <iostream>
#include <sstream>
View
@@ -31,8 +31,9 @@ include(GrPython)
########################################################################
# Setup swig generation
########################################################################
-foreach(incdir ${GNURADIO_CORE_INCLUDE_DIRS})
+foreach(incdir ${GR_INCLUDES})
list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig)
+ list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig)
endforeach(incdir)
foreach(incdir ${GRUEL_INCLUDE_DIRS})

0 comments on commit d17b79b

Please sign in to comment.