kumquat-buildroot/package/gqrx/0003-pass_GNU_Radio_version_as_macro.patch

163 lines
4.9 KiB
Diff
Raw Normal View History

From 1f1064802791c20585c552796d2b759d41c8f295 Mon Sep 17 00:00:00 2001
From: Alexander Fasching <fasching.a91@gmail.com>
Date: Mon, 7 Oct 2019 02:38:49 +0200
Subject: [PATCH] Pass GNU Radio version as macro
Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
---
CMakeLists.txt | 14 +++++++++++++-
src/applications/gqrx/receiver.cpp | 2 +-
src/applications/gqrx/receiver.h | 2 +-
src/dsp/correct_iq_cc.h | 2 +-
src/dsp/filter/fir_decim.cpp | 2 +-
src/dsp/filter/fir_decim.h | 2 +-
src/dsp/lpf.h | 2 +-
src/dsp/rx_filter.h | 2 +-
src/dsp/rx_rds.h | 2 +-
src/dsp/stereo_demod.h | 2 +-
10 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4bff6f08..8b4b8e56 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,8 +108,20 @@ if(NOT Gnuradio_FOUND)
message(FATAL_ERROR "GnuRadio Runtime required to compile gqrx")
endif()
+
+# Pass the GNU Radio version as 0xMMNNPP BCD.
+math(EXPR GNURADIO_BCD_VERSION
+ "(${Gnuradio_VERSION_MAJOR} / 10) << 20 |
+ (${Gnuradio_VERSION_MAJOR} % 10) << 16 |
+ (${Gnuradio_VERSION_MINOR} / 10) << 12 |
+ (${Gnuradio_VERSION_MINOR} % 10) << 8 |
+ (${Gnuradio_VERSION_PATCH} / 10) << 4 |
+ (${Gnuradio_VERSION_PATCH} % 10) << 0
+ "
+)
+add_definitions(-DGNURADIO_VERSION=${GNURADIO_BCD_VERSION})
+
if(Gnuradio_VERSION VERSION_LESS "3.8")
- add_definitions(-DGNURADIO_37)
find_package(Boost COMPONENTS system program_options REQUIRED)
endif()
diff --git a/src/applications/gqrx/receiver.cpp b/src/applications/gqrx/receiver.cpp
index a62fb080..40e376f6 100644
--- a/src/applications/gqrx/receiver.cpp
+++ b/src/applications/gqrx/receiver.cpp
@@ -28,7 +28,7 @@
#include <iostream>
-#ifdef GNURADIO_37
+#if GNURADIO_VERSION < 0x030800
#include <gnuradio/blocks/multiply_const_ff.h>
#endif
diff --git a/src/applications/gqrx/receiver.h b/src/applications/gqrx/receiver.h
index 1109240d..5fcd50a8 100644
--- a/src/applications/gqrx/receiver.h
+++ b/src/applications/gqrx/receiver.h
@@ -23,7 +23,7 @@
#ifndef RECEIVER_H
#define RECEIVER_H
-#ifdef GNURADIO_37
+#if GNURADIO_VERSION < 0x030800
#include <gnuradio/analog/sig_source_c.h>
#include <gnuradio/blocks/multiply_const_ff.h>
#include <gnuradio/blocks/multiply_cc.h>
diff --git a/src/dsp/correct_iq_cc.h b/src/dsp/correct_iq_cc.h
index 410af766..fcb19829 100644
--- a/src/dsp/correct_iq_cc.h
+++ b/src/dsp/correct_iq_cc.h
@@ -29,7 +29,7 @@
#include <gnuradio/hier_block2.h>
#include <gnuradio/filter/single_pole_iir_filter_cc.h>
-#ifdef GNURADIO_37
+#if GNURADIO_VERSION < 0x030800
#include <gnuradio/blocks/sub_cc.h>
#else
#include <gnuradio/blocks/sub.h>
diff --git a/src/dsp/filter/fir_decim.cpp b/src/dsp/filter/fir_decim.cpp
index 7c7fc32f..82d852d5 100644
--- a/src/dsp/filter/fir_decim.cpp
+++ b/src/dsp/filter/fir_decim.cpp
@@ -24,7 +24,7 @@
#include <cstdio>
#include <vector>
-#ifdef GNURADIO_37
+#if GNURADIO_VERSION < 0x030800
#include <gnuradio/filter/fir_filter_ccf.h>
#endif
diff --git a/src/dsp/filter/fir_decim.h b/src/dsp/filter/fir_decim.h
index ed40b021..c8edb10b 100644
--- a/src/dsp/filter/fir_decim.h
+++ b/src/dsp/filter/fir_decim.h
@@ -22,7 +22,7 @@
*/
#pragma once
-#ifdef GNURADIO_37
+#if GNURADIO_VERSION < 0x030800
#include <gnuradio/filter/fir_filter_ccf.h>
#else
#include <gnuradio/filter/fir_filter_blk.h>
diff --git a/src/dsp/lpf.h b/src/dsp/lpf.h
index 953716a3..416e831c 100644
--- a/src/dsp/lpf.h
+++ b/src/dsp/lpf.h
@@ -26,7 +26,7 @@
#include <gnuradio/hier_block2.h>
#include <gnuradio/filter/firdes.h>
-#ifdef GNURADIO_37
+#if GNURADIO_VERSION < 0x030800
#include <gnuradio/filter/fir_filter_fff.h>
#else
#include <gnuradio/filter/fir_filter_blk.h>
diff --git a/src/dsp/rx_filter.h b/src/dsp/rx_filter.h
index 82c32a1e..0b09a386 100644
--- a/src/dsp/rx_filter.h
+++ b/src/dsp/rx_filter.h
@@ -25,7 +25,7 @@
#include <gnuradio/hier_block2.h>
-#ifdef GNURADIO_37
+#if GNURADIO_VERSION < 0x030800
#include <gnuradio/filter/fir_filter_ccc.h>
#include <gnuradio/filter/freq_xlating_fir_filter_ccc.h>
#else
diff --git a/src/dsp/rx_rds.h b/src/dsp/rx_rds.h
index f975ec11..cce90fb7 100644
--- a/src/dsp/rx_rds.h
+++ b/src/dsp/rx_rds.h
@@ -25,7 +25,7 @@
#include <gnuradio/hier_block2.h>
-#ifdef GNURADIO_37
+#if GNURADIO_VERSION < 0x030800
#include <gnuradio/filter/fir_filter_ccc.h>
#include <gnuradio/filter/fir_filter_ccf.h>
#include <gnuradio/filter/fir_filter_fff.h>
diff --git a/src/dsp/stereo_demod.h b/src/dsp/stereo_demod.h
index 35069615..3ebdca49 100644
--- a/src/dsp/stereo_demod.h
+++ b/src/dsp/stereo_demod.h
@@ -27,7 +27,7 @@
#include <gnuradio/hier_block2.h>
#include <gnuradio/filter/firdes.h>
-#ifdef GNURADIO_37
+#if GNURADIO_VERSION < 0x030800
#include <gnuradio/filter/fir_filter_fcc.h>
#include <gnuradio/filter/fir_filter_fff.h>
#include <gnuradio/blocks/multiply_cc.h>