[Development] Announcing moc_combine

Thiago Macieira thiago.macieira at intel.com
Tue May 31 19:42:01 CEST 2016


On terça-feira, 31 de maio de 2016 18:13:18 BRT Joerg Bornemann wrote:
> While this feature reduces the build time for full builds within a 
> measurable range, it drastically increases build time for incremental 
> builds. Changing just one Q_OBJECT header file results in full 
> regeneration of combined_moc.cpp.
> 
> Take for example:
> touch src/widgets/dialogs/qprogressdialog.h
> make
> 
> moc time without moc_combine:  0.8s
> moc time with moc_combine:    15.6s
> 
> This feature is nice for source distributions but isn't suitable for 
> code being developed.

We can easily disable it for developer builds.

But note that due to rebases and touching central files like qglobal.h or 
qobject.h, everything rebuilds anyway.

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

GNU make helps us for the last option:

$?

    The names of all the prerequisites that are newer than the target, with 
spaces between them. For prerequisites which are archive members, only the 
named member is used (see Archives). 
[https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html#index-_003f-_0028automatic-variable_0029]

I don't know how to implement the first two. 

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.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list