make KDE4_AUTOMOC compatible to qmake

Alexander Neundorf neundorf at kde.org
Wed Jun 27 00:40:53 CEST 2007


On Tuesday 26 June 2007 08:02, David Faure wrote:
> On Friday 22 June 2007, Matthias Kretz wrote:
> > Is it ok if I commit the KDE4Macros.cmake change to make the delayed
> > automoc work? Or do you want to do it? Any showstoppers with it?
>
> Alex?

Not from my side.
One thing is that now all files are scanned, also if KDE4_AUTOMOC wasn't used.
I think this shouldn't break anyrhing.
We should add an option to KDE4_ADD_EXECUTABLE for disabling automoc, but 
that's not urgent I'd say.

Currently I don't have a lot of time for testing, so if you didn't find 
problems, it's probably ok to commit (it's also a perfect chance to break 
compilation for many people...)
Could you maybe measure cmake times with the old and the new one with cold and 
warm caches ?


> > I just committed my patch to kde4automoc.cmake to make the moc include
> > qmake compatible there...
>
> Thanks for that.
>
> There's one last thing that is missing for kde4_automoc to be compatible
> with qmake, and that would be: support for Q_OBJECT in .cpp files. This
> would be very very useful for unit tests (writing one file instead of two).
>
> Currently the only way to support that seems to be #include "moc_foo.cxx"
> (weird extension) and QT4_WRAP_CPP(), but that's a bit too manual compared
> to kde4_automoc (where listing all source files isn't needed).

Is this really too manual ? I don't really see a problem here, since it's not 
too common and not that much work.
But if you have it working, I also don't have objections.


> So my request would be that moc_foo.cpp (for qmake compat) gets generated
> when foo.cpp has Q_OBJECT and #includes moc_foo.cpp  -- and if this means
> too much parsing it could be disabled by default and enabled by a
> directory-wide option, but after all we have to load the .cpp files already
> for normal kde4_automoc, right?

Yes, but I didn't measure where more time is spent, whether the loading or the 
regexp matching. 

Alex


More information about the Kde-buildsystem mailing list