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 <leander.beernaert@qt.io> Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
3212f1b866
commit
fecefdd369
@ -243,7 +243,7 @@ qt_feature("developer_build"
|
|||||||
)
|
)
|
||||||
qt_feature("private_tests" PRIVATE
|
qt_feature("private_tests" PRIVATE
|
||||||
LABEL "Developer build: private_tests"
|
LABEL "Developer build: private_tests"
|
||||||
AUTODETECT OFF
|
CONDITION QT_FEATURE_developer_build
|
||||||
)
|
)
|
||||||
qt_feature_definition("developer_build" "QT_BUILD_INTERNAL")
|
qt_feature_definition("developer_build" "QT_BUILD_INTERNAL")
|
||||||
qt_feature("appstore_compliant" PUBLIC
|
qt_feature("appstore_compliant" PUBLIC
|
||||||
|
@ -655,8 +655,7 @@ qt_feature("opengl_dynamic"
|
|||||||
)
|
)
|
||||||
qt_feature("dynamicgl" PUBLIC
|
qt_feature("dynamicgl" PUBLIC
|
||||||
LABEL "Dynamic OpenGL: dynamicgl"
|
LABEL "Dynamic OpenGL: dynamicgl"
|
||||||
AUTODETECT OFF
|
CONDITION QT_FEATURE_opengl_dynamic
|
||||||
CONDITION WIN32 AND NOT WINRT
|
|
||||||
DISABLE INPUT_angle STREQUAL 'yes' OR INPUT_opengl STREQUAL 'no' OR INPUT_opengl STREQUAL 'desktop'
|
DISABLE INPUT_angle STREQUAL 'yes' OR INPUT_opengl STREQUAL 'no' OR INPUT_opengl STREQUAL 'desktop'
|
||||||
)
|
)
|
||||||
qt_feature_definition("opengl_dynamic" "QT_OPENGL_DYNAMIC")
|
qt_feature_definition("opengl_dynamic" "QT_OPENGL_DYNAMIC")
|
||||||
|
@ -788,7 +788,7 @@ def parseFeature(ctx, feature, data, cm_fh):
|
|||||||
|
|
||||||
cxxFeature = featureName(feature)
|
cxxFeature = featureName(feature)
|
||||||
|
|
||||||
def writeFeature(name, publicFeature=False, privateFeature=False, labelAppend=''):
|
def writeFeature(name, publicFeature=False, privateFeature=False, labelAppend='', superFeature=None, autoDetect=''):
|
||||||
if comment:
|
if comment:
|
||||||
cm_fh.write('# {}\n'.format(comment))
|
cm_fh.write('# {}\n'.format(comment))
|
||||||
|
|
||||||
@ -804,7 +804,11 @@ def parseFeature(ctx, feature, data, cm_fh):
|
|||||||
if purpose != label:
|
if purpose != label:
|
||||||
cm_fh.write(lineify('PURPOSE', purpose))
|
cm_fh.write(lineify('PURPOSE', purpose))
|
||||||
cm_fh.write(lineify('AUTODETECT', autoDetect, quote=False))
|
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('ENABLE', enable, quote=False))
|
||||||
cm_fh.write(lineify('DISABLE', disable, quote=False))
|
cm_fh.write(lineify('DISABLE', disable, quote=False))
|
||||||
cm_fh.write(lineify('EMIT_IF', emitIf, 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.
|
# Default internal feature case.
|
||||||
featureCalls = {}
|
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
|
# Go over all outputs to compute the number of features that have to be declared
|
||||||
for o in output:
|
for o in output:
|
||||||
@ -836,6 +840,9 @@ def parseFeature(ctx, feature, data, cm_fh):
|
|||||||
if name not in featureCalls:
|
if name not in featureCalls:
|
||||||
featureCalls[name] = {'name': name, 'labelAppend': labelAppend}
|
featureCalls[name] = {'name': name, 'labelAppend': labelAppend}
|
||||||
|
|
||||||
|
if name != cxxFeature:
|
||||||
|
featureCalls[name]['superFeature'] = cxxFeature
|
||||||
|
|
||||||
if outputType in ['feature', 'publicFeature']:
|
if outputType in ['feature', 'publicFeature']:
|
||||||
featureCalls[name]['publicFeature'] = True
|
featureCalls[name]['publicFeature'] = True
|
||||||
elif outputType == 'privateFeature':
|
elif outputType == 'privateFeature':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user