From 34ed3bad2714247f8c2dfec615bf6f031cc5fea8 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Sun, 2 Jul 2023 03:08:44 +0200 Subject: [PATCH] Add explicit moc includes to sources for moc-covered headers * speeds up incremental builds as changes to a header will not always need the full mocs_compilation.cpp for all the target's headers rebuild, while having a moc file sourced into a source file only adds minor extra costs, due to small own code and the used headers usually already covered by the source file, being for the same class/struct * seems to not slow down clean builds, due to empty mocs_compilation.cpp resulting in those quickly processed, while the minor extra cost of the sourced moc files does not outweigh that in summary. Measured times actually improved by some percent points. (ideally CMake would just skip empty mocs_compilation.cpp & its object file one day) * enables compiler to see all methods of a class in same compilation unit to do some sanity checks * potentially more inlining in general, due to more in the compilation unit * allows to keep using more forward declarations in the header, as with the moc code being sourced into the cpp file there definitions can be ensured and often are already for the needs of the normal class methods --- src/imageformats/ani.cpp | 2 ++ src/imageformats/avif.cpp | 2 ++ src/imageformats/eps.cpp | 2 ++ src/imageformats/exr.cpp | 2 ++ src/imageformats/hdr.cpp | 2 ++ src/imageformats/heif.cpp | 2 ++ src/imageformats/jxl.cpp | 2 ++ src/imageformats/kra.cpp | 2 ++ src/imageformats/ora.cpp | 2 ++ src/imageformats/pcx.cpp | 2 ++ src/imageformats/pic.cpp | 2 ++ src/imageformats/psd.cpp | 2 ++ src/imageformats/ras.cpp | 2 ++ src/imageformats/raw.cpp | 2 ++ src/imageformats/rgb.cpp | 2 ++ src/imageformats/tga.cpp | 2 ++ src/imageformats/xcf.cpp | 2 ++ 17 files changed, 34 insertions(+) diff --git a/src/imageformats/ani.cpp b/src/imageformats/ani.cpp index fbd14c6..ebf8082 100644 --- a/src/imageformats/ani.cpp +++ b/src/imageformats/ani.cpp @@ -570,3 +570,5 @@ QImageIOHandler *ANIPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_ani_p.cpp" diff --git a/src/imageformats/avif.cpp b/src/imageformats/avif.cpp index 0f1319b..bcebd36 100644 --- a/src/imageformats/avif.cpp +++ b/src/imageformats/avif.cpp @@ -1103,3 +1103,5 @@ QImageIOHandler *QAVIFPlugin::create(QIODevice *device, const QByteArray &format handler->setFormat(format); return handler; } + +#include "moc_avif_p.cpp" diff --git a/src/imageformats/eps.cpp b/src/imageformats/eps.cpp index 6fa9f6c..6c20c6e 100644 --- a/src/imageformats/eps.cpp +++ b/src/imageformats/eps.cpp @@ -365,3 +365,5 @@ QImageIOHandler *EPSPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_eps_p.cpp" diff --git a/src/imageformats/exr.cpp b/src/imageformats/exr.cpp index 43c7dd1..207ab17 100644 --- a/src/imageformats/exr.cpp +++ b/src/imageformats/exr.cpp @@ -259,3 +259,5 @@ QImageIOHandler *EXRPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_exr_p.cpp" diff --git a/src/imageformats/hdr.cpp b/src/imageformats/hdr.cpp index 7d3225f..14dd32b 100644 --- a/src/imageformats/hdr.cpp +++ b/src/imageformats/hdr.cpp @@ -296,3 +296,5 @@ QImageIOHandler *HDRPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_hdr_p.cpp" diff --git a/src/imageformats/heif.cpp b/src/imageformats/heif.cpp index c938c0d..bc48381 100644 --- a/src/imageformats/heif.cpp +++ b/src/imageformats/heif.cpp @@ -926,3 +926,5 @@ QImageIOHandler *HEIFPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_heif_p.cpp" diff --git a/src/imageformats/jxl.cpp b/src/imageformats/jxl.cpp index c8ecafd..25220d1 100644 --- a/src/imageformats/jxl.cpp +++ b/src/imageformats/jxl.cpp @@ -1020,3 +1020,5 @@ QImageIOHandler *QJpegXLPlugin::create(QIODevice *device, const QByteArray &form handler->setFormat(format); return handler; } + +#include "moc_jxl_p.cpp" diff --git a/src/imageformats/kra.cpp b/src/imageformats/kra.cpp index fff976c..ef587d7 100644 --- a/src/imageformats/kra.cpp +++ b/src/imageformats/kra.cpp @@ -95,3 +95,5 @@ QImageIOHandler *KraPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_kra.cpp" diff --git a/src/imageformats/ora.cpp b/src/imageformats/ora.cpp index 79c5353..0b785b4 100644 --- a/src/imageformats/ora.cpp +++ b/src/imageformats/ora.cpp @@ -94,3 +94,5 @@ QImageIOHandler *OraPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_ora.cpp" diff --git a/src/imageformats/pcx.cpp b/src/imageformats/pcx.cpp index fa18805..44a64b0 100644 --- a/src/imageformats/pcx.cpp +++ b/src/imageformats/pcx.cpp @@ -792,3 +792,5 @@ QImageIOHandler *PCXPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_pcx_p.cpp" diff --git a/src/imageformats/pic.cpp b/src/imageformats/pic.cpp index 350044c..1196bc0 100644 --- a/src/imageformats/pic.cpp +++ b/src/imageformats/pic.cpp @@ -452,3 +452,5 @@ QImageIOHandler *SoftimagePICPlugin::create(QIODevice *device, const QByteArray handler->setFormat(format); return handler; } + +#include "moc_pic_p.cpp" diff --git a/src/imageformats/psd.cpp b/src/imageformats/psd.cpp index df957e8..0a61c3b 100644 --- a/src/imageformats/psd.cpp +++ b/src/imageformats/psd.cpp @@ -1414,3 +1414,5 @@ QImageIOHandler *PSDPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_psd_p.cpp" diff --git a/src/imageformats/ras.cpp b/src/imageformats/ras.cpp index fe4c574..1a94139 100644 --- a/src/imageformats/ras.cpp +++ b/src/imageformats/ras.cpp @@ -340,3 +340,5 @@ QImageIOHandler *RASPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_ras_p.cpp" diff --git a/src/imageformats/raw.cpp b/src/imageformats/raw.cpp index b097889..b220a36 100644 --- a/src/imageformats/raw.cpp +++ b/src/imageformats/raw.cpp @@ -909,3 +909,5 @@ QImageIOHandler *RAWPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_raw_p.cpp" diff --git a/src/imageformats/rgb.cpp b/src/imageformats/rgb.cpp index cb54072..99e3081 100644 --- a/src/imageformats/rgb.cpp +++ b/src/imageformats/rgb.cpp @@ -806,3 +806,5 @@ QImageIOHandler *RGBPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_rgb_p.cpp" diff --git a/src/imageformats/tga.cpp b/src/imageformats/tga.cpp index 77dbf00..59f6efd 100644 --- a/src/imageformats/tga.cpp +++ b/src/imageformats/tga.cpp @@ -527,3 +527,5 @@ QImageIOHandler *TGAPlugin::create(QIODevice *device, const QByteArray &format) handler->setFormat(format); return handler; } + +#include "moc_tga_p.cpp" diff --git a/src/imageformats/xcf.cpp b/src/imageformats/xcf.cpp index 223bbb7..3c2d666 100644 --- a/src/imageformats/xcf.cpp +++ b/src/imageformats/xcf.cpp @@ -3396,3 +3396,5 @@ QImageIOHandler *XCFPlugin::create(QIODevice *device, const QByteArray &format) // Just so I can get enum values printed #include "xcf.moc" + +#include "moc_xcf_p.cpp"