Perl is dead and I don't speak Python, so if someone wants to port it,
be my guest. I needed something that I can use to roll out includemocs
across all Qt modules, and this is it. It works for me™, so I don't
expect to do much development with it.
This is an automated committer script I've been using so far:
# SRCDIR=~~~
# BUILDDIR=~~~~
cd $BUILDDIR
find */src -name mocs_compilation.cpp | while read FILE; do
if grep -qsE '^#include' "$FILE"; then
DIR="$(dirname "$FILE")"
LIB="$(basename "$DIR")"
case "$LIB" in
Q*)
LIB="${LIB%%_autogen}"
;;
*)
LIB="Qt${LIB%%_autogen}"
;;
esac
DIR="${DIR%/*}"
path/to/includemocs6.sh "$SRCROOT/$DIR" "$DIR" "$FILE"
(cd "$SRCROOT/$DIR" && git commit -am "$LIB: includemocs
$(cat "$SRCROOT/commit-msg.txt")" --no-edit)
fi
done
If the script cannot associate a moc file with a cpp file, it will
print a warning and continue.
The script tries to include the moc-file right after the
QT_END_NAMESPACE to work around many TUs ending in an #endif from some
#if QT_CONFIG or other. If there's no QT_END_NAMESPACE, it appends
the include and prints a warning.
Fixes: QTBUG-102886
Pick-to: 6.3 6.2
Change-Id: I16c5a9f845777ea2e82f15611b4fdd32f98ce0bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Compilation and link times in CPU seconds with GCC 7, using precompiled
headers (not including moc, rcc, uic, etc. steps or headersclean):
Before After
Debug -O0 198,1 180,3
Debug -Og 240,7 229,2
Release -O3 267,1 249,2
Release LTO 239,4 229,8
QtCore required a little manual adjusting because some files are
bootstrapped into moc itself and into qmake.
Change-Id: I84e363d735b443cb9beefffd14b8b57c10e7da36
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>