diff options
author | Timothée Keller <[email protected]> | 2022-12-22 19:02:40 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <[email protected]> | 2023-02-13 19:49:29 +0000 |
commit | 56909fb9367997cfd004cf26abdbd70e5877ac61 (patch) | |
tree | 5337b403314a4e2e1f6a525c59cf0062c2a6e600 | |
parent | f14704177ee5f6b01df0d8147141793fac3a51d6 (diff) |
Windeployqt: add custom qml output directory command line option
Added the qml-deploy-dir option, which deploys imported qml files to
the directory passed as an argument. If no option is given, a "qml"
directory is created, and files are deployed there.
[ChangeLog][QtTools][Windeployqt] Windeployqt's default behavior is
now to deploy qml imports to a "qml" directory inside the deploy
directory, rather than directly to the deploy directory.
Task-number: QTBUG-99516
Change-Id: I49262a38c4a42ef20b05b603f5eb5393fe9cc218
Reviewed-by: Oliver Wolff <[email protected]>
(cherry picked from commit 0b4286ff28748ae1e47d8750f1899df2eb85357e)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
-rw-r--r-- | src/tools/windeployqt/main.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/tools/windeployqt/main.cpp b/src/tools/windeployqt/main.cpp index df4cd9c9640..b5fe9193e0b 100644 --- a/src/tools/windeployqt/main.cpp +++ b/src/tools/windeployqt/main.cpp @@ -293,6 +293,7 @@ struct Options { QStringList languages; QString libraryDirectory; QString pluginDirectory; + QString qmlDirectory; QStringList binaries; JsonOutput *json = nullptr; ListOption list = ListNone; @@ -370,6 +371,11 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse QStringLiteral("path")); parser->addOption(pluginDirOption); + QCommandLineOption qmlDeployDirOption(QStringLiteral("qml-deploy-dir"), + QStringLiteral("Copy qml files to path."), + QStringLiteral("path")); + parser->addOption(qmlDeployDirOption); + QCommandLineOption debugOption(QStringLiteral("debug"), QStringLiteral("Assume debug binaries.")); parser->addOption(debugOption); @@ -508,6 +514,7 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse options->libraryDirectory = parser->value(libDirOption); options->pluginDirectory = parser->value(pluginDirOption); + options->qmlDirectory = parser->value(qmlDeployDirOption); options->plugins = !parser->isSet(noPluginsOption); options->libraries = !parser->isSet(noLibraryOption); options->translations = !parser->isSet(noTranslationOption); @@ -1595,13 +1602,18 @@ static DeployResult deploy(const Options &options, const QMap<QString, QString> // Do not be fooled by QtWebKit.dll depending on Quick into always installing Quick imports // for WebKit1-applications. Check direct dependency only. if (options.quickImports && usesQml2) { + const QString targetPath = options.qmlDirectory.isEmpty() + ? options.directory + QStringLiteral("/qml") + : options.qmlDirectory; + if (!createDirectory(targetPath, errorMessage)) + return result; for (const QmlImportScanResult::Module &module : std::as_const(qmlScanResult.modules)) { - const QString installPath = module.installPath(options.directory); + const QString installPath = module.installPath(targetPath); if (optVerboseLevel > 1) std::wcout << "Installing: '" << module.name << "' from " << module.sourcePath << " to " << QDir::toNativeSeparators(installPath) << '\n'; - if (installPath != options.directory && !createDirectory(installPath, errorMessage)) + if (installPath != targetPath && !createDirectory(installPath, errorMessage)) return result; unsigned updateFileFlags = options.updateFileFlags | SkipQmlDesignerSpecificsDirectories; |