aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-03-03 10:35:13 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2017-03-07 07:06:44 +0000
commitba6de61acd3129ad1435f6bca7f564385212f95c (patch)
tree3f982a8f7344e215166aa6e79a8c95ca9e4c8c43 /tools
parent1102f6ca7f1bb09e77f100b7e2afcac9f13e322c (diff)
Fix skipping of qml cache generation on unsupported architectures
Detect support for the target architecture at qmake time and gently skip the process. Change-Id: I7cc22a0cfb9a8b503c182062a56e506035f84fa2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlcachegen/qmlcache.prf16
-rw-r--r--tools/qmlcachegen/qmlcachegen.cpp26
2 files changed, 35 insertions, 7 deletions
diff --git a/tools/qmlcachegen/qmlcache.prf b/tools/qmlcachegen/qmlcache.prf
index e0c62ec4d3..5cac5592c3 100644
--- a/tools/qmlcachegen/qmlcache.prf
+++ b/tools/qmlcachegen/qmlcache.prf
@@ -1,10 +1,22 @@
-qtPrepareTool(QML_CACHEGEN, qmlcachegen)
+static {
+ message("QML cache generation ahead of time is not supported in static builds")
+ return()
+}
+
+qtPrepareTool(QML_CACHEGEN, qmlcachegen, _ARCH_CHECK)
isEmpty(TARGETPATH): error("Must set TARGETPATH (QML import name) for ahead-of-time QML cache generation")
!isEmpty(QT_TARGET_ARCH):QML_CACHEGEN_ARCH=$$QT_TARGET_ARCH
else:QML_CACHEGEN_ARCH=$$QT_ARCH
+QML_CACHEGEN_ARGS=--target-architecture=$$QML_CACHEGEN_ARCH
+
+!system($$QML_CACHEGEN_ARCH_CHECK $$QML_CACHEGEN_ARGS --check-if-supported) {
+ message("QML cache generation requested but target architecture $$QML_CACHEGEN_ARCH is not supported.")
+ return()
+}
+
CACHEGEN_FILES=
for(qmlf, QML_FILES) {
contains(qmlf,.*\\.js$)|contains(qmlf,.*\\.qml$) {
@@ -19,7 +31,7 @@ prefix_build {
qmlcachegen.output = $$[QT_INSTALL_QML]/$$TARGETPATH/${QMAKE_FILE_IN}c
qmlcachegen.CONFIG = no_link target_predeps
}
-qmlcachegen.commands = $$QML_CACHEGEN --target-architecture=$$QML_CACHEGEN_ARCH -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
+qmlcachegen.commands = $$QML_CACHEGEN $$QML_CACHEGEN_ARGS -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
qmlcachegen.name = Generate QML Cache ${QMAKE_FILE_IN}
qmlcachegen.variable_out = GENERATED_FILES
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);