--- ChangeLog | 6 ++++ NEWS | 3 ++ doc/automake.texi | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 7b8a2f6..c780be4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-07-07 Gergely Risko <gerg...@risko.hu> + + * automake.in (handle_source_transform): added support for Qt, via + the new prog_QTSOURCES variable. + * NEWS: updated. + 2009-06-07 Ralf Wildenhues <ralf.wildenh...@gmx.de> AM_PROG_GCJ: use AC_CHECK_TOOLS for gcj, for cross compilation. diff --git a/NEWS b/NEWS index 7e14ed8..15481d9 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ New in 1.11a: +* Languages changes: + - There is initial support for Qt's Meta Object Compiler. + Bugs fixed in 1.11a: * Bugs introduced by 1.11: diff --git a/doc/automake.texi b/doc/automake.texi index 6c6765f..a9495e7 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -225,6 +225,7 @@ Building Programs and Libraries * Fortran 9x Support:: Compiling Fortran 9x sources * Java Support:: Compiling Java sources * Vala Support:: Compiling Vala sources +* Qt Support:: Compiling Qt sources * Support for Other Languages:: Compiling other languages * ANSI:: Automatic de-ANSI-fication (obsolete) * Dependencies:: Automatic dependency tracking @@ -4541,6 +4542,7 @@ to build programs and libraries. * Fortran 9x Support:: Compiling Fortran 9x sources * Java Support:: Compiling Java sources * Vala Support:: Compiling Vala sources +* Qt Support:: Compiling Qt sources * Support for Other Languages:: Compiling other languages * ANSI:: Automatic de-ANSI-fication (obsolete) * Dependencies:: Automatic dependency tracking @@ -6141,6 +6143,11 @@ Any package including C++ code must define the output variable the @code{AC_PROG_CXX} macro (@pxref{Particular Programs, , Particular Program Checks, autoconf, The Autoconf Manual}). +C++ support doesn't mean that programs using the Qt library (and notably +Qt's signal/slot mechanism) will be compiled correctly (using Qt's Meta +Object Compiler). For that you have to have a look on the Qt support +(@pxref{Qt Support}). + A few additional variables are defined when a C++ source file is seen: @vtable @code @@ -6659,6 +6666,74 @@ Note that currently, you cannot use per-target @code{*_VALAFLAGS} source file. +...@node Qt Support +...@comment node-name, next, previous, up +...@section Qt Support + +...@cindex Qt Support +...@cindex Support for Qt + +Automake includes initial support for the Qt library +(@uref{http://www.qtsoftware.com/products/}). This includes calling the +Meta Object Compiler (MOC) and compiling/linking the resulting C++ files +to the executable (or library). Support for calling the other Qt tools +(uic, rcc, lconvert) is not included (yet). + +The shipped AM_PROG_MOC macro should be used to look for the MOC tool on +the build system. For checking the existence of the Qt library and +different parts of it, you can use pkg-config. + +...@defmac AM_PROG_MOC +Try to find Qt's Meta Object Compiler and if found the variable +...@code{moc} will be set. The value of this variable will be used during +the compilation to generate meta object code. +...@end defmac + +With Qt's Meta Object Compiler C++ source can be generated from headers +and sources. Generated source from a header file has to be compiled and +than linked to the binary. Header files which should be run through the +Meta Object Compiler have to be listed in the +...@code{@var{prog}_QTSOURCES} variable (and in @co...@var{prog}_sources} +too). The generated C++ files will be named according to Qt customs +(@file{moc_foo.cpp}). + +A working Makefile.am example: +...@example +bin_PROGRAMS = cutegammon + +cutegammon_QTSOURCES = board.h checker.h clickablelabel.h \ + diceanimation.h dice.h doubledice.h lineedit.h mainwindow.h \ + point.h spot.h + +cutegammon_SOURCES = board.cpp checker.cpp clickablelabel.cpp \ + diceanimation.cpp dice.cpp doubledice.cpp lineedit.cpp \ + main.cpp mainwindow.cpp point.cpp spot.cpp \ + $(cutegammon_QTSOURCES) + +AM_CXXFLAGS = `pkg-config --cflags QtGui` +AM_LDFLAGS = `pkg-config --libs QtGui` +...@end example + +In some interesting situations it may be needed to generate meta object +code from C++ source files. The usual way to handle this in the Qt +world is to generate meta object code in a file (named @file{foo.moc} +for @file{foo.cpp}) and include that at the end of the original source: +...@example +#include <QObject> +#include <QWidget> + +class InCodeClass : public QObject @{ + Q_OBJECT +...@dots{} +...@}; + +#include <incodeclass.moc> +...@end example + +C++ source files like this has to be added to @co...@var{prog}_qtsources} too. +The generated @file{foo.moc} won't be compiled and linked of course, +since its code will be generated together with the @file{foo.cpp}. + @node Support for Other Languages @comment node-name, next, previous, up @section Support for Other Languages -- 1.6.3.3