More fixes to conversion script while porting qtdeclarative

Hardcode a few cases regarding scopes containing "qtConfig(opengl)".
These arew few, and contain regular expressions, to just manually
check and replace them.

Add a new entry to _qt_library_map for handling QmlModels module.

Fix Scope.children property to recursively access the .children
property on included scopes (instead of just ._children) so that
we get the full list of scopes from included children that include
other scopes. This is needed for nested .pri files.

Fix mapping of "win*" to WIN32.

Change-Id: If949a8051f517683e56cda605733719daadb384a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
This commit is contained in:
Alexandru Croitor 2019-05-29 17:39:56 +02:00
parent e88864578a
commit 0a96302dc1
2 changed files with 10 additions and 1 deletions

View File

@ -132,6 +132,7 @@ _qt_library_map = [
LibraryMapping('qmldebug', 'Qt5', 'Qt::QmlDebug', extra = ['COMPONENTS', 'QmlDebug']),
LibraryMapping('qmldevtools', 'Qt5', 'Qt::QmlDevTools', extra = ['COMPONENTS', 'QmlDevTools']),
LibraryMapping('qml', 'Qt5', 'Qt::Qml', extra = ['COMPONENTS', 'Qml']),
LibraryMapping('qmlmodels', 'Qt5', 'Qt::QmlModels', extra = ['COMPONENTS', 'QmlModels']),
LibraryMapping('qmltest', 'Qt5', 'Qt::QuickTest', extra = ['COMPONENTS', 'QuickTest']),
LibraryMapping('qtmultimediaquicktools', 'Qt5', 'Qt::MultimediaQuick', extra = ['COMPONENTS', 'MultimediaQuick']),
LibraryMapping('quick3danimation', 'Qt5', 'Qt::3DQuickAnimation', extra = ['COMPONENTS', '3DQuickAnimation']),
@ -325,6 +326,7 @@ def map_qt_library(lib: str) -> str:
platform_mapping = {
'win32': 'WIN32',
'win': 'WIN32',
'unix': 'UNIX',
'darwin': 'APPLE',
'linux': 'LINUX',

View File

@ -523,7 +523,7 @@ class Scope(object):
def children(self) -> typing.List['Scope']:
result = list(self._children)
for include_scope in self._included_children:
result += include_scope._children
result += include_scope.children
return result
def dump(self, *, indent: int = 0) -> None:
@ -891,6 +891,13 @@ def parseProFile(file: str, *, debug=False):
def map_condition(condition: str) -> str:
# Some hardcoded cases that are too bothersome to generalize.
condition = re.sub(r'^qtConfig\(opengl\(es1\|es2\)\?\)$',
r'QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3',
condition)
condition = re.sub(r'^qtConfig\(opengl\.\*\)$', r'QT_FEATURE_opengl', condition)
condition = re.sub(r'^win\*$', r'win', condition)
condition = re.sub(r'\bif\s*\((.*?)\)', r'\1', condition)
condition = re.sub(r'\bisEmpty\s*\((.*?)\)', r'\1_ISEMPTY', condition)
condition = re.sub(r'\bcontains\s*\((.*?),\s*"?(.*?)"?\)',