summaryrefslogtreecommitdiffstats
path: root/src/macdeployqt/macdeployqt/main.cpp
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2012-11-15 07:08:44 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-07 10:43:25 +0200
commite7758ec86ddfba1262a13169f1688ff547e24602 (patch)
treefba00e39d905a286dbd31458f092d1e2ee97aeb7 /src/macdeployqt/macdeployqt/main.cpp
parent6399d3a8349859f423c225c5fa8fd9231deeb9a2 (diff)
Macdeployqt: Deploy QML imports.
Use qmlimportscanner from QtDeclarative to find used imports. New option: -qmldir=<path> : Deploy imports used by .qml files in the given path. (defaults to ".") Change-Id: I3efa47557a1b5aae0ad838024ba5fe1a98be3b16 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/macdeployqt/macdeployqt/main.cpp')
-rw-r--r--src/macdeployqt/macdeployqt/main.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/macdeployqt/macdeployqt/main.cpp b/src/macdeployqt/macdeployqt/main.cpp
index 92465aec1..811e5d610 100644
--- a/src/macdeployqt/macdeployqt/main.cpp
+++ b/src/macdeployqt/macdeployqt/main.cpp
@@ -57,6 +57,7 @@ int main(int argc, char **argv)
qDebug() << " -no-strip : Don't run 'strip' on the binaries";
qDebug() << " -use-debug-libs : Deploy with debug versions of frameworks and plugins (implies -no-strip)";
qDebug() << " -executable=<path> : Let the given executable use the deployed frameworks too";
+ qDebug() << " -qmldir=<path> : Deploy imports used by .qml files in the given path";
qDebug() << "";
qDebug() << "macdeployqt takes an application bundle as input and makes it";
qDebug() << "self-contained by copying in the Qt frameworks and plugins that";
@@ -85,6 +86,7 @@ int main(int argc, char **argv)
bool useDebugLibs = false;
extern bool runStripEnabled;
QStringList additionalExecutables;
+ QStringList qmlDirs;
for (int i = 2; i < argc; ++i) {
QByteArray argument = QByteArray(argv[i]);
@@ -112,11 +114,18 @@ int main(int argc, char **argv)
logLevel = number;
} else if (argument.startsWith(QByteArray("-executable"))) {
LogDebug() << "Argument found:" << argument;
- int index = argument.indexOf("=");
- if (index < 0 || index >= argument.size())
+ int index = argument.indexOf('=');
+ if (index == -1)
LogError() << "Missing executable path";
else
additionalExecutables << argument.mid(index+1);
+ } else if (argument.startsWith(QByteArray("-qmldir"))) {
+ LogDebug() << "Argument found:" << argument;
+ int index = argument.indexOf('=');
+ if (index == -1)
+ LogError() << "Missing qml directory path";
+ else
+ qmlDirs << argument.mid(index+1);
} else if (argument.startsWith("-")) {
LogError() << "Unknown argument" << argument << "\n";
return 0;
@@ -136,6 +145,17 @@ int main(int argc, char **argv)
createQtConf(appBundlePath);
}
+ // Convenience: Look for .qml files in the current directoty if no -qmldir specified.
+ if (qmlDirs.isEmpty()) {
+ QDir dir;
+ if (!dir.entryList(QStringList() << QStringLiteral("*.qml")).isEmpty()) {
+ qmlDirs += QStringLiteral(".");
+ }
+ }
+
+ if (!qmlDirs.isEmpty())
+ deployQmlImports(appBundlePath, qmlDirs);
+
if (dmg) {
LogNormal();
createDiskImage(appBundlePath);