shared: Improve incremental compile times via explicit file includes

When a source file contains an explicit include with a filename
following the "moc_<actual-filename>.cpp" pattern, then CMake's
AUTOMOC generation tool will recognize the matching pair and generate
the replacement header file and add the required include directory
entries.

For all files which do contain Q_OBJECT or similar declarations but do
not have an explicit include directive, the global mocs_compilation.cpp
file will still be generated (which groups all "missing" generated
headers).

The larger this global file is, the more expensive incremental
compilation will be as this file (and all its contained generated
headers) will be re-generated regardless of whether actual changes
occurred.
This commit is contained in:
PatTheMav
2024-08-08 21:42:30 +02:00
committed by Ryan Foster
parent 710d99ef4d
commit 5eb04cdf9d
7 changed files with 7 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
#include "double-slider.hpp"
#include "moc_double-slider.cpp"
#include <cmath>

View File

@@ -27,7 +27,7 @@
#include <QUuid>
#include "double-slider.hpp"
#include "spinbox-ignorewheel.hpp"
#include "properties-view.hpp"
#include "moc_properties-view.cpp"
#include "properties-view.moc.hpp"
#include <qt-wrappers.hpp>

View File

@@ -1,4 +1,4 @@
#include "spinbox-ignorewheel.hpp"
#include "moc_spinbox-ignorewheel.cpp"
SpinBoxIgnoreScroll::SpinBoxIgnoreScroll(QWidget *parent) : QSpinBox(parent)
{

View File

@@ -1,4 +1,4 @@
#include <plain-text-edit.hpp>
#include "moc_plain-text-edit.cpp"
#include <QFontDatabase>
OBSPlainTextEdit::OBSPlainTextEdit(QWidget *parent, bool monospace)

View File

@@ -1,4 +1,4 @@
#include "slider-ignorewheel.hpp"
#include "moc_slider-ignorewheel.cpp"
SliderIgnoreScroll::SliderIgnoreScroll(QWidget *parent) : QSlider(parent)
{

View File

@@ -1,5 +1,5 @@
#include <QResizeEvent>
#include "vertical-scroll-area.hpp"
#include "moc_vertical-scroll-area.cpp"
void VScrollArea::resizeEvent(QResizeEvent *event)
{

View File

@@ -15,7 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#include "qt-wrappers.hpp"
#include "moc_qt-wrappers.cpp"
#include <graphics/graphics.h>
#include <util/threading.h>