-
Notifications
You must be signed in to change notification settings - Fork 360
Add include moc_*.cpp #1171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add include moc_*.cpp #1171
Conversation
e080113 to
1757131
Compare
|
@linuxdude42 I couldn't figure out how to ignore https://clang.llvm.org/extra/clang-tidy/checks/bugprone/suspicious-include.html for the Is there a way to run Also, |
|
The IgnoredRegex option is not in the version 21 releases, so I can't test it, but I think this would work: |
and move MythNVControl into mythnvcontrol.cpp, hiding the X11 includes from the header file.
and make LOG message selection easier to read.
This improves compiler analysis since the entire class definition
is in one compilation unit and decreases compile and link times
due to fewer object files being linked together. In addition,
for CMake this greatly speeds up incremental compilation since
this avoids the use of mocs_compilation.cpp where every moc_*.cpp
file was included.
Build times with a cleared ccache (no LTO):
Build Test Build plugins
qmake (before): 219.458 39.463 22.682
qmake (after) : 202.001 37.023 17.981
CMake (before): 246.225 24.18 n/a
CMake (after) : 241.419 24.122 n/a
Build times after git clean -xdf (filled ccache) (no LTO):
Build Test Build plugins
qmake (before): 21.777 27.249 1.334
qmake (after) : 21.411 26.920 1.248
CMake (before): 54.205 24.08 n/a
CMake (after) : 53.860 24.148 n/a
A full rebuild with qmake is about 10% faster.
A full rebuild with CMake is about 2% faster.
After git clean -xdf, this is about 1-2% faster.
libmythprotoserver/socketrequesthandler.h is header only,
so mythsocketmanager.cpp is as good a place as any since
it already uses SocketRequestHandler.
mythfrontend/settingshelper.h and most of the files in
mythfrontend/servicecontracts/ and mythbackend/servicesv2/
are header only, so there is no good place to include each
moc_*.cpp file. A few files in mythcommflag,
mythtv-setup/expertsettingseditor.h,
libmythbase/mythsystemprivate.h, libmythtv/channelscan/paneatsc.h,
and libmythtv/channelscan/panedvbutilsimport.h are also header only.
I used the script from
https://raymii.org/s/blog/Qt_add_moc_includes_to_speed_up_compilation.html
and manually touched it up. The script does not account
for Q_OBJECT in a .cpp file.
Some further discussion of this, with some other scripts linked, is here:
https://planet.kde.org/friedrich-kossebau-2023-06-28-include-also-moc-files-of-headers/
This improves compiler analysis since the entire class definition
is in one compilation unit and decreases compile and link times
due to fewer object files being linked together. In addition,
for CMake this greatly speeds up incremental compilation since
this avoids the use of mocs_compilation.cpp where every moc_*.cpp
file was included.
I first had to fix header guards and hide the troublesome X11 headers. This includes #1151 since that moved some of the X11 including headers.
With ccache, this was 1-2% faster. With ccache cleared, qmake was about 10% faster.
Checklist