diff options
author | Andreas Buhr <andreas.buhr@qt.io> | 2021-06-18 15:09:58 +0200 |
---|---|---|
committer | Andreas Buhr <andreas.buhr@qt.io> | 2021-07-09 10:01:26 +0200 |
commit | 1f00b520e62dc19bf710f13bab11b3bf834c672c (patch) | |
tree | 4d9c182e696aa77c891cf6b2fb5793008021806d /src/tools/moc | |
parent | 89a6ec923b5bac1035e473bcbad269e327153979 (diff) |
Let androiddeployqt write a dependency file
Let androiddeployqt write a dependency file so that
the build system knows when to re-run it.
Fixes: QTBUG-94567
Change-Id: I5985d707f257b22789013a74f0a6f7c4de6e5e88
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 857be50b2e193b92de37c3e2bb5124d24d21a253)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/tools/moc')
-rw-r--r-- | src/tools/moc/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/tools/moc/main.cpp | 45 |
2 files changed, 2 insertions, 44 deletions
diff --git a/src/tools/moc/CMakeLists.txt b/src/tools/moc/CMakeLists.txt index 09c4927a53..88dce045f8 100644 --- a/src/tools/moc/CMakeLists.txt +++ b/src/tools/moc/CMakeLists.txt @@ -32,6 +32,7 @@ qt_internal_add_tool(${target_name} INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} ../../3rdparty/tinycbor/src + ../shared ) #### Keys ignored in scope 1:.:.:moc.pro:<TRUE>: diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index a2790fa1f7..3e98fbf2b8 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -27,6 +27,7 @@ ** ****************************************************************************/ +#include <depfile_shared.h> #include "preprocessor.h" #include "moc.h" #include "outputrevision.h" @@ -177,50 +178,6 @@ static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments, return allArguments; } -// Escape characters in given path. Dependency paths are Make-style, not NMake/Jom style. -// The paths can also be consumed by Ninja. -// "$" replaced by "$$" -// "#" replaced by "\#" -// " " replaced by "\ " -// "\#" replaced by "\\#" -// "\ " replaced by "\\\ " -// -// The escape rules are according to what clang / llvm escapes when generating a Make-style -// dependency file. -// Is a template function, because input param can be either a QString or a QByteArray. -template <typename T> struct CharType; -template <> struct CharType<QString> { using type = QLatin1Char; }; -template <> struct CharType<QByteArray> { using type = char; }; -template <typename StringType> -StringType escapeDependencyPath(const StringType &path) -{ - using CT = typename CharType<StringType>::type; - StringType escapedPath; - int size = path.size(); - escapedPath.reserve(size); - for (int i = 0; i < size; ++i) { - if (path[i] == CT('$')) { - escapedPath.append(CT('$')); - } else if (path[i] == CT('#')) { - escapedPath.append(CT('\\')); - } else if (path[i] == CT(' ')) { - escapedPath.append(CT('\\')); - int backwards_it = i - 1; - while (backwards_it > 0 && path[backwards_it] == CT('\\')) { - escapedPath.append(CT('\\')); - --backwards_it; - } - } - escapedPath.append(path[i]); - } - return escapedPath; -} - -QByteArray escapeAndEncodeDependencyPath(const QString &path) -{ - return QFile::encodeName(escapeDependencyPath(path)); -} - int runMoc(int argc, char **argv) { QCoreApplication app(argc, argv); |