From 0a96302dc12a968b3b5551c9d1168cffe5791668 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 29 May 2019 17:39:56 +0200 Subject: 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 Reviewed-by: Tobias Hunger Reviewed-by: Qt CMake Build Bot --- util/cmake/helper.py | 2 ++ util/cmake/pro2cmake.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/cmake/helper.py b/util/cmake/helper.py index 8f24a49d6b..97397e67ec 100644 --- a/util/cmake/helper.py +++ b/util/cmake/helper.py @@ -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', diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index e2625af266..b45f0e8805 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -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*"?(.*?)"?\)', -- cgit v1.2.3