pro2cmake: run make format to fix styling issues

Pick-to: 6.2
Change-Id: I718e34d628576bb709096c0672da3a69b71ae8df
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2021-09-08 15:53:29 +02:00
parent a126b9be89
commit 21a281d962
4 changed files with 82 additions and 34 deletions

View File

@ -72,8 +72,8 @@ def _simplify_expressions(expr, op, matches, replacement):
def _simplify_flavors_in_condition(base: str, flavors, expr): def _simplify_flavors_in_condition(base: str, flavors, expr):
""" Simplify conditions based on the knowledge of which flavors """Simplify conditions based on the knowledge of which flavors
belong to which OS. """ belong to which OS."""
base_expr = simplify_logic(base) base_expr = simplify_logic(base)
false_expr = simplify_logic("false") false_expr = simplify_logic("false")
for flavor in flavors: for flavor in flavors:
@ -100,8 +100,8 @@ def _simplify_os_families(expr, family_members, other_family_members):
def _recursive_simplify(expr): def _recursive_simplify(expr):
""" Simplify the expression as much as possible based on """Simplify the expression as much as possible based on
domain knowledge. """ domain knowledge."""
input_expr = expr input_expr = expr
# Simplify even further, based on domain knowledge: # Simplify even further, based on domain knowledge:

View File

@ -611,7 +611,7 @@ def write_compile_test(
head = detail.get("head") head = detail.get("head")
if isinstance(head, list): if isinstance(head, list):
head = "\n".join(head) head = "\n".join(head)
return head + '\n' if head else '' return head + "\n" if head else ""
head = "" head = ""
if inherit_details: if inherit_details:
@ -646,7 +646,7 @@ def write_compile_test(
tail = detail.get("tail") tail = detail.get("tail")
if isinstance(tail, list): if isinstance(tail, list):
tail = "\n".join(tail) tail = "\n".join(tail)
return tail + '\n' if tail else '' return tail + "\n" if tail else ""
tail = "" tail = ""
if inherit_details: if inherit_details:
@ -656,7 +656,7 @@ def write_compile_test(
sourceCode += tail sourceCode += tail
if sourceCode: # blank line before main if sourceCode: # blank line before main
sourceCode += '\n' sourceCode += "\n"
sourceCode += "int main(void)\n" sourceCode += "int main(void)\n"
sourceCode += "{\n" sourceCode += "{\n"
sourceCode += " /* BEGIN TEST: */\n" sourceCode += " /* BEGIN TEST: */\n"
@ -665,7 +665,7 @@ def write_compile_test(
main = detail.get("main") main = detail.get("main")
if isinstance(main, list): if isinstance(main, list):
main = "\n".join(main) main = "\n".join(main)
return main + '\n' if main else '' return main + "\n" if main else ""
main = "" main = ""
if inherit_details: if inherit_details:
@ -943,7 +943,11 @@ endif()""",
"qreal": { "qreal": {
"condition": 'DEFINED QT_COORD_TYPE AND NOT QT_COORD_TYPE STREQUAL "double"', "condition": 'DEFINED QT_COORD_TYPE AND NOT QT_COORD_TYPE STREQUAL "double"',
"output": [ "output": [
{"type": "define", "name": "QT_COORD_TYPE", "value": "${QT_COORD_TYPE}",}, {
"type": "define",
"name": "QT_COORD_TYPE",
"value": "${QT_COORD_TYPE}",
},
{ {
"type": "define", "type": "define",
"name": "QT_COORD_TYPE_STRING", "name": "QT_COORD_TYPE_STRING",
@ -951,7 +955,9 @@ endif()""",
}, },
], ],
}, },
"reduce_exports": {"condition": "NOT MSVC",}, "reduce_exports": {
"condition": "NOT MSVC",
},
"release": None, "release": None,
"release_tools": None, "release_tools": None,
"rpath": { "rpath": {
@ -1524,6 +1530,7 @@ class special_cased_file:
self.sc_handler.handle_special_cases() self.sc_handler.handle_special_cases()
os.replace(self.gen_file_path, self.file_path) os.replace(self.gen_file_path, self.file_path)
def processJson(path, ctx, data, skip_special_case_preservation=False): def processJson(path, ctx, data, skip_special_case_preservation=False):
ctx["project_dir"] = path ctx["project_dir"] = path
ctx["module"] = data.get("module", "global") ctx["module"] = data.get("module", "global")
@ -1571,7 +1578,7 @@ def main():
quit(1) quit(1)
directory = sys.argv[1] directory = sys.argv[1]
skip_special_case_preservation = '-s' in sys.argv[2:] skip_special_case_preservation = "-s" in sys.argv[2:]
print(f"Processing: {directory}.") print(f"Processing: {directory}.")

View File

@ -148,7 +148,10 @@ _qt_library_map = [
extra=["COMPONENTS", "EglFSDeviceIntegrationPrivate"], extra=["COMPONENTS", "EglFSDeviceIntegrationPrivate"],
), ),
LibraryMapping( LibraryMapping(
"eglfs_kms_support", "Qt6", "Qt::EglFsKmsSupportPrivate", extra=["COMPONENTS", "EglFsKmsSupportPrivate"] "eglfs_kms_support",
"Qt6",
"Qt::EglFsKmsSupportPrivate",
extra=["COMPONENTS", "EglFsKmsSupportPrivate"],
), ),
LibraryMapping( LibraryMapping(
"eglfs_kms_gbm_support", "eglfs_kms_gbm_support",
@ -170,8 +173,12 @@ _qt_library_map = [
"Qt::EventDispatcherSupport", "Qt::EventDispatcherSupport",
extra=["COMPONENTS", "EventDispatcherSupport"], extra=["COMPONENTS", "EventDispatcherSupport"],
), ),
LibraryMapping("fbconvenience", "Qt6", "Qt::FbSupportPrivate", extra=["COMPONENTS", "FbSupportPrivate"]), LibraryMapping(
LibraryMapping("fb_support", "Qt6", "Qt::FbSupportPrivate", extra=["COMPONENTS", "FbSupportPrivate"]), "fbconvenience", "Qt6", "Qt::FbSupportPrivate", extra=["COMPONENTS", "FbSupportPrivate"]
),
LibraryMapping(
"fb_support", "Qt6", "Qt::FbSupportPrivate", extra=["COMPONENTS", "FbSupportPrivate"]
),
LibraryMapping( LibraryMapping(
"fontdatabase_support", "fontdatabase_support",
"Qt6", "Qt6",
@ -195,9 +202,14 @@ _qt_library_map = [
"Qt::HunspellInputMethodPrivate", "Qt::HunspellInputMethodPrivate",
extra=["COMPONENTS", "HunspellInputMethodPrivate"], extra=["COMPONENTS", "HunspellInputMethodPrivate"],
), ),
LibraryMapping("input", "Qt6", "Qt::InputSupportPrivate", extra=["COMPONENTS", "InputSupportPrivate"]),
LibraryMapping( LibraryMapping(
"input_support", "Qt6", "Qt::InputSupportPrivate", extra=["COMPONENTS", "InputSupportPrivate"] "input", "Qt6", "Qt::InputSupportPrivate", extra=["COMPONENTS", "InputSupportPrivate"]
),
LibraryMapping(
"input_support",
"Qt6",
"Qt::InputSupportPrivate",
extra=["COMPONENTS", "InputSupportPrivate"],
), ),
LibraryMapping( LibraryMapping(
"installer-lib", "Qt6", "Qt::AppManInstaller", extra=["COMPONENTS", "AppManInstaller"] "installer-lib", "Qt6", "Qt::AppManInstaller", extra=["COMPONENTS", "AppManInstaller"]
@ -206,8 +218,12 @@ _qt_library_map = [
LibraryMapping("ivicore", "Qt6", "Qt::IviCore", extra=["COMPONENTS", "IviCore"]), LibraryMapping("ivicore", "Qt6", "Qt::IviCore", extra=["COMPONENTS", "IviCore"]),
LibraryMapping("ivimedia", "Qt6", "Qt::IviMedia", extra=["COMPONENTS", "IviMedia"]), LibraryMapping("ivimedia", "Qt6", "Qt::IviMedia", extra=["COMPONENTS", "IviMedia"]),
LibraryMapping("knx", "Qt6", "Qt::Knx", extra=["COMPONENTS", "Knx"]), LibraryMapping("knx", "Qt6", "Qt::Knx", extra=["COMPONENTS", "Knx"]),
LibraryMapping("kmsconvenience", "Qt6", "Qt::KmsSupportPrivate", extra=["COMPONENTS", "KmsSupportPrivate"]), LibraryMapping(
LibraryMapping("kms_support", "Qt6", "Qt::KmsSupportPrivate", extra=["COMPONENTS", "KmsSupportPrivate"]), "kmsconvenience", "Qt6", "Qt::KmsSupportPrivate", extra=["COMPONENTS", "KmsSupportPrivate"]
),
LibraryMapping(
"kms_support", "Qt6", "Qt::KmsSupportPrivate", extra=["COMPONENTS", "KmsSupportPrivate"]
),
LibraryMapping( LibraryMapping(
"launcher-lib", "Qt6", "Qt::AppManLauncher", extra=["COMPONENTS", "AppManLauncher"] "launcher-lib", "Qt6", "Qt::AppManLauncher", extra=["COMPONENTS", "AppManLauncher"]
), ),
@ -251,10 +267,16 @@ _qt_library_map = [
"package-lib", "Qt6", "Qt::AppManPackage", extra=["COMPONENTS", "AppManPackage"] "package-lib", "Qt6", "Qt::AppManPackage", extra=["COMPONENTS", "AppManPackage"]
), ),
LibraryMapping( LibraryMapping(
"packetprotocol", "Qt6", "Qt::PacketProtocolPrivate", extra=["COMPONENTS", "PacketProtocolPrivate"] "packetprotocol",
"Qt6",
"Qt::PacketProtocolPrivate",
extra=["COMPONENTS", "PacketProtocolPrivate"],
), ),
LibraryMapping( LibraryMapping(
"particles", "Qt6", "Qt::QuickParticlesPrivate", extra=["COMPONENTS", "QuickParticlesPrivate"] "particles",
"Qt6",
"Qt::QuickParticlesPrivate",
extra=["COMPONENTS", "QuickParticlesPrivate"],
), ),
LibraryMapping( LibraryMapping(
"plugin-interfaces", "plugin-interfaces",
@ -268,9 +290,15 @@ _qt_library_map = [
), ),
LibraryMapping("printsupport", "Qt6", "Qt::PrintSupport", extra=["COMPONENTS", "PrintSupport"]), LibraryMapping("printsupport", "Qt6", "Qt::PrintSupport", extra=["COMPONENTS", "PrintSupport"]),
LibraryMapping("purchasing", "Qt6", "Qt::Purchasing", extra=["COMPONENTS", "Purchasing"]), LibraryMapping("purchasing", "Qt6", "Qt::Purchasing", extra=["COMPONENTS", "Purchasing"]),
LibraryMapping("qmldebug", "Qt6", "Qt::QmlDebugPrivate", extra=["COMPONENTS", "QmlDebugPrivate"]), LibraryMapping(
LibraryMapping("qmldevtools", "Qt6", "Qt::QmlDevToolsPrivate", extra=["COMPONENTS", "QmlDevToolsPrivate"]), "qmldebug", "Qt6", "Qt::QmlDebugPrivate", extra=["COMPONENTS", "QmlDebugPrivate"]
LibraryMapping("qmlcompiler", "Qt6", "Qt::QmlCompilerPrivate", extra=["COMPONENTS", "QmlCompilerPrivate"]), ),
LibraryMapping(
"qmldevtools", "Qt6", "Qt::QmlDevToolsPrivate", extra=["COMPONENTS", "QmlDevToolsPrivate"]
),
LibraryMapping(
"qmlcompiler", "Qt6", "Qt::QmlCompilerPrivate", extra=["COMPONENTS", "QmlCompilerPrivate"]
),
LibraryMapping("qml", "Qt6", "Qt::Qml", extra=["COMPONENTS", "Qml"]), LibraryMapping("qml", "Qt6", "Qt::Qml", extra=["COMPONENTS", "Qml"]),
LibraryMapping("qmldom", "Qt6", "Qt::QmlDomPrivate", extra=["COMPONENTS", "QmlDomPrivate"]), LibraryMapping("qmldom", "Qt6", "Qt::QmlDomPrivate", extra=["COMPONENTS", "QmlDomPrivate"]),
LibraryMapping("qmlmodels", "Qt6", "Qt::QmlModels", extra=["COMPONENTS", "QmlModels"]), LibraryMapping("qmlmodels", "Qt6", "Qt::QmlModels", extra=["COMPONENTS", "QmlModels"]),
@ -309,7 +337,9 @@ _qt_library_map = [
extra=["COMPONENTS", "QuickControls2Impl"], extra=["COMPONENTS", "QuickControls2Impl"],
), ),
LibraryMapping("quick", "Qt6", "Qt::Quick", extra=["COMPONENTS", "Quick"]), LibraryMapping("quick", "Qt6", "Qt::Quick", extra=["COMPONENTS", "Quick"]),
LibraryMapping("quickshapes", "Qt6", "Qt::QuickShapesPrivate", extra=["COMPONENTS", "QuickShapesPrivate"]), LibraryMapping(
"quickshapes", "Qt6", "Qt::QuickShapesPrivate", extra=["COMPONENTS", "QuickShapesPrivate"]
),
LibraryMapping( LibraryMapping(
"quicktemplates2", "Qt6", "Qt::QuickTemplates2", extra=["COMPONENTS", "QuickTemplates2"] "quicktemplates2", "Qt6", "Qt::QuickTemplates2", extra=["COMPONENTS", "QuickTemplates2"]
), ),
@ -364,7 +394,9 @@ _qt_library_map = [
LibraryMapping("window-lib", "Qt6", "Qt::AppManWindow", extra=["COMPONENTS", "AppManWindow"]), LibraryMapping("window-lib", "Qt6", "Qt::AppManWindow", extra=["COMPONENTS", "AppManWindow"]),
LibraryMapping("winextras", "Qt6", "Qt::WinExtras", extra=["COMPONENTS", "WinExtras"]), LibraryMapping("winextras", "Qt6", "Qt::WinExtras", extra=["COMPONENTS", "WinExtras"]),
LibraryMapping("x11extras", "Qt6", "Qt::X11Extras", extra=["COMPONENTS", "X11Extras"]), LibraryMapping("x11extras", "Qt6", "Qt::X11Extras", extra=["COMPONENTS", "X11Extras"]),
LibraryMapping("xcb_qpa_lib", "Qt6", "Qt::XcbQpaPrivate", extra=["COMPONENTS", "XcbQpaPrivate"]), LibraryMapping(
"xcb_qpa_lib", "Qt6", "Qt::XcbQpaPrivate", extra=["COMPONENTS", "XcbQpaPrivate"]
),
LibraryMapping( LibraryMapping(
"xkbcommon_support", "Qt6", "Qt::XkbCommonSupport", extra=["COMPONENTS", "XkbCommonSupport"] "xkbcommon_support", "Qt6", "Qt::XkbCommonSupport", extra=["COMPONENTS", "XkbCommonSupport"]
), ),
@ -374,7 +406,10 @@ _qt_library_map = [
"qmlworkerscript", "Qt6", "Qt::QmlWorkerScript", extra=["COMPONENTS", "QmlWorkerScript"] "qmlworkerscript", "Qt6", "Qt::QmlWorkerScript", extra=["COMPONENTS", "QmlWorkerScript"]
), ),
LibraryMapping( LibraryMapping(
"quickparticles", "Qt6", "Qt::QuickParticlesPrivate", extra=["COMPONENTS", "QuickParticlesPrivate"] "quickparticles",
"Qt6",
"Qt::QuickParticlesPrivate",
extra=["COMPONENTS", "QuickParticlesPrivate"],
), ),
LibraryMapping( LibraryMapping(
"linuxofono_support", "linuxofono_support",
@ -402,7 +437,9 @@ _qt_library_map = [
_library_map = [ _library_map = [
# 3rd party: # 3rd party:
LibraryMapping("atspi", "ATSPI2", "PkgConfig::ATSPI2"), LibraryMapping("atspi", "ATSPI2", "PkgConfig::ATSPI2"),
LibraryMapping("backtrace", "WrapBacktrace", "WrapBacktrace::WrapBacktrace", emit_if="config.unix"), LibraryMapping(
"backtrace", "WrapBacktrace", "WrapBacktrace::WrapBacktrace", emit_if="config.unix"
),
LibraryMapping("bluez", "BlueZ", "PkgConfig::BlueZ"), LibraryMapping("bluez", "BlueZ", "PkgConfig::BlueZ"),
LibraryMapping("brotli", "WrapBrotli", "WrapBrotli::WrapBrotliDec"), LibraryMapping("brotli", "WrapBrotli", "WrapBrotli::WrapBrotliDec"),
LibraryMapping("corewlan", None, None), LibraryMapping("corewlan", None, None),
@ -496,7 +533,9 @@ _library_map = [
LibraryMapping("sqlite2", None, None), # No more sqlite2 support in Qt6! LibraryMapping("sqlite2", None, None), # No more sqlite2 support in Qt6!
LibraryMapping("sqlite3", "SQLite3", "SQLite::SQLite3"), LibraryMapping("sqlite3", "SQLite3", "SQLite::SQLite3"),
LibraryMapping("sqlite", "SQLite3", "SQLite::SQLite3"), LibraryMapping("sqlite", "SQLite3", "SQLite::SQLite3"),
LibraryMapping("taglib", "WrapTagLib", "WrapTagLib::WrapTagLib", is_bundled_with_qt=True), # used in qtivi LibraryMapping(
"taglib", "WrapTagLib", "WrapTagLib::WrapTagLib", is_bundled_with_qt=True
), # used in qtivi
LibraryMapping("tslib", "Tslib", "PkgConfig::Tslib"), LibraryMapping("tslib", "Tslib", "PkgConfig::Tslib"),
LibraryMapping("udev", "Libudev", "PkgConfig::Libudev"), LibraryMapping("udev", "Libudev", "PkgConfig::Libudev"),
LibraryMapping("udev", "Libudev", "PkgConfig::Libudev"), # see also libudev! LibraryMapping("udev", "Libudev", "PkgConfig::Libudev"), # see also libudev!
@ -681,7 +720,7 @@ def find_library_info_for_target(targetName: str) -> typing.Optional[LibraryMapp
# For a given qmake library (e.g. 'openssl_headers'), check whether this is a fake library used # For a given qmake library (e.g. 'openssl_headers'), check whether this is a fake library used
# for the /nolink annotation, and return the actual annotated qmake library ('openssl/nolink'). # for the /nolink annotation, and return the actual annotated qmake library ('openssl/nolink').
def find_annotated_qmake_lib_name(lib : str) -> str: def find_annotated_qmake_lib_name(lib: str) -> str:
for entry in _library_map: for entry in _library_map:
if entry.no_link_so_name == lib: if entry.no_link_so_name == lib:
return entry.soName + "/nolink" return entry.soName + "/nolink"

View File

@ -3194,7 +3194,9 @@ def write_main_part(
cm_fh.write(f"{spaces(indent)}if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)\n") cm_fh.write(f"{spaces(indent)}if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)\n")
cm_fh.write(f"{spaces(indent+1)}cmake_minimum_required(VERSION 3.16)\n") cm_fh.write(f"{spaces(indent+1)}cmake_minimum_required(VERSION 3.16)\n")
cm_fh.write(f"{spaces(indent+1)}project({name} LANGUAGES C CXX ASM)\n") cm_fh.write(f"{spaces(indent+1)}project({name} LANGUAGES C CXX ASM)\n")
cm_fh.write(f"{spaces(indent+1)}find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)\n") cm_fh.write(
f"{spaces(indent+1)}find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)\n"
)
cm_fh.write(f"{spaces(indent)}endif()\n\n") cm_fh.write(f"{spaces(indent)}endif()\n\n")
test_data = scope.expand("TESTDATA") test_data = scope.expand("TESTDATA")
@ -3865,9 +3867,9 @@ def write_example(
property_win32, property_mac_bundle = get_win32_and_mac_bundle_properties(scope) property_win32, property_mac_bundle = get_win32_and_mac_bundle_properties(scope)
if property_win32: if property_win32:
add_target += ' ' + "WIN32" add_target += " " + "WIN32"
if property_mac_bundle: if property_mac_bundle:
add_target += ' ' + "MACOSX_BUNDLE" add_target += " " + "MACOSX_BUNDLE"
write_all_source_file_lists(cm_fh, scope, add_target, indent=0) write_all_source_file_lists(cm_fh, scope, add_target, indent=0)
cm_fh.write(")\n") cm_fh.write(")\n")