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
This commit is contained in:
Friedrich W. H. Kossebau 2023-07-04 16:11:19 +02:00
parent 619283211c
commit be4aec63a0
10 changed files with 20 additions and 0 deletions

View file

@ -781,3 +781,5 @@ void Game::setCurrentPlayer(Player &player)
}
} // End of namespace Kigo
#include "moc_game.cpp"

View file

@ -60,3 +60,5 @@ QString Score::toString() const
}
} // End of namespace Kigo
#include "moc_score.cpp"

View file

@ -41,3 +41,5 @@ void GeneralConfig::updateEngineCommand()
}
} // End of namespace Kigo
#include "moc_generalconfig.cpp"

View file

@ -401,3 +401,5 @@ void GameScene::drawBackground(QPainter *painter, const QRectF &)
}
} // End of namespace Kigo
#include "moc_gamescene.cpp"

View file

@ -49,3 +49,5 @@ void GameView::resizeEvent(QResizeEvent *event)
}
} // End of namespace Kigo
#include "moc_gameview.cpp"

View file

@ -223,3 +223,5 @@ QSize ThemeRenderer::elementSize(Element element) const
}
} // End of namespace Kigo
#include "moc_themerenderer.cpp"

View file

@ -469,3 +469,5 @@ bool MainWindow::isBackendWorking()
}
} // End of namespace Kigo
#include "moc_mainwindow.cpp"

View file

@ -26,3 +26,5 @@ void ErrorWidget::on_configureButton_clicked()
}
} // End of namespace Kigo
#include "moc_errorwidget.cpp"

View file

@ -99,3 +99,5 @@ void GameWidget::enableFinishButton()
}
} // End of namespace Kigo
#include "moc_gamewidget.cpp"

View file

@ -335,3 +335,5 @@ void SetupWidget::whiteIsComputer(bool computer)
}
} // End of namespace Kigo
#include "moc_setupwidget.cpp"