GRC: Just compile XML, no GUI

Hi (most likely Josh),

I was wondering if it’s a big deal to give gnuradio-companion a switch
to just compile a .grc file without firing up the GUI.

Specifically, I was hoping to have unit tests for GRC files, so I wanted
to automatically use the GRC checking features to test .grc files.
However, I started digging in the code… and it seems to be very
closely intertwined with the GUI. And, to be honest, I got a bit lost in
there :slight_smile:

So, something like direct access to the Generator class would be
great. Any hints?

MB

Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin B.
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT – University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association

On 02/16/2012 08:39 AM, Martin B. wrote:

So, something like direct access to the Generator class would be
great. Any hints?

Give this a shot: grcc/grcc at grcc · jettero/grcc · GitHub

-Josh

On Thu, Feb 16, 2012 at 11:39 AM, Martin B. [email protected]
wrote:

So, something like direct access to the Generator class would be
great. Any hints?

MB

Martin,
On the GRC page, open up the “Options” block. There is a drop-down box
for
“Generate Options.” Switch this to “No GUI.” Now you can just compile it
into a Python file and run it either in GRC or from the command line. No
GUI involved.

Tom

On Thu, Feb 16, 2012 at 1:47 PM, [email protected] wrote:

He’s asking to be able to invoke the “compiler” part of GRC without going
into the actual UI of GRC and asking it to generate the corresponding .py
file. I’ve also wished for that capability, so that I can ship .grc files
only, and have a Makefile invoke the (non-existent) “–compile-only” form
of GRC

Oh, I see. Totally misread his post.

Tom

On Thu, 16 Feb 2012 13:20:05 -0500, Tom R. wrote:

On Thu,
Feb 16, 2012 at 11:39 AM, Martin B. wrote:

Hi (most likely
Josh),

I was wondering if it’s a big deal to give
gnuradio-companion a switch

to just compile a .grc file without
firing up the GUI.

Specifically, I was hoping to have unit tests
for GRC files, so I wanted

to automatically use the GRC checking
features to test .grc files.

However, I started digging in the
code… and it seems to be very

closely intertwined with the GUI.
And, to be honest, I got a bit lost in

there :slight_smile:

So, something
like direct access to the Generator class would be

great. Any
hints?

MB

Martin,
On the GRC page, open up the “Options”
block. There is a drop-down box for “Generate Options.” Switch this to
“No GUI.” Now you can just compile it into a Python file and run it
either in GRC or from the command line. No GUI involved.

Tom

Tom:

That’s not what Martin was asking for.

He’s asking to be able to
invoke the “compiler” part of GRC without going into the actual UI of
GRC and asking it to generate the corresponding .py file. I’ve also
wished for that capability, so that I can ship .grc files only, and have
a Makefile invoke the (non-existent) “–compile-only” form of GRC.

Links:

On Thu, Feb 16, 2012 at 10:19:31AM -0800, Josh B. wrote:

I was wondering if it’s a big deal to give gnuradio-companion a switch
to just compile a .grc file without firing up the GUI.

Give this a shot: grcc/grcc at grcc · jettero/grcc · GitHub
-Josh

This is exactly why I wrote grcc. It should probably be a switch
in the gnuradio-companion script, but grcc does the job for now.
I’m open to forks and patches, I really just cobbled together
something that works for me, suggestions welcome.

-Paul


If riding in an airplane is flying, then riding in a boat is swimming.
116 jumps, 48.6 minutes of freefall, 92.9 freefall miles.

On Thu, Feb 16, 2012 at 02:28:21PM -0500, Paul Miller wrote:

something that works for me, suggestions welcome.
Yep, that’s exactly what I wanted. I think this should be part of grc–I
posted a patch here: https://github.com/mbant/gnuradio/tree/grcunittest

This contains two commits:
76e918438e5 simply adds grcc to gnuradio-companion (plus one more switch
to set the dir). This is pretty simple, and I’d suggest it for ‘next’.

724a3ff8798d adds a unit test to gr-howto-write-a-block for the grc
files. This one’s very hackish, it shouldn’t be merged into anything,
but I’d like to suggest something like this for GR. The current next
branch has some broken grc examples, and with something like this it
would be super easy to track the working state of these grc files.

The most relevant change is in
https://github.com/mbant/gnuradio/blob/grcunittest/gr-howto-write-a-block/apps/CMakeLists.txt
(you can see my solution is ugly, non-portable and so on but does the
trick).

It also has a workaround for a bug
(http://gnuradio.org/redmine/issues/485) in GRC. Probably should have
been two commits.

MB


Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin B.
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT – University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association