diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2019-08-30 14:34:03 +0200 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2019-08-30 14:47:16 +0200 |
commit | a5ba29b79d4793a3c18aaf64f24582d93c0fe4e8 (patch) | |
tree | 8cf492771cca5b0fe26a409c2949cd10d6736e75 /src | |
parent | 11206b5340cf6551d01b266cf096d1641796d300 (diff) |
Add support to override Qml Import Scanner binary to androiddeployqt
This patch is required to properly support the CMake port of Qt. With
CMake we have to build the host tools separately. When androiddeployqt
attempts locate the qmlimportscanner binary it is unable to do so,
since its not build.
This patch adds the --qml-importscanner-binary option to androiddeployqt
and it also allows the optio to be set via the qml-importscanner-binary
setting in the deployment configuration file.
Change-Id: I5393340bc1bc3e8fedae69f8bc3eb5adfe7dbfd7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 4cba67051b..8a95086eef 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -129,6 +129,7 @@ struct Options , jarSigner(false) , installApk(false) , uninstallApk(false) + , qmlImportScannerBinaryPath() {} enum DeploymentMechanism @@ -230,6 +231,9 @@ struct Options QStringList initClasses; QStringList permissions; QStringList features; + + // Override qml import scanner path + QString qmlImportScannerBinaryPath; }; static const QHash<QByteArray, QByteArray> elfArchitecures = { @@ -520,6 +524,8 @@ Options parseOptions() options.generateAssetsFileList = false; } else if (argument.compare(QLatin1String("--aux-mode"), Qt::CaseInsensitive) == 0) { options.auxMode = true; + } else if (argument.compare(QLatin1String("--qml-importscanner-binary"), Qt::CaseInsensitive) == 0) { + options.qmlImportScannerBinaryPath = arguments.at(++i).trimmed(); } } @@ -602,6 +608,10 @@ void printHelp() " dependencies into the build directory and update the XML templates.\n" " The project will not be built or installed.\n" " --apk <path/where/to/copy/the/apk>: Path where to copy the built apk.\n" + " --qml-importscanner-binary <path/to/qmlimportscanner>: Override the\n" + " default qmlimportscanner binary path. By default the\n" + " qmlimportscanner binary is located using the Qt directory\n" + " specified in the input file.\n" " --help: Displays this information.\n\n", qPrintable(QCoreApplication::arguments().at(0)) ); @@ -923,6 +933,12 @@ bool readInputFile(Options *options) } { + const QJsonValue qmlImportScannerBinaryPath = jsonObject.value(QLatin1String("qml-importscanner-binary")); + if (!qmlImportScannerBinaryPath.isUndefined()) + options->qmlImportScannerBinaryPath = qmlImportScannerBinaryPath.toString(); + } + + { const QJsonValue applicationBinary = jsonObject.value(QLatin1String("application-binary")); if (applicationBinary.isUndefined()) { fprintf(stderr, "No application binary defined in json file.\n"); @@ -1726,10 +1742,15 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies) if (options->verbose) fprintf(stdout, "Scanning for QML imports.\n"); - QString qmlImportScanner = options->qtInstallDirectory + QLatin1String("/bin/qmlimportscanner"); + QString qmlImportScanner; + if (!options->qmlImportScannerBinaryPath.isEmpty()) { + qmlImportScanner = options->qmlImportScannerBinaryPath; + } else { + options->qtInstallDirectory + QLatin1String("/bin/qmlimportscanner"); #if defined(Q_OS_WIN32) - qmlImportScanner += QLatin1String(".exe"); + qmlImportScanner += QLatin1String(".exe"); #endif + } if (!QFile::exists(qmlImportScanner)) { fprintf(stderr, "qmlimportscanner not found: %s\n", qPrintable(qmlImportScanner)); |