Archivo

Archivo para la categoría ‘Utilidades’

Qt AUTOMOC with CMake

Viernes, 14 de diciembre de 2012 Sin comentarios

Configuring big Qt projects with CMake could be sometimes annoying because of the necessity to apply the moc command over those specific header files containing the Qt Q_OBJECT macro. Long time ago the CMake macro qt4_wrap_cpp was introduced to help in the preprocessing of those files and it helps a lot. However, in big projects where we have header files containing Q_OBJECT macro and other ones where the macro is not included we have to specify the first ones in a list of files that will be preprocessed with the qt4_wrap_cpp macro. An Cmake configuration example of what I’m talking about could be:

SET(COMMON_SRC    file1.cpp file2.cpp file3.cpp)
SET(COMMON_HDR    file1.h   file3.h)
SET(COMMON_UIS    file1.ui  file3.ui)

QT4_WRAP_CPP(COMMON_MOC  ${COMMON_HDR})
QT4_WRAP_UI(COMMON_UIS  ${COMMON_UIS})

ADD_LIBRARY(project_common   ${COMMON_SRC} ${COMMON_MOC} ${COMMON_UIS})

But things could be easier. This afternoon I was watching some of the videos of the Qt Developers day in Berlin 2012 (http://www.cyberhades.com/2012/12/13/videos-del-qt-developers-day-berlin-2012/). Between them, I watched the presentation of Stephen Kelly talking about how to configure Qt projects with CMake in Qt4 and Qt5 (Some interesting new features will come soon for the new release of Qt ^^). In his presentation Stephen mentioned a new feature introduced in CMake 2.8.8 that let us avoid to apply the qt4_wrap_cpp macro over those headers containing Q_OBJECT macro. It’s so simple as setting the CMAKE_AUTOMOC variable to ON. Here you have the new version of the previous code using CMAKE_AUTOMOC feature.

SET(CMAKE_AUTOMOC ON)
...
SET(COMMON_SRC    file1.cpp file2.cpp file3.cpp)
SET(COMMON_UIS    file1.ui  file3.ui)

QT4_WRAP_UI(COMMON_UIS  ${COMMON_UIS})

ADD_LIBRARY(project_common   ${COMMON_SRC} ${COMMON_UIS})
GD Star Rating
loading...
Share

Freewrl in Ubuntu 12.04

Martes, 4 de septiembre de 2012 Sin comentarios

It has been almost two years from the last posts about FreeWRL (post1 & post2). It has rained a lot since then … Now the freewrl project is in its version 1.22.13 and it even has a version for Android and Blackberry. However the documentation of the project shines by its absence. As in older versions, we need to install some packages, but luckily, nowadays is much less messy than in the past. I will simply left the packages you need to install in Ubuntu 12.04 in order to compile successfully the project:

libfreetype6-dev
libmozjs185-dev
libxaw7-dev
libimlib2-dev
imagemagick
libglew1.6-dev

The rest of the installation process follows the traditional procedure in GNU/Linux tarballs.

GD Star Rating
loading...
Share

Conky – Automatic change in network interface

Jueves, 18 de agosto de 2011 1 comentario

Ya he escrito en varias ocasiones del magnífico monitor de sistema conky. En esta ocasión os dejo una receta para que el programa detecte automáticamente que interfaz de red se está usando y así poder mostrar debidamente las estadísticas de la misma.  Leer más…

GD Star Rating
loading...
Share

Using libav library

Miércoles, 6 de julio de 2011 6 comentarios

It has been long time since I wrote here and I really wanted to do again :P … but lately my life has had many changes. Leer más…

GD Star Rating
loading...
Share

Configurar autocompletado de Bash

Martes, 7 de diciembre de 2010 Sin comentarios

La característica de autocompletado de Bourne Again SHell hace que bash sea uno de los interpretes de linux más interesantes y amigables para los novatos. Solamente pulsando el tabulador podrás completar comandos y nombres de ficheros. Pulsando el tabulador dos veces todos los ficheros del directorio se mostrarán. Pero aún se pueden hacer más cosas con esta característica de autocompletado, como asociar tipos de ficheros con aplicaciones y así designar de forma automática si estás buscando directorios, ficheros de texto o ficheros con una extensión específica. Esta entrada ha sido escrita a partir de este artículo en inglés. Leer más…

GD Star Rating
loading...
Share
Categories: Terminal, Utilidades Tags: , ,