diff options
Diffstat (limited to 'tools/qmlcachegen/qmlcachegen.cpp')
-rw-r--r-- | tools/qmlcachegen/qmlcachegen.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index c0faabe393..fa75d14c8e 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -274,25 +274,41 @@ int main(int argc, char **argv) QCommandLineOption outputFileOption(QStringLiteral("o"), QCoreApplication::translate("main", "Output file name"), QCoreApplication::translate("main", "file name")); parser.addOption(outputFileOption); + QCommandLineOption checkIfSupportedOption(QStringLiteral("check-if-supported"), QCoreApplication::translate("main", "Check if cache generate is supported on the specified target architecture")); + parser.addOption(checkIfSupportedOption); + parser.addPositionalArgument(QStringLiteral("[qml file]"), QStringLiteral("QML source file to generate cache for.")); parser.process(app); - const QStringList sources = parser.positionalArguments(); - if (sources.isEmpty()){ + if (!parser.isSet(targetArchitectureOption)) { + fprintf(stderr, "Target architecture not specified. Please specify with --target-architecture=<arch>\n"); parser.showHelp(); - } else if (sources.count() > 1) { - fprintf(stderr, "%s\n", qPrintable(QStringLiteral("Too many input files specified: '") + sources.join(QStringLiteral("' '")) + QLatin1Char('\''))); return EXIT_FAILURE; } - const QString inputFile = sources.first(); QScopedPointer<QV4::EvalISelFactory> isel; const QString targetArchitecture = parser.value(targetArchitectureOption); isel.reset(QV4::JIT::createISelForArchitecture(targetArchitecture)); + if (parser.isSet(checkIfSupportedOption)) { + if (isel.isNull()) + return EXIT_FAILURE; + else + return EXIT_SUCCESS; + } + + const QStringList sources = parser.positionalArguments(); + if (sources.isEmpty()){ + parser.showHelp(); + } else if (sources.count() > 1) { + fprintf(stderr, "%s\n", qPrintable(QStringLiteral("Too many input files specified: '") + sources.join(QStringLiteral("' '")) + QLatin1Char('\''))); + return EXIT_FAILURE; + } + const QString inputFile = sources.first(); + if (!isel) isel.reset(new QV4::Moth::ISelFactory); |