From 499771f3eaf48a3a22769298efcb8dee7db6a04a Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 28 May 2019 14:16:01 +0200 Subject: [PATCH] Enhance the porting scripts with some new functionality These were some hard requirements while porting QtQml .pro files so that the generated CMake code is syntactically correct and the result buildable. This include handling of a few more different condition scopes and disabling the c++ make_unique feature test. Change-Id: Iae875ffaf8d100296e8b56b57d076455e5d72006 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann --- util/cmake/configurejson2cmake.py | 2 ++ util/cmake/pro2cmake.py | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index 09f76a272d..148109e2a4 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -620,6 +620,8 @@ def parseFeature(ctx, feature, data, cm_fh): 'c++14': None, 'c++1y': None, 'c++1z': None, + # FIXME: used in qtdeclarative, drop when we require C++14 + 'cxx14_make_unique': None, 'c89': None, 'c99': None, 'ccache': None, diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 7c2a625489..2f4c74b821 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -889,6 +889,17 @@ def map_condition(condition: str) -> str: condition = re.sub(r'\bequals\s*\((.*?),\s*"?(.*?)"?\)', r'\1___equals___\2', condition) condition = re.sub(r'\s*==\s*', '___STREQUAL___', condition) + condition = re.sub(r'\bexists\s*\((.*?)\)', r'EXISTS \1', condition) + + pattern = r'CONFIG\((debug|release),debug\|release\)' + match_result = re.match(pattern, condition) + if match_result: + build_type = match_result.group(1) + if build_type == 'debug': + build_type = 'Debug' + elif build_type == 'release': + build_type = 'Release' + condition = re.sub(pattern, '(CMAKE_BUILD_TYPE STREQUAL {})'.format(build_type), condition) condition = condition.replace('*', '_x_') condition = condition.replace('.$$', '__ss_')