Getting the API version at compile time

I have been using version 3.1.3 for a while now, but have recently
configured a new PC and installed 3.2.2 (packaged with Ubuntu).
Unfortunately my code does not compile on the new system because of a
change in the API - the return value of the “make” function in
“usrp_standard_rx” has changed to a shared pointer.

I need to be able to maintain my program for both old and new systems
and I’ve been looking for a version constant that I can use for
conditional compilation.

Unfortunately I’ve had no luck - I guess I’m using the wrong keywords in
my searches. Does anyone know how to find out the Gnu Radio version at
compile time?

Thanks,

Peter

Plextek Limited
Registered Address: London Road, Great Chesterford, Essex, CB10 1NY, UK
Company Registration No. 2305889
VAT Registration No. GB 918 4425 15
Tel: +44 1799 533 200. Fax: +44 1799 533 201 Web:http://www.plextek.com
Electronics Design and Consultancy

On Wed, Oct 12, 2011 at 5:26 AM, Peter D. Massam
[email protected]wrote:

compilation. ****


Peter****
Plextek Limited
Registered Address: London Road, Great Chesterford, Essex, CB10 1NY, UK
Company Registration No. 2305889
VAT Registration No. GB 918 4425 15
Tel: +44 1799 533 200. Fax: +44 1799 533 201 Web:http://www.plextek.com
Electronics Design and Consultancy

Peter,
You can find the version information in
$(top_builddir)/gnuradio-core/gnuradio-core.pc. This is filled in with
the
information in $(top_srcdir)/version.sh. Where top_builddir is where you
are
building the project, and top_builddir = top_srcdir if you are building
in
the same directory that contains the source code.

Hope that helps.

Tom

On Oct 12, 2011, at 20:13, Tom R. [email protected] wrote:

On Wed, Oct 12, 2011 at 5:26 AM, Peter D. Massam
[email protected]wrote:

I need to be able to maintain my program for both old and new systems and
I’ve been looking for a version constant that I can use for conditional
compilation.

**

You can find the version information in
$(top_builddir)/gnuradio-core/gnuradio-core.pc. This is filled in with
the
information in $(top_srcdir)/version.sh. Where top_builddir is where you
are
building the project, and top_builddir = top_srcdir if you are building
in
the same directory that contains the source code.

In addition to compile time, in the >= 3.3 API we added a way to ask
this at
runtime via the gr.version() call in Python and gr_version() function
from
C++.

(I know you’re not using the 3.3 API yet, but it will be another option
for
you when you update your application.)

Johnathan

The approach that I used is similar, but I thought I’d mention it
because it
only relies on the installation and not on having the source code (I’m
using
a Ubuntu package). The newer version supports the UHD drivers and there
is
an install directory for the headers, so I added the following to my
makefile:

USRP_API_VERSION=$(shell if test -d /usr/local/include/uhd ; then echo
NEW_USRP_API ; else echo OLD_USRP_API ; fi :wink:

I used the USRP_API_VERSION variable in a “-D” compiler option.

Thanks for the suggestions, which led to the solution I adopted.

Johnathan C.-2 wrote:


View this message in context:
http://old.nabble.com/Getting-the-API-version-at-compile-time-tp32637243p32644037.html
Sent from the GnuRadio mailing list archive at Nabble.com.