make KDE4_AUTOMOC compatible to qmake

Alexander Neundorf neundorf at kde.org
Thu Jun 28 04:17:31 CEST 2007


On Wednesday 27 June 2007 18:26, Matthias Kretz wrote:
> 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

I didn't mean the cmake cache, I meant the disk cache, i.e. compared directly 
after booting (with cold cache) and when running cmake multiple times in a 
row (-> warm caches).

> 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

The thing to watch out for: does it work with spaces in the path to the source 
or binary dir ?

> save on IO at cmake time. (Optimizing cmake performance is guesswork or do
> you have any way to gather better data?)

I used valgrind. But this doesn't really help for IO.

> 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

Yes, I think we'll have to live with this.

> 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.

Sounds good so far :-)

Alex


More information about the Kde-buildsystem mailing list