[Interest] Tricks to improve moc performance?

Thiago Macieira thiago.macieira at intel.com
Fri Dec 6 18:51:15 CET 2019


On Friday, 6 December 2019 01:16:31 PST Kevin Funk via Interest wrote:
> On that note, CMake goes one step further and removes the need to do this
> manually. Using CMake's AUTOMOC feature, CMake will automatically create ONE
> mocs_compilations.cpp file per target which in turn includes all generated
> "moc_XYZ.cpp" files.
> 
> Quoting:
> 
> "Header files that are not included by an #include "moc_<basename>.cpp"
> statement are nonetheless scanned for Q_OBJECT or Q_GADGET macros. The
> resulting moc_<basename>.cpp files are generated in custom directories and
> automatically included in a generated
> <AUTOGEN_BUILD_DIR>/mocs_compilation.cpp file, which is compiled as part of
> the target."

That's good, but not ideal.

This solution gets you a single build for all the the mocs, which is good, but 
won't generate the best code that Peppe was talking about. You want the moc 
for a given class to be in the class's own .cpp.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products





More information about the Interest mailing list