summaryrefslogtreecommitdiffstats
path: root/src/tools/windeployqt/main.cpp
diff options
context:
space:
mode:
authorTimothée Keller <timothee.keller@qt.io>2022-12-22 19:02:40 +0100
committerTimothée Keller <timothee.keller@qt.io>2023-02-13 18:16:03 +0100
commit0b4286ff28748ae1e47d8750f1899df2eb85357e (patch)
tree33d84073c58787541c4c43e7c535d090effe7a80 /src/tools/windeployqt/main.cpp
parenta2dab1bda9b0e49a745b9070bd96bbe0d3a11ffc (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 Pick-to: 6.5 Change-Id: I49262a38c4a42ef20b05b603f5eb5393fe9cc218 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/tools/windeployqt/main.cpp')
-rw-r--r--src/tools/windeployqt/main.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/tools/windeployqt/main.cpp b/src/tools/windeployqt/main.cpp
index b60aa53f48..7545aaf503 100644
--- a/src/tools/windeployqt/main.cpp
+++ b/src/tools/windeployqt/main.cpp
@@ -181,6 +181,7 @@ struct Options {
QStringList languages;
QString libraryDirectory;
QString pluginDirectory;
+ QString qmlDirectory;
QStringList binaries;
JsonOutput *json = nullptr;
ListOption list = ListNone;
@@ -336,6 +337,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);
@@ -472,6 +478,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);
@@ -1476,13 +1483,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;