make KDE4_AUTOMOC compatible to qmake

Matthias Kretz kretz at kde.org
Thu Jun 28 00:26:41 CEST 2007


On Wednesday 27 June 2007, Alexander Neundorf wrote:
> Could you maybe measure cmake times with the old and the new one with cold
> and warm caches ?

Measuring is almost impossible. Using
time cmake
I get +/- 50% on total time. But here are the numbers:

old automoc:
without cache: 39.47s user 12.53s system 36% cpu 2:22.32 total
with    cache: 16.59s user  2.62s system 26% cpu 1:13.69 total

new automoc as from Alex's patch:
without cache: 38.78s user 12.06s system 32% cpu 2:38.27 total
with    cache: 16.15s user  3.01s system 18% cpu 1:42.67 total

reworked patch:
without cache: 39.01s user 11.80s system 34% cpu 2:26.86 total
with    cache: 16.03s user  2.75s system 20% cpu 1:32.07 total

without cache means:
% rm CMakeCache.txt
% time cmake -DCMAK... ../../src/kdelibs

with cache:
% time cmake ./

Anyway, I changed quite a bit:
1. don't create _automoc.files files anymore; instead pass all the variables 
on the command line to kde4automoc.cmake. I did this in order to save on IO 
at cmake time. (Optimizing cmake performance is guesswork or do you have any 
way to gather better data?)

2. I added KDE4_MOC_HEADERS that takes the target and a list of header files. 
The headers are then moc'ed and the resulting moc_foo.cpp file is added to 
the list of source files of the given target.

3. If kde4automoc.cmake is given a header file then it will simply create a 
moc_foo.cpp file from it (might result in an empty file).

4. kde4automoc.cmake now recreates the moc file if only the header was changed

5. tried unsuccessfully to make kde4automoc.cmake show "Automoc: Generating 
${_moc} from ${_moc_source}" in color

6. the _automoc.mark file is now only used for a timestamp, the variables that 
were written to it and later read from it again are now used directly

7. If the .cpp file contains #include "<filename>.moc" and ^[ \t]*Q_OBJECT 
then the moc file is created from the .cpp file

So far I tested it with kdelibs only.

-- 
________________________________________________________
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.patch
Type: text/x-diff
Size: 19867 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20070628/19b49d8d/attachment.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/20070628/19b49d8d/attachment.pgp 


More information about the Kde-buildsystem mailing list