Friday, June 27, 2008

le roi est mort, vive le roi!

After almost 2 years, my work at Motorola is going to an end. Luckily for me, another contract is on the pipe: this one is for Axis and next month I'll be in Lund, Sweden, for training. The project is going to be on Linux, developing in C, for embedded devices.

Sunday, June 08, 2008

boost with cmake

First, make sure you are using cmake 2.6, as the boost module is much better and I've actually managed to use it on both Linux and Windows.

cmake_minimum_required( VERSION 2.6 FATAL_ERROR )


Next check for the boost installation, version a/o some libraries:

# search for Boost version 1.34
find_package( Boost 1.34 COMPONENTS regex )


Last piece to the puzzle: specify the include and lib path and link as needed:


link_directories ( ${Boost_LIBRARY_DIRS} )
include_directories ( ${Boost_INCLUDE_DIRS} )

add_executable (
helloworld
helloworld.cc
)

target_link_libraries (
helloworld
${Boost_LIBRARIES}
)


On Linux, nothing else is needed to compile your boost app. On Windows, I had to extend the path to include the boost root and lib paths. If you are using MSys, just add something like this to your .profile, for example:


BOOST_ROOT=/e/programs/boost_1_35_0
BOOST_LIBRARYDIR=$BOOST_ROOT/stage/lib

export PATH=$PATH:$BOOST_ROOT:$BOOST_LIBRARYDIR


If you need more info, just read the help:

$ cmake --help-module FindBoost

Saturday, June 07, 2008

new tool of choice: cmake

Now I have a new source control system, what about a new build system? I've been using automake and autoconf for some time and all was relatively fine on Linux, but quite a pain to use on Windows.

Again, googled some time and found some candidates. Between them, cmake. Its problem is that there is very little documentation, except a book by Kitware, the creator of cmake, with a ludicrous price. But, other than that, it does its job quite nice on both Linux and Windows and it is open-source. It is also used by quite some big projects like KDE. So why not use it myself?

new tool of choice: git

With a new PC in house, SVN started to show its limits: I wanted to have a source control system that allows me to work from any of my PC's, with minimum of hassle. SVN is fine if I would have one computer that is always on, but I don't. My old PC makes a lot of noise and heat and would prefer to keep it off as much as possible. My tablet is my current development box, but I don't want to keep a central repo there, either, as I would be forced to have the tablet on if I want to some developement on my desktop.

So, after some search on google and some time spent on wikipedia and on youtube, I've decided to adopt a new source control system: git. The Windows support is not the best, but it works fine from the command line.

Now I have a "central" repo on my desktop and a clone on the laptop. The "central" repo is more like a backup repo for the laptop. Sweet :-)