discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] an example of a gnuradio project using cmake


From: Josh Blum
Subject: [Discuss-gnuradio] an example of a gnuradio project using cmake
Date: Sat, 11 Dec 2010 10:55:20 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

Hey list,

I would like to share my experiences with CMake.

I started using CMake because I needed a cross-platform build system for
making UHD and I stumbled upon CMake. After learning CMake and building
UHD on-top of it, I can conclude that CMake is indeed awesome.

------------------------------------------------------------------------
-- OK, what is it?
------------------------------------------------------------------------

CMake is a cross platform build system. In short, it translates a
description of your projects build rules and files and generates a
platform specific build system. This means that it not only generates
Makefiles (like autotools), but can also generate eclipse project files,
xcode projects, MSVC projects, and more.

------------------------------------------------------------------------
-- How does it compare to autotools?
------------------------------------------------------------------------

1) Project description:

In autotools there is there *.m4/Makefile.am/configure.ac/bash
dichotomy. With CMake, the project description goes into one type of
file, written in one scripting language. Now the language is CMake's own
invention. I don't know why they reinvented the wheel, but its dead
simple and very powerful.

This way, a projects configuration, sanity checks, library setup, target
setup, etc, can occur all in the same environment and only at the scope
or level that it needs to be introduced.

http://www.vtk.org/Wiki/CMake/Language_Syntax

2) CMake is fast:

Ever watch the paint dry after changing something in an m4 file? With
CMake, it just knows what "going on". Change something and type make,
and only the smallest delta to meet the dependencies will be affected.
In addition, there is only 1 level of generation (CMake just generates
the Makefiles).

3) CMake makes packages:

It generates debs, rpms, windows exes, mac packages...
http://www.vtk.org/Wiki/CMake:CPackPackageGenerators

4) Configuration gui:

You could enable components and set paths with command line switches,
but CMake has a gui for this as well (even one in ncurses). Suppose you
want to enable a component during configuration, its as simple as
checking a box.

http://www.google.com/images?hl=en&safe=off&q=cmake+gui&um=1&ie=UTF-8&source=og&sa=N&tab=wi&biw=1366&bih=518

5) No convenience libraries:

I miss them, it would be convenient to have, but its more than possible
to do without them.

http://www.cmake.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F

------------------------------------------------------------------------
-- Example of a stand-alone gnuradio project with CMake
------------------------------------------------------------------------

I put together a CMake build system for a gnuradio project. So, I
CMake'd up gr-uhd in the style of how-to-write-a-block. It handles
library, headers, swig, grc, and some generation. The CMakeLists.txt
files are sitting along side the Makefile.ams on this branch:

http://gnuradio.org/cgit/jblum.git/diff/?h=cmake_example

The CMakeLists.txt may seem quite wordy, but keep in mind that most of
this business could be moved out into a set of cmake includes with
common configuration setup and macros/functions.

Compare gr-uhd/swig/CMakeLists.txt to gr-uhd/swig/Makefile.swig.gen +
Makefile.am and you will see what I mean.

Here is the verbose from the build process:
http://pastebin.com/ZXNYL7iJ

------------------------------------------------------------------------
-- Knocking on autotools:
------------------------------------------------------------------------

I tried not to bash autotools too hard. But seriously, the gnuradio
gurus have put in a massive amount of effort to work around the
limitations of autotools. Maybe some share my sentiments.

KDE thought switching its build system to CMake was a good idea:
http://lwn.net/Articles/188693/

Going forward, when the gnuradio source gets the much needed
reorganization, I hope that the gurus will consider CMake for all the
reasons above.

Thanks,
-Josh



reply via email to

[Prev in Thread] Current Thread [Next in Thread]