RFC: new way to handle MOC files ?

Stephan Kulow coolo at kde.org
Mon Feb 24 10:10:22 GMT 2003


Am Sunday 23 February 2003 23:07 schrieb Alexander Neundorf:
> On Friday 21 February 2003 20:55, Michael Schuerig wrote:
> > On Friday 21 February 2003 18:51, Alexander Neundorf wrote:
> > > It works the following way: a moc file is required if a source or
> > > header contains the Q_OBJECT macro. The create_global_moc script
> > > parses all files given on its command line and searches checks which
> > > files contain "Q_OBJECT". These files are remembered (e.g. foo.cpp)
> > > and a new file "mocs.cpp" is created which will include all required
> > > moc files (e.g. foo.cpp.moc).
> >
> > This means all moc files have to be recompiled when any header/source
> > containing Q_OBJECT changes. Is that a good idea?
> >
> > Michael
> 
> I don't think that this would be a big problem.
> 
> But it would give two big advantages:
> 
> -possibility to explicitely recreate all moc files if something is fucked up 
> in the build tree: I can remember that once when I tried to compile KDE 3.0 
> the Makefiles were not able to rebuild the moc files, I could touch all *.h 
> files and still they were not rebuild, when I deleted the moc files, they 
> were not recreated, make force-reedit (which some said would help in this 
> case) never worked here, and I'm not the only one experiencing such problems 
> from time to time, see various mails on these mailinglists
> 
> -it enables you to write Makefiles for small Qt/KDE projects by hand without 
> handcoding all the moc file rules (e.g. if you want to try something out and 
> don't want to mess around with the automake/conf/etc stuff, but quickly hack 
> something together)
> 
> And I think it would make the build process a little bit easier to understand.
> You don't have to do *anything* in your sources to have the moc files created.

You don't need anything in your sources with am_edit either. It's just fastens
the compilation, so we run includemocs once in a while. There is really little to
understand about it. I'm fine with your script floating around, so little Makefiles
can be hacked together easily for those not liking the bloat kapptemplate would
generate for these projects, that often aren't supposed to be distributed (I for one
generate subdirs in kdetoys for such projects, but that's me :). But please don't
change anything in CVS to use it. 

Greetings, Stephan





More information about the kde-core-devel mailing list