automoc v2

Matthias Kretz kretz at kde.org
Sat Jul 7 00:51:38 CEST 2007


Hi,

attached you'll find the next generation of automoc

I replaced kde4automoc.cmake with a C++/QtCore based program that can run more 
efficient.

Instead of creating a <targetname>.automoc file that is added to the target I 
create a <targetname>_automoc.cpp file now that is compiled and linked into 
the target. This file #includes all moc files that are not included by other 
source files. This way the automoc can, at make-time, decide what mocs need 
to be compiled explicitly and linked into the target.

E.g. the following is possible now:
foo.h:
class A : public QObject
{
  Q_OBJECT
...
};

foo.cpp does not #include "foo.moc"

run make - everything compiles and links fine (without mentioning the header 
in KDE4_MOC_HEADERS either since the new automoc looks at all corresponding 
header files from the .cpp files by itself)

now change foo.cpp to #include "foo.moc"

running make now will just work, even with the /fast target.

Next change I did was to create a <targetname>_automoc.cpp.files file to pass 
the moc includes and the source files that belong to the target to the 
automoc. I could have kept it on the command line but I got a report that the 
command line was already too long for Windows' cmd.exe.

Implementation details:
- The messages of the automoc are written using cmake -E cmake_echo_color, so 
the automoc correctly colorizes its messages now.
- The moc QProcesses are started in parallel (up to 10).

Please test and let me know if you have any problems (you might have to remove 
some explicit QT4_WRAP_CPP calls from CMakeLists.txt now). I'd like to commit 
soon, as this is supposed to fix compilation on Windows again...

-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: automoc-c++-5.patch
Type: text/x-diff
Size: 21454 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20070707/418d9d12/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20070707/418d9d12/attachment-0001.pgp 


More information about the Kde-buildsystem mailing list