From 6de11782d093dea2e6fe9406fb712706a984ff61 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 11 Nov 2016 09:09:12 +0100 Subject: Allow checking for the existence of modules in configure.json You can now use 'module.gui' to check whether the Qt Gui module exists in the current build of Qt. Task-number: QTBUG-56656 Change-Id: Ic73f162ed0578e07c70e3ec3706f285b6d09a41d Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qt_configure.prf | 45 +++++++++++++++++++++++++++++++++++---- mkspecs/features/qt_module.prf | 4 ++++ 2 files changed, 45 insertions(+), 4 deletions(-) (limited to 'mkspecs') diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 47772be8de..bdf9f21fc9 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -932,6 +932,15 @@ defineTest(qtRunSingleTest) { qtConfSaveResult($${tpfx}, $$1) } +defineTest(qtConfHaveModule) { + module = $$replace(1, -, _) + !isEmpty(QT.$${module}.skip):$$eval(QT.$${module}.skip): \ + return(false) + !isEmpty(QT.$${module}.name): \ + return(true) + return(false) +} + defineReplace(qtConfEvaluate) { isEmpty(1): return(true) @@ -1015,6 +1024,10 @@ defineReplace(qtConfEvaluateSingleExpression) { var = $$replace(e, "^config\.", "") result = false contains(CONFIG, $$var): result = true + } else: contains(e, "^module\..*") { + var = $$replace(e, "^module\.", "") + result = false + qtConfHaveModule($$var): result = true } else: contains(e, "^arch\..*") { var = $$replace(e, "^arch\.", "") result = false @@ -1183,6 +1196,17 @@ defineTest(qtConfCheckFeature) { return(true) } +defineTest(qtConfCheckModuleCondition) { + QT.$${currentModule}.skip = false + !$$qtConfEvaluate($$eval($${currentConfig}.condition)): \ + QT.$${currentModule}.skip = true + export(QT.$${currentModule}.skip) + + # ensure qtConfHaveModule() works + QT.$${currentModule}.name = - + export(QT.$${currentModule}.name) +} + defineTest(qtConfProcessFeatures) { for (feature, $${currentConfig}.features._KEYS_): \ @@ -1758,15 +1782,28 @@ for (currentConfig, allConfigs) { } } - # process all features - qtConfProcessFeatures() + qtConfCheckModuleCondition() + + qtConfHaveModule($$currentModule) { + # process all features + qtConfProcessFeatures() + } else { + qtConfOutputVar(assign, "privatePro", "QT.$${currentModule}.skip", "true") + } # generate files and reports qtConfProcessOutput() - qtConfCreateReport() - qtConfCreateSummary() + qtConfHaveModule($$currentModule) { + qtConfCreateReport() + qtConfCreateSummary() + } else { + QT_CONFIGURE_SKIPPED_MODULES += " $$currentModule" + } } +!isEmpty(QT_CONFIGURE_SKIPPED_MODULES): \ + qtConfAddNote("The following modules are not being compiled in this configuration:" $$QT_CONFIGURE_SKIPPED_MODULES) + # these come from the pri files loaded above. for (p, QMAKE_POST_CONFIGURE): \ eval($$p) diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 069eec02eb..31d628596c 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -18,6 +18,10 @@ exists($$OUT_PWD/qt$${MODULE}-config.pri) { CONFIG += generated_privates } +skip = $$eval(QT.$${MODULE}.skip) +isEmpty(skip): skip = false +requires(!$$skip) + # Compile as shared/DLL or static according to the option given to configure # unless overridden. Host builds are always static host_build|staticlib: CONFIG += static -- cgit v1.2.3