[Development] Announcing moc_combine

Thiago Macieira thiago.macieira at intel.com
Tue May 31 20:14:41 CEST 2016

On terça-feira, 31 de maio de 2016 14:42:01 BRT Thiago Macieira wrote:
> The best of both worlds would be if:
>  * moc could output more than one file
>  * moc could be run once for however many files needed updating
>  * moc could be given the list of files that have changed, but no others
> Also, qmake would need to list only the actual headers, not the indirect 
> dependencies of them as it currently does. That would mean moc would not
> get  rerun if an indirect dependency of a header changed. In Qt 4, that
> wasn't a problem; for Qt 5, given that moc parses plugin and metatype
> declarations from included headers, the rerun would not produce the same as
> a clean build.

The attached Makefile accomplishes the goals above (to test, run "make create" 

$ gmake
moc --combine=%.h=.moc/moc_%.cpp 1.h 2.h
$ touch 1.h
$ gmake    
moc --combine=%.h=.moc/moc_%.cpp 1.h
$ touch 2.h
$ gmake    
moc --combine=%.h=.moc/moc_%.cpp 2.h
$ touch *.h
$ gmake    
moc --combine=%.h=.moc/moc_%.cpp 1.h 2.h

But it suffers from the problem of indirect dependencies, which I don't know 
how to solve:

$ gmake
gmake: Nothing to be done for 'mocables'.
$ touch indirect1.h 
$ gmake            
gmake: Nothing to be done for 'mocables'.

The other problem, of course, is about systems that don't use GNU make. Looks 
like nmake has the same syntax[1], but what about BSD makes?

[1] https://msdn.microsoft.com/en-us/library/cbes8ded.aspx
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: text/x-makefile
Size: 489 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160531/8e30f91c/attachment.bin>

More information about the Development mailing list