[Interest] Tricks to improve moc performance?

Michael Jackson mike.jackson at bluequartz.net
Fri Dec 6 19:21:24 CET 2019


On 12/6/19, 12:52 PM, "Interest on behalf of Thiago Macieira" <interest-bounces at qt-project.org on behalf of thiago.macieira at intel.com> wrote:

    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
    
    
Dear Thiago, 
    Could you expand a bit on your comment? We use CMake for our build system and the AUOT_MOC feature. I just would like to know what exactly I am missing by doing this.

--
Mike Jackson 




More information about the Interest mailing list