From fecefdd36978cf2562f0f16f5f79debff7d07f79 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 17 Jul 2019 16:10:31 +0200 Subject: [PATCH] Fix mapping of features to private features When a feature generates a private feature, we should not just repeat the condition but also make it depend on the original feature. In qmake features had different outputs, while we have a 1:1 mapping. For example the developer_build feature had "private_tests" as an output feature. There's no condition attached to the feature and auto-detect is off, so we'd generate qt_feature("developer_build" AUTODETECT OFF) qt_feature("private_tests" AUTODETECT OFF) and that's wrong, because when the user enables the visible feature (developer_build) we want it to propagate to the private_tests feature. Change-Id: Id8408864802fa1e1ed9e67a5f47d1d2fde38d321 Reviewed-by: Leander Beernaert Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor --- configure.cmake | 2 +- src/gui/configure.cmake | 3 +-- util/cmake/configurejson2cmake.py | 13 ++++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/configure.cmake b/configure.cmake index 330c5347c54..cec2bfa183b 100644 --- a/configure.cmake +++ b/configure.cmake @@ -243,7 +243,7 @@ qt_feature("developer_build" ) qt_feature("private_tests" PRIVATE LABEL "Developer build: private_tests" - AUTODETECT OFF + CONDITION QT_FEATURE_developer_build ) qt_feature_definition("developer_build" "QT_BUILD_INTERNAL") qt_feature("appstore_compliant" PUBLIC diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake index f674311ed27..8924d8da5d3 100644 --- a/src/gui/configure.cmake +++ b/src/gui/configure.cmake @@ -655,8 +655,7 @@ qt_feature("opengl_dynamic" ) qt_feature("dynamicgl" PUBLIC LABEL "Dynamic OpenGL: dynamicgl" - AUTODETECT OFF - CONDITION WIN32 AND NOT WINRT + CONDITION QT_FEATURE_opengl_dynamic DISABLE INPUT_angle STREQUAL 'yes' OR INPUT_opengl STREQUAL 'no' OR INPUT_opengl STREQUAL 'desktop' ) qt_feature_definition("opengl_dynamic" "QT_OPENGL_DYNAMIC") diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index f929ac142d1..bede5934a5d 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -788,7 +788,7 @@ def parseFeature(ctx, feature, data, cm_fh): cxxFeature = featureName(feature) - def writeFeature(name, publicFeature=False, privateFeature=False, labelAppend=''): + def writeFeature(name, publicFeature=False, privateFeature=False, labelAppend='', superFeature=None, autoDetect=''): if comment: cm_fh.write('# {}\n'.format(comment)) @@ -804,7 +804,11 @@ def parseFeature(ctx, feature, data, cm_fh): if purpose != label: cm_fh.write(lineify('PURPOSE', purpose)) cm_fh.write(lineify('AUTODETECT', autoDetect, quote=False)) - cm_fh.write(lineify('CONDITION', condition, quote=False)) + if superFeature: + feature_condition = "QT_FEATURE_{}".format(superFeature) + else: + feature_condition = condition + cm_fh.write(lineify('CONDITION', feature_condition, quote=False)) cm_fh.write(lineify('ENABLE', enable, quote=False)) cm_fh.write(lineify('DISABLE', disable, quote=False)) cm_fh.write(lineify('EMIT_IF', emitIf, quote=False)) @@ -814,7 +818,7 @@ def parseFeature(ctx, feature, data, cm_fh): # Default internal feature case. featureCalls = {} - featureCalls[cxxFeature] = {'name': cxxFeature, 'labelAppend': ''} + featureCalls[cxxFeature] = {'name': cxxFeature, 'labelAppend': '', 'autoDetect': autoDetect} # Go over all outputs to compute the number of features that have to be declared for o in output: @@ -836,6 +840,9 @@ def parseFeature(ctx, feature, data, cm_fh): if name not in featureCalls: featureCalls[name] = {'name': name, 'labelAppend': labelAppend} + if name != cxxFeature: + featureCalls[name]['superFeature'] = cxxFeature + if outputType in ['feature', 'publicFeature']: featureCalls[name]['publicFeature'] = True elif outputType == 'privateFeature':