qt5base-lts/util/includemocs
Marc Mutz dffca8bb0e Add a simple Qt 6/CMake-compatible script a la includemocs.py
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>
2022-05-05 04:26:19 +00:00
..
includemocs6.sh Add a simple Qt 6/CMake-compatible script a la includemocs.py 2022-05-05 04:26:19 +00:00
includemocs.pl QtCore: include mocs 2017-05-05 03:03:30 +00:00