CMake: Improve mapping of libraries

Merge all data related to mapping libraries into one data structure
in helper.py.

Use that data for everything related to library mapping.

This change enables way more features now like e.g. adding find_package
calls into generated files.

Change-Id: Ibbd2a1063cbeb65277582d434a6a672d62fc170b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Tobias Hunger 2019-05-03 15:02:32 +02:00 committed by Simon Hausmann
parent 9618434de5
commit 7874ce7801
11 changed files with 311 additions and 299 deletions

5
cmake/FindXRender.cmake Normal file
View File

@ -0,0 +1,5 @@
include(FindPkgConfig)
if(NOT TARGET PkgConfig::xrender)
pkg_check_modules(XRender xrender IMPORTED_TARGET)
endif()

View File

@ -8,6 +8,7 @@
qt_find_package(ZLIB PROVIDED_TARGETS ZLIB::ZLIB) qt_find_package(ZLIB PROVIDED_TARGETS ZLIB::ZLIB)
qt_find_package(ZSTD PROVIDED_TARGETS ZSTD::ZSTD) qt_find_package(ZSTD PROVIDED_TARGETS ZSTD::ZSTD)
qt_find_package(DBus1 PROVIDED_TARGETS dbus-1)
qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev) qt_find_package(Libudev PROVIDED_TARGETS PkgConfig::Libudev)
@ -414,7 +415,7 @@ qt_feature("dbus" PUBLIC PRIVATE
qt_feature_definition("dbus" "QT_NO_DBUS" NEGATE VALUE "1") qt_feature_definition("dbus" "QT_NO_DBUS" NEGATE VALUE "1")
qt_feature("dbus_linked" PRIVATE qt_feature("dbus_linked" PRIVATE
LABEL "Qt D-Bus directly linked to libdbus" LABEL "Qt D-Bus directly linked to libdbus"
CONDITION QT_FEATURE_dbus AND libs.dbus OR FIXME CONDITION QT_FEATURE_dbus AND DBus1_FOUND
ENABLE INPUT_dbus STREQUAL 'linked' ENABLE INPUT_dbus STREQUAL 'linked'
DISABLE INPUT_dbus STREQUAL 'runtime' DISABLE INPUT_dbus STREQUAL 'runtime'
) )

View File

@ -12,14 +12,14 @@ set_property(CACHE INPUT_iconv PROPERTY STRINGS undefined no yes posix sun gnu)
qt_find_package(GLIB2 PROVIDED_TARGETS GLIB2::GLIB2) qt_find_package(GLIB2 PROVIDED_TARGETS GLIB2::GLIB2)
qt_find_package(ICU COMPONENTS i18n uc data PROVIDED_TARGETS ICU::i18n ICU::uc ICU::data) qt_find_package(ICU COMPONENTS i18n uc data PROVIDED_TARGETS ICU::i18n ICU::uc ICU::data)
qt_find_package(Libsystemd) qt_find_package(Libsystemd PROVIDED_TARGETS PkgConfig::Libsystemd)
qt_find_package(Atomic PROVIDED_TARGETS Atomic) qt_find_package(Atomic PROVIDED_TARGETS Atomic)
qt_find_package(WrapRt PROVIDED_TARGETS WrapRt) qt_find_package(WrapRt PROVIDED_TARGETS WrapRt)
qt_find_package(LTTngUST) qt_find_package(LTTngUST PROVIDED_TARGETS LTTng::UST)
qt_find_package(PCRE2 PROVIDED_TARGETS PCRE2) qt_find_package(PCRE2 PROVIDED_TARGETS PCRE2)
set_package_properties(PCRE2 PROPERTIES TYPE REQUIRED) set_package_properties(PCRE2 PROPERTIES TYPE REQUIRED)
qt_find_package(PPS) qt_find_package(PPS PROVIDED_TARGETS PPS::PPS)
qt_find_package(Slog2) qt_find_package(Slog2 PROVIDED_TARGETS Slog2::Slog2)
#### Tests #### Tests

View File

@ -579,7 +579,7 @@ extend_target(Gui CONDITION QT_FEATURE_vulkan
vulkan/qvulkaninstance.cpp vulkan/qvulkaninstance.h vulkan/qvulkaninstance.cpp vulkan/qvulkaninstance.h
vulkan/qvulkanwindow.cpp vulkan/qvulkanwindow.h vulkan/qvulkanwindow_p.h vulkan/qvulkanwindow.cpp vulkan/qvulkanwindow.h vulkan/qvulkanwindow_p.h
PUBLIC_LIBRARIES PUBLIC_LIBRARIES
Vulkan::Vulkan_nolink # special case Vulkan::Vulkan_nolink
) )
# special case: # special case:

View File

@ -24,25 +24,40 @@ set_property(CACHE INPUT_xcb PROPERTY STRINGS undefined no yes qt system)
qt_find_package(ATSPI2 PROVIDED_TARGETS PkgConfig::ATSPI2) qt_find_package(ATSPI2 PROVIDED_TARGETS PkgConfig::ATSPI2)
qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm) qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm)
qt_find_package(EGL) qt_find_package(EGL PROVIDED_TARGETS EGL::EGL)
qt_find_package(Freetype PROVIDED_TARGETS Freetype::Freetype) qt_find_package(Freetype PROVIDED_TARGETS Freetype::Freetype)
set_package_properties(Freetype PROPERTIES TYPE REQUIRED) set_package_properties(Freetype PROPERTIES TYPE REQUIRED)
qt_find_package(Fontconfig PROVIDED_TARGETS Fontconfig::Fontconfig) qt_find_package(Fontconfig PROVIDED_TARGETS Fontconfig::Fontconfig)
qt_find_package(gbm PROVIDED_TARGETS gbm::gbm) qt_find_package(gbm PROVIDED_TARGETS gbm::gbm)
qt_find_package(harfbuzz PROVIDED_TARGETS harfbuzz::harfbuzz) qt_find_package(harfbuzz PROVIDED_TARGETS harfbuzz::harfbuzz)
qt_find_package(Libinput PROVIDED_TARGETS Libinput::Libinput) qt_find_package(Libinput PROVIDED_TARGETS Libinput::Libinput)
qt_find_package(JPEG) qt_find_package(JPEG PROVIDED_TARGETS JPEG::JPEG)
qt_find_package(PNG PROVIDED_TARGETS PNG::PNG) qt_find_package(PNG PROVIDED_TARGETS PNG::PNG)
qt_find_package(Mtdev PROVIDED_TARGETS PkgConfig::Mtdev) qt_find_package(Mtdev PROVIDED_TARGETS PkgConfig::Mtdev)
qt_find_package(OpenGL) qt_find_package(OpenGL PROVIDED_TARGETS OpenGL::GL)
qt_find_package(GLESv2) qt_find_package(GLESv2 PROVIDED_TARGETS GLESv2::GLESv2)
qt_find_package(Tslib PROVIDED_TARGETS PkgConfig::Tslib) qt_find_package(Tslib PROVIDED_TARGETS PkgConfig::Tslib)
qt_find_package(Vulkan) qt_find_package(Vulkan PROVIDED_TARGETS Vulkan::Vulkan)
qt_find_package(Wayland) qt_find_package(Wayland PROVIDED_TARGETS Wayland::Server)
qt_find_package(X11) qt_find_package(X11 PROVIDED_TARGETS X11::XCB)
qt_find_package(X11 PROVIDED_TARGETS ${X11_SM_LIB} ${X11_ICE_LIB})
qt_find_package(XCB 1.9 PROVIDED_TARGETS XCB::XCB) qt_find_package(XCB 1.9 PROVIDED_TARGETS XCB::XCB)
qt_find_package(X11_XCB PROVIDED_TARGETS X11::XCB) qt_find_package(XCB COMPONENTS ICCCM PROVIDED_TARGETS XCB::ICCCM)
qt_find_package(XCB COMPONENTS IMAGE PROVIDED_TARGETS XCB::IMAGE)
qt_find_package(XCB COMPONENTS KEYSYMS PROVIDED_TARGETS XCB::KEYSYMS)
qt_find_package(XCB COMPONENTS RENDERUTIL PROVIDED_TARGETS XCB::RENDERUTIL)
qt_find_package(XCB COMPONENTS RANDR PROVIDED_TARGETS XCB::RANDR)
qt_find_package(XCB COMPONENTS SHAPE PROVIDED_TARGETS XCB::SHAPE)
qt_find_package(XCB COMPONENTS SHM PROVIDED_TARGETS XCB::SHM)
qt_find_package(XCB COMPONENTS SYNC PROVIDED_TARGETS XCB::SYNC)
qt_find_package(XCB COMPONENTS XFIXES PROVIDED_TARGETS XCB::XFIXES)
qt_find_package(XCB COMPONENTS XINERAMA PROVIDED_TARGETS XCB::XINERAMA)
qt_find_package(XCB COMPONENTS XKB PROVIDED_TARGETS XCB::XKB)
qt_find_package(XCB PROVIDED_TARGETS XCB::RENDER)
qt_find_package(XCB PROVIDED_TARGETS XCB::GLX)
qt_find_package(XCB COMPONENTS XINPUT PROVIDED_TARGETS XCB::XINPUT)
qt_find_package(XKB 0.4.1 PROVIDED_TARGETS XKB::XKB) qt_find_package(XKB 0.4.1 PROVIDED_TARGETS XKB::XKB)
qt_find_package(XRender PROVIDED_TARGETS PkgConfig::xrender)
#### Tests #### Tests
@ -728,7 +743,7 @@ qt_feature("xcb_egl_plugin" PRIVATE
) )
qt_feature("xcb_native_painting" PRIVATE qt_feature("xcb_native_painting" PRIVATE
LABEL "Native painting (experimental)" LABEL "Native painting (experimental)"
CONDITION QT_FEATURE_xcb_xlib AND QT_FEATURE_fontconfig AND XCB_RENDER_FOUND CONDITION QT_FEATURE_xcb_xlib AND QT_FEATURE_fontconfig AND XRender_FOUND
EMIT_IF QT_FEATURE_xcb EMIT_IF QT_FEATURE_xcb
) )
qt_feature("xrender" PRIVATE qt_feature("xrender" PRIVATE
@ -738,7 +753,7 @@ qt_feature("xrender" PRIVATE
) )
qt_feature("xkb" PRIVATE qt_feature("xkb" PRIVATE
LABEL "XCB XKB" LABEL "XCB XKB"
CONDITION ( NOT ON OR XCB_XKB_FOUND ) AND libs.xkbcommon_x11 OR FIXME CONDITION ( NOT ON OR XCB_XKB_FOUND ) AND XKB_FOUND
EMIT_IF QT_FEATURE_xcb EMIT_IF QT_FEATURE_xcb
) )
qt_feature("xcb_xlib" PRIVATE qt_feature("xcb_xlib" PRIVATE

View File

@ -7,7 +7,8 @@
#### Libraries #### Libraries
qt_find_package(Libproxy PROVIDED_TARGETS PkgConfig::Libproxy) qt_find_package(Libproxy PROVIDED_TARGETS PkgConfig::Libproxy)
qt_find_package(OpenSSL) qt_find_package(OpenSSL PROVIDED_TARGETS OpenSSL::SSL)
qt_find_package(OpenSSL PROVIDED_TARGETS OpenSSL::SSL)
#### Tests #### Tests

View File

@ -8,7 +8,7 @@
qt_find_package(PostgreSQL PROVIDED_TARGETS PostgreSQL::PostgreSQL) qt_find_package(PostgreSQL PROVIDED_TARGETS PostgreSQL::PostgreSQL)
qt_find_package(ODBC PROVIDED_TARGETS ODBC::ODBC) qt_find_package(ODBC PROVIDED_TARGETS ODBC::ODBC)
qt_find_package(SQLite3) qt_find_package(SQLite3 PROVIDED_TARGETS SQLite::SQLite3)
#### Tests #### Tests

View File

@ -6,7 +6,7 @@
#### Libraries #### Libraries
qt_find_package(GTK3) qt_find_package(GTK3 PROVIDED_TARGETS PkgConfig::GTK3)
#### Tests #### Tests

View File

@ -33,7 +33,7 @@ import re
import sys import sys
from typing import Set, Union, List, Dict from typing import Set, Union, List, Dict
from helper import map_qt_library, featureName, substitute_platform, qmake_library_to_cmake_target_mapping from helper import map_qt_library, featureName, substitute_platform, find_library_mapping
knownTests = set() # type: Set[str] knownTests = set() # type: Set[str]
@ -44,70 +44,6 @@ class LibraryMapping:
self.resultVariable = resultVariable self.resultVariable = resultVariable
self.appendFoundSuffix = appendFoundSuffix self.appendFoundSuffix = appendFoundSuffix
def map_library(lib: str) -> Union[str, LibraryMapping, List[str]]:
libmap = {
'atspi': 'ATSPI2',
'corewlan': None, # Framework
'cups': 'Cups',
'double-conversion': None,
'drm': 'Libdrm',
'egl': 'EGL',
'fontconfig': LibraryMapping(package='Fontconfig', resultVariable="FONTCONFIG"),
'freetype': ['Freetype', 'REQUIRED'],
'gbm': 'gbm',
'glib': 'GLIB2',
'gnu_iconv': None,
'gtk3': 'GTK3',
'harfbuzz': 'harfbuzz',
'host_dbus': None,
'icu': ['ICU', 'COMPONENTS', 'i18n', 'uc', 'data'],
'journald': 'Libsystemd',
'libatomic': 'Atomic',
'libdl': None, # handled by CMAKE_DL_LIBS
'libinput': 'Libinput',
'libjpeg': 'JPEG',
'libpng': 'PNG',
'libproxy': 'Libproxy',
'librt': 'WrapRt',
'libudev': 'Libudev',
'lttng-ust': LibraryMapping(package='LTTngUST', resultVariable="LTTNGUST"),
'mtdev': 'Mtdev',
'odbc': 'ODBC',
'opengl': LibraryMapping(package="OpenGL", resultVariable="OpenGL_OpenGL"),
'openssl': 'OpenSSL',
'openssl_headers': LibraryMapping(package="OpenSSL", resultVariable="OPENSSL_INCLUDE_DIR", appendFoundSuffix=False),
'pcre2': ['PCRE2', 'REQUIRED'],
'posix_iconv': None,
'pps': 'PPS',
'psql': 'PostgreSQL',
'slog2': 'Slog2',
'sqlite3': 'SQLite3',
'sun_iconv': None,
'tslib': 'Tslib',
'udev': 'Libudev',
'vulkan': 'Vulkan',
'wayland_server': 'Wayland',
'x11sm': LibraryMapping(package="X11", resultVariable="X11_SM"),
'xcb_glx': LibraryMapping(package="XCB", resultVariable="XCB_GLX"),
'xcb_render': LibraryMapping(package="XCB", resultVariable="XCB_RENDER"),
'xcb': ['XCB', '1.9'],
'xcb_xinput': LibraryMapping(package="XCB", resultVariable="XCB_XINPUT"),
'xcb_xkb': LibraryMapping(package="XCB", resultVariable="XCB_XKB"),
'xcb_xlib': 'X11_XCB',
'xkbcommon': ['XKB', '0.4.1'],
'xlib': 'X11',
'xrender': LibraryMapping(package="XCB", resultVariable="XCB_RENDER"),
'zlib': 'ZLIB',
'zstd': 'ZSTD',
'opengl_es2': 'GLESv2',
} # type: Dict[str, Union[str, List[str], LibraryMapping]]
if lib not in libmap:
raise Exception(' XXXX Unknown library "{}".'.format(lib))
return libmap[lib]
def map_tests(test: str) -> str: def map_tests(test: str) -> str:
testmap = { testmap = {
'c++11': '$<COMPILE_FEATURES:cxx_std_11>', 'c++11': '$<COMPILE_FEATURES:cxx_std_11>',
@ -229,49 +165,48 @@ def processFiles(ctx, data):
return ctx return ctx
def parseLib(ctx, lib, data, cm_fh, cmake_find_packages_set): def parseLib(ctx, lib, data, cm_fh, cmake_find_packages_set):
extra = [] newlib = find_library_mapping(lib)
try: if not newlib:
newlib = map_library(lib) print(' XXXX Unknown library "{}".'.format(lib))
if isinstance(newlib, list): return
extra = newlib[1:]
newlib = newlib[0]
elif isinstance(newlib, LibraryMapping):
newlib = newlib.package
except Exception:
return ctx
if newlib is None: if newlib.packageName is None:
print(' **** Skipping library "{}" -- was masked.'.format(lib)) print(' **** Skipping library "{}" -- was masked.'.format(lib))
return return
print(' mapped library {} to {}.'.format(lib, newlib)) print(' mapped library {} to {}.'.format(lib, newlib))
# Avoid duplicate find_package calls. # Avoid duplicate find_package calls.
if newlib in cmake_find_packages_set: if newlib.targetName in cmake_find_packages_set:
return return
cmake_find_packages_set.add(newlib) cmake_find_packages_set.add(newlib.targetName)
isRequired = False isRequired = False
extra = newlib.extra.copy()
if extra: if extra:
if "REQUIRED" in extra: if "REQUIRED" in extra:
isRequired = True isRequired = True
extra.remove("REQUIRED") extra.remove("REQUIRED")
# If we have a mapping from a qmake library to a CMake target name, cmake_target_name = newlib.targetName
# encode that in the qt_find_package call().
cmake_target_name = qmake_library_to_cmake_target_mapping.get(lib, None) # _nolink or not does not matter at this point:
if cmake_target_name.endswith('_nolink') or cmake_target_name.endswith('/nolink'):
cmake_target_name = cmake_target_name[:-7]
if cmake_target_name: if cmake_target_name:
extra += ['PROVIDED_TARGETS', cmake_target_name] extra += ['PROVIDED_TARGETS', cmake_target_name]
if extra: if extra:
cm_fh.write('qt_find_package({} {})\n'.format(newlib, ' '.join(extra))) cm_fh.write('qt_find_package({} {})\n'.format(newlib.packageName, ' '.join(extra)))
else: else:
cm_fh.write('qt_find_package({})\n'.format(newlib)) cm_fh.write('qt_find_package({})\n'.format(newlib.packageName))
if isRequired: if isRequired:
cm_fh.write('set_package_properties({} PROPERTIES TYPE REQUIRED)\n'.format(newlib)) cm_fh.write('set_package_properties({} PROPERTIES TYPE REQUIRED)\n'.format(newlib.packageName))
def lineify(label, value, quote=True): def lineify(label, value, quote=True):
if value: if value:
@ -316,18 +251,14 @@ def map_condition(condition):
substitution = None substitution = None
appendFoundSuffix = True appendFoundSuffix = True
if match.group(1) == 'libs': if match.group(1) == 'libs':
try: libmapping = find_library_mapping(match.group(2))
substitution = map_library(match.group(2))
if isinstance(substitution, list):
substitution = substitution[0]
elif isinstance(substitution, LibraryMapping):
appendFoundSuffix = substitution.appendFoundSuffix
substitution = substitution.resultVariable
except Exception:
substitution = None
if substitution is not None and appendFoundSuffix: if libmapping and libmapping.packageName:
substitution += '_FOUND' substitution = libmapping.packageName
if libmapping.resultVariable:
substitution = libmapping.resultVariable
if libmapping.appendFoundSuffix:
substitution += '_FOUND'
elif match.group(1) == 'features': elif match.group(1) == 'features':
feature = match.group(2) feature = match.group(2)

View File

@ -27,147 +27,255 @@
############################################################################# #############################################################################
import re import re
import typing
class LibraryMapping:
def __init__(self, soName: typing.Optional[str],
packageName: str, targetName: str, *,
resultVariable: typing.Optional[str] = None,
extra: typing.List[str] = [],
appendFoundSuffix: bool = True) -> None:
self.soName = soName
self.packageName = packageName
self.resultVariable = resultVariable
self.appendFoundSuffix = appendFoundSuffix
self.extra = extra
self.targetName = targetName
def is_qt() -> bool:
return self.packageName == 'Qt' \
or self.packageName == 'Qt5' \
or self.packageName == 'Qt6'
_qt_library_map = [
# Qt:
LibraryMapping('accessibility_support', 'Qt5', 'Qt::AccessibilitySupport', extra = ['COMPONENTS', 'AccessibilitySupport']),
LibraryMapping('androidextras', 'Qt5', 'Qt::AndroidExtras', extra = ['COMPONENTS', 'AndroidExtras']),
LibraryMapping('animation', 'Qt5', 'Qt::3DAnimation', extra = ['COMPONENTS', '3DAnimation']),
LibraryMapping('application-lib', 'Qt5', 'Qt::AppManApplication', extra = ['COMPONENTS', 'AppManApplication']),
LibraryMapping('bluetooth', 'Qt5', 'Qt::Bluetooth', extra = ['COMPONENTS', 'Bluetooth']),
LibraryMapping('bootstrap', 'Qt5', 'Qt::Bootstrap', extra = ['COMPONENTS', 'Bootstrap']),
# bootstrap-dbus: Not needed in Qt6!
LibraryMapping('client', 'Qt5', 'Qt::WaylandClient', extra = ['COMPONENTS', 'WaylandClient']),
LibraryMapping('clipboard_support', 'Qt5', 'Qt::ClipboardSupport', extra = ['COMPONENTS', 'ClipboardSupport']),
LibraryMapping('common-lib', 'Qt5', 'Qt::AppManCommon', extra = ['COMPONENTS', 'AppManCommon']),
LibraryMapping('compositor', 'Qt5', 'Qt::WaylandCompositor', extra = ['COMPONENTS', 'WaylandCompositor']),
LibraryMapping('concurrent', 'Qt5', 'Qt::Concurrent', extra = ['COMPONENTS', 'Concurrent']),
LibraryMapping('container', 'Qt5', 'Qt::AxContainer', extra = ['COMPONENTS', 'AxContainer']),
LibraryMapping('control', 'Qt5', 'Qt::AxServer', extra = ['COMPONENTS', 'AxServer']),
LibraryMapping('core_headers', 'Qt5', 'Qt::WebEngineCore', extra = ['COMPONENTS', 'WebEngineCore']),
LibraryMapping('core', 'Qt5', 'Qt::Core', extra = ['COMPONENTS', 'Core']),
LibraryMapping('coretest', 'Qt5', 'Qt::3DCoreTest', extra = ['COMPONENTS', '3DCoreTest']),
LibraryMapping('crypto-lib', 'Qt5', 'Qt::AppManCrypto', extra = ['COMPONENTS', 'AppManCrypto']),
LibraryMapping('dbus', 'Qt5', 'Qt::Dbus', extra = ['COMPONENTS', 'DBus']),
LibraryMapping('devicediscovery', 'Qt5', 'Qt::DeviceDiscoverySupport', extra = ['COMPONENTS', 'DeviceDiscoverySupport']),
LibraryMapping('devicediscovery_support', 'Qt5', 'Qt::DeviceDiscoverySupport', extra = ['COMPONENTS', 'DeviceDiscoverySupport']),
LibraryMapping('edid', 'Qt5', 'Qt::EdidSupport', extra = ['COMPONENTS', 'EdidSupport']),
LibraryMapping('edid_support', 'Qt5', 'Qt::EdidSupport', extra = ['COMPONENTS', 'EdidSupport']),
LibraryMapping('eglconvenience', 'Qt5', 'Qt::EglSupport', extra = ['COMPONENTS', 'EglSupport']),
LibraryMapping('eglfsdeviceintegration', 'Qt5', 'Qt::EglFSDeviceIntegration', extra = ['COMPONENTS', 'EglFSDeviceIntegration']),
LibraryMapping('eglfs_kms_support', 'Qt5', 'Qt::EglFsKmsSupport', extra = ['COMPONENTS', 'EglFsKmsSupport']),
LibraryMapping('egl_support', 'Qt5', 'Qt::EglSupport', extra = ['COMPONENTS', 'EglSupport']),
# enginio: Not needed in Qt6!
LibraryMapping('eventdispatchers', 'Qt5', 'Qt::EventDispatcherSupport', extra = ['COMPONENTS', 'EventDispatcherSupport']),
LibraryMapping('eventdispatcher_support', 'Qt5', 'Qt::EventDispatcherSupport', extra = ['COMPONENTS', 'EventDispatcherSupport']),
LibraryMapping('extras', 'Qt5', 'Qt::3DExtras', extra = ['COMPONENTS', '3DExtras']),
LibraryMapping('fbconvenience', 'Qt5', 'Qt::FbSupport', extra = ['COMPONENTS', 'FbSupport']),
LibraryMapping('fb_support', 'Qt5', 'Qt::FbSupport', extra = ['COMPONENTS', 'FbSupport']),
LibraryMapping('fontdatabase_support', 'Qt5', 'Qt::FontDatabaseSupport', extra = ['COMPONENTS', 'FontDatabaseSupport']),
LibraryMapping('gamepad', 'Qt5', 'Qt::Gamepad', extra = ['COMPONENTS', 'Gamepad']),
LibraryMapping('global', 'Qt5', 'Qt::Core', extra = ['COMPONENTS', 'Core']), # manually added special case
LibraryMapping('glx_support', 'Qt5', 'Qt::GlxSupport', extra = ['COMPONENTS', 'GlxSupport']),
LibraryMapping('graphics_support', 'Qt5', 'Qt::GraphicsSupport', extra = ['COMPONENTS', 'GraphicsSupport']),
LibraryMapping('gsttools', 'Qt5', 'Qt::MultimediaGstTools', extra = ['COMPONENTS', 'MultimediaGstTools']),
LibraryMapping('gui', 'Qt5', 'Qt::Gui', extra = ['COMPONENTS', 'Gui']),
LibraryMapping('help', 'Qt5', 'Qt::Help', extra = ['COMPONENTS', 'Help']),
LibraryMapping('hunspellinputmethod', 'Qt5', 'Qt::HunspellInputMethod', extra = ['COMPONENTS', 'HunspellInputMethod']),
LibraryMapping('input', 'Qt5', 'Qt::InputSupport', extra = ['COMPONENTS', 'InputSupport']),
LibraryMapping('input_support', 'Qt5', 'Qt::InputSupport', extra = ['COMPONENTS', 'InputSupport']),
LibraryMapping('installer-lib', 'Qt5', 'Qt::AppManInstaller', extra = ['COMPONENTS', 'AppManInstaller']),
LibraryMapping('kmsconvenience', 'Qt5', 'Qt::KmsSupport', extra = ['COMPONENTS', 'KmsSupport']),
LibraryMapping('kms_support', 'Qt5', 'Qt::KmsSupport', extra = ['COMPONENTS', 'KmsSupport']),
LibraryMapping('launcher-lib', 'Qt5', 'Qt::AppManLauncher', extra = ['COMPONENTS', 'AppManLauncher']),
LibraryMapping('lib', 'Qt5', 'Qt::Designer', extra = ['COMPONENTS', 'Designer']),
LibraryMapping('linuxaccessibility_support', 'Qt5', 'Qt::LinuxAccessibilitySupport', extra = ['COMPONENTS', 'LinuxAccessibilitySupport']),
LibraryMapping('location', 'Qt5', 'Qt::Location', extra = ['COMPONENTS', 'Location']),
LibraryMapping('logic', 'Qt5', 'Qt::3DLogic', extra = ['COMPONENTS', '3DLogic']),
LibraryMapping('macextras', 'Qt5', 'Qt::MacExtras', extra = ['COMPONENTS', 'MacExtras']),
LibraryMapping('main-lib', 'Qt5', 'Qt::AppManMain', extra = ['COMPONENTS', 'AppManMain']),
LibraryMapping('manager-lib', 'Qt5', 'Qt::AppManManager', extra = ['COMPONENTS', 'AppManManager']),
LibraryMapping('monitor-lib', 'Qt5', 'Qt::AppManMonitor', extra = ['COMPONENTS', 'AppManMonitor']),
LibraryMapping('multimedia', 'Qt5', 'Qt::Multimedia', extra = ['COMPONENTS', 'Multimedia']),
LibraryMapping('multimediawidgets', 'Qt5', 'Qt::MultimediaWidgets', extra = ['COMPONENTS', 'MultimediaWidgets']),
LibraryMapping('network', 'Qt5', 'Qt::Network', extra = ['COMPONENTS', 'Network']),
LibraryMapping('nfc', 'Qt5', 'Qt::Nfc', extra = ['COMPONENTS', 'Nfc']),
LibraryMapping('oauth', 'Qt5', 'Qt::NetworkAuth', extra = ['COMPONENTS', 'NetworkAuth']),
LibraryMapping('openglextensions', 'Qt5', 'Qt::OpenGLExtensions', extra = ['COMPONENTS', 'OpenGLExtensions']),
LibraryMapping('opengl', 'Qt5', 'Qt::OpenGL', extra = ['COMPONENTS', 'OpenGL']),
LibraryMapping('package-lib', 'Qt5', 'Qt::AppManPackage', extra = ['COMPONENTS', 'AppManPackage']),
LibraryMapping('packetprotocol', 'Qt5', 'Qt::PacketProtocol', extra = ['COMPONENTS', 'PacketProtocol']),
LibraryMapping('particles', 'Qt5', 'Qt::QuickParticles', extra = ['COMPONENTS', 'QuickParticles']),
LibraryMapping('platformcompositor', 'Qt5', 'Qt::PlatformCompositorSupport', extra = ['COMPONENTS', 'PlatformCompositorSupport']),
LibraryMapping('platformcompositor_support', 'Qt5', 'Qt::PlatformCompositorSupport', extra = ['COMPONENTS', 'PlatformCompositorSupport']),
LibraryMapping('plugin-interfaces', 'Qt5', 'Qt::AppManPluginInterfaces', extra = ['COMPONENTS', 'AppManPluginInterfaces']),
LibraryMapping('positioning', 'Qt5', 'Qt::Positioning', extra = ['COMPONENTS', 'Positioning']),
LibraryMapping('positioningquick', 'Qt5', 'Qt::PositioningQuick', extra = ['COMPONENTS', 'PositioningQuick']),
LibraryMapping('printsupport', 'Qt5', 'Qt::PrintSupport', extra = ['COMPONENTS', 'PrintSupport']),
LibraryMapping('purchasing', 'Qt5', 'Qt::Purchasing', extra = ['COMPONENTS', 'Purchasing']),
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('qmltest', 'Qt5', 'Qt::QuickTest', extra = ['COMPONENTS', 'QuickTest']),
LibraryMapping('qtmultimediaquicktools', 'Qt5', 'Qt::MultimediaQuick', extra = ['COMPONENTS', 'MultimediaQuick']),
LibraryMapping('quick3danimation', 'Qt5', 'Qt::3DQuickAnimation', extra = ['COMPONENTS', '3DQuickAnimation']),
LibraryMapping('quick3dextras', 'Qt5', 'Qt::3DQuickExtras', extra = ['COMPONENTS', '3DQuickExtras']),
LibraryMapping('quick3dinput', 'Qt5', 'Qt::3DQuickInput', extra = ['COMPONENTS', '3DQuickInput']),
LibraryMapping('quick3d', 'Qt5', 'Qt::3DQuick', extra = ['COMPONENTS', '3DQuick']),
LibraryMapping('quick3drender', 'Qt5', 'Qt::3DQuickRender', extra = ['COMPONENTS', '3DQuickRender']),
LibraryMapping('quick3dscene2d', 'Qt5', 'Qt::3DQuickScene2D', extra = ['COMPONENTS', '3DQuickScene2D']),
LibraryMapping('quickcontrols2', 'Qt5', 'Qt::QuickControls2', extra = ['COMPONENTS', 'QuickControls2']),
LibraryMapping('quick', 'Qt5', 'Qt::Quick', extra = ['COMPONENTS', 'Quick']),
LibraryMapping('quickshapes', 'Qt5', 'Qt::QuickShapes', extra = ['COMPONENTS', 'QuickShapes']),
LibraryMapping('quicktemplates2', 'Qt5', 'Qt::QuickTemplates2', extra = ['COMPONENTS', 'QuickTemplates2']),
LibraryMapping('quickwidgets', 'Qt5', 'Qt::QuickWidgets', extra = ['COMPONENTS', 'QuickWidgets']),
LibraryMapping('render', 'Qt5', 'Qt::3DRender', extra = ['COMPONENTS', '3DRender']),
LibraryMapping('script', 'Qt5', 'Qt::Script', extra = ['COMPONENTS', 'Script']),
LibraryMapping('scripttools', 'Qt5', 'Qt::ScriptTools', extra = ['COMPONENTS', 'ScriptTools']),
LibraryMapping('sensors', 'Qt5', 'Qt::Sensors', extra = ['COMPONENTS', 'Sensors']),
LibraryMapping('serialport', 'Qt5', 'Qt::SerialPort', extra = ['COMPONENTS', 'SerialPort']),
LibraryMapping('services', 'Qt5', 'Qt::ServiceSupport', extra = ['COMPONENTS', 'ServiceSupport']),
LibraryMapping('service_support', 'Qt5', 'Qt::ServiceSupport', extra = ['COMPONENTS', 'ServiceSupport']),
LibraryMapping('sql', 'Qt5', 'Qt::Sql', extra = ['COMPONENTS', 'Sql']),
LibraryMapping('svg', 'Qt5', 'Qt::Svg', extra = ['COMPONENTS', 'Svg']),
LibraryMapping('testlib', 'Qt5', 'Qt::Test', extra = ['COMPONENTS', 'Test']),
LibraryMapping('theme_support', 'Qt5', 'Qt::ThemeSupport', extra = ['COMPONENTS', 'ThemeSupport']),
LibraryMapping('tts', 'Qt5', 'Qt::TextToSpeech', extra = ['COMPONENTS', 'TextToSpeech']),
LibraryMapping('uiplugin', 'Qt5', 'Qt::UiPlugin', extra = ['COMPONENTS', 'UiPlugin']),
LibraryMapping('uitools', 'Qt5', 'Qt::UiTools', extra = ['COMPONENTS', 'UiTools']),
LibraryMapping('virtualkeyboard', 'Qt5', 'Qt::VirtualKeyboard', extra = ['COMPONENTS', 'VirtualKeyboard']),
LibraryMapping('vulkan_support', 'Qt5', 'Qt::VulkanSupport', extra = ['COMPONENTS', 'VulkanSupport']),
LibraryMapping('webchannel', 'Qt5', 'Qt::WebChannel', extra = ['COMPONENTS', 'WebChannel']),
LibraryMapping('webengine', 'Qt5', 'Qt::WebEngine', extra = ['COMPONENTS', 'WebEngine']),
LibraryMapping('webenginewidgets', 'Qt5', 'Qt::WebEngineWidgets', extra = ['COMPONENTS', 'WebEngineWidgets']),
LibraryMapping('websockets', 'Qt5', 'Qt::WebSockets', extra = ['COMPONENTS', 'WebSockets']),
LibraryMapping('webview', 'Qt5', 'Qt::WebView', extra = ['COMPONENTS', 'WebView']),
LibraryMapping('widgets', 'Qt5', 'Qt::Widgets', extra = ['COMPONENTS', 'Widgets']),
LibraryMapping('window-lib', 'Qt5', 'Qt::AppManWindow', extra = ['COMPONENTS', 'AppManWindow']),
LibraryMapping('windowsuiautomation_support', 'Qt5', 'Qt::WindowsUIAutomationSupport', extra = ['COMPONENTS', 'WindowsUIAutomationSupport']),
LibraryMapping('winextras', 'Qt5', 'Qt::WinExtras', extra = ['COMPONENTS', 'WinExtras']),
LibraryMapping('x11extras', 'Qt5', 'Qt::X11Extras', extra = ['COMPONENTS', 'X11Extras']),
LibraryMapping('xkbcommon_support', 'Qt5', 'Qt::XkbCommonSupport', extra = ['COMPONENTS', 'XkbCommonSupport']),
LibraryMapping('xmlpatterns', 'Qt5', 'Qt::XmlPatterns', extra = ['COMPONENTS', 'XmlPatterns']),
LibraryMapping('xml', 'Qt5', 'Qt::Xml', extra = ['COMPONENTS', 'Xml']),
# qtzlib: No longer supported.
]
_library_map = [
# 3rd party:
LibraryMapping('atspi', 'ATSPI2', 'PkgConfig::ATSPI2'),
LibraryMapping('corewlan', None, None),
LibraryMapping('cups', 'Cups', 'Cups::Cups'),
LibraryMapping('dbus', 'DBus1', 'dbus-1'),
LibraryMapping('doubleconversion', None, None),
LibraryMapping('drm', 'Libdrm', 'Libdrm::Libdrm'),
LibraryMapping('egl', 'EGL', 'EGL::EGL'),
LibraryMapping('fontconfig', 'Fontconfig', 'Fontconfig::Fontconfig', resultVariable="FONTCONFIG"),
LibraryMapping('freetype', 'Freetype', 'Freetype::Freetype', extra=['REQUIRED']),
LibraryMapping('gbm', 'gbm', 'gbm::gbm'),
LibraryMapping('glib', 'GLIB2', 'GLIB2::GLIB2'),
LibraryMapping('gnu_iconv', None, None),
LibraryMapping('gtk3', 'GTK3', 'PkgConfig::GTK3'),
LibraryMapping('harfbuzz', 'harfbuzz', 'harfbuzz::harfbuzz'),
LibraryMapping('host_dbus', None, None),
LibraryMapping('icu', 'ICU', 'ICU::i18n ICU::uc ICU::data', extra=['COMPONENTS', 'i18n', 'uc', 'data']),
LibraryMapping('journald', 'Libsystemd', 'PkgConfig::Libsystemd'),
LibraryMapping('libatomic', 'Atomic', 'Atomic'),
LibraryMapping('libdl', None, None),
LibraryMapping('libinput', 'Libinput', 'Libinput::Libinput'),
LibraryMapping('libjpeg', 'JPEG', 'JPEG::JPEG'),
LibraryMapping('libpng', 'PNG', 'PNG::PNG'),
LibraryMapping('libproxy', 'Libproxy', 'PkgConfig::Libproxy'),
LibraryMapping('librt', 'WrapRt','WrapRt'),
LibraryMapping('libudev', 'Libudev', 'PkgConfig::Libudev'),
LibraryMapping('lttng-ust', 'LTTngUST', 'LTTng::UST', resultVariable='LTTNGUST'),
LibraryMapping('mtdev', 'Mtdev', 'PkgConfig::Mtdev'),
LibraryMapping('odbc', 'ODBC', 'ODBC::ODBC'),
LibraryMapping('opengl_es2', 'GLESv2', 'GLESv2::GLESv2'),
LibraryMapping('opengl', 'OpenGL', 'OpenGL::GL', resultVariable='OpenGL_OpenGL'),
LibraryMapping('openssl_headers', 'OpenSSL', 'OpenSSL::SSL_nolink', resultVariable='OPENSSL_INCLUDE_DIR', appendFoundSuffix=False),
LibraryMapping('openssl', 'OpenSSL', 'OpenSSL::SSL'),
LibraryMapping('pcre2', 'PCRE2', 'PCRE2', extra = ['REQUIRED']),
LibraryMapping('posix_iconv', None, None),
LibraryMapping('pps', 'PPS', 'PPS::PPS'),
LibraryMapping('psql', 'PostgreSQL', 'PostgreSQL::PostgreSQL'),
LibraryMapping('slog2', 'Slog2', 'Slog2::Slog2'),
LibraryMapping('sqlite2', None, None), # No more sqlite2 support in Qt6!
LibraryMapping('sqlite3', 'SQLite3', 'SQLite::SQLite3'),
LibraryMapping('sun_iconv', None, None),
LibraryMapping('tslib', 'Tslib', 'PkgConfig::Tslib'),
LibraryMapping('udev', 'Libudev', 'PkgConfig::Libudev'),
LibraryMapping('udev', 'Libudev', 'PkgConfig::Libudev'), # see also libudev!
LibraryMapping('vulkan', 'Vulkan', 'Vulkan::Vulkan'),
LibraryMapping('wayland_server', 'Wayland', 'Wayland::Server'),
LibraryMapping('x11sm', 'X11', '${X11_SM_LIB} ${X11_ICE_LIB}', resultVariable="X11_SM"),
LibraryMapping('xcb_glx', 'XCB', 'XCB::GLX', resultVariable='XCB_GLX'),
LibraryMapping('xcb_render', 'XCB', 'XCB::RENDER', resultVariable='XCB_RENDER'),
LibraryMapping('xcb', 'XCB', 'XCB::XCB', extra = ['1.9']),
LibraryMapping('xcb_glx', 'XCB', 'XCB::GLX', extra = ['COMPONENTS', 'GLX'], resultVariable='XCB_GLX'),
LibraryMapping('xcb_icccm', 'XCB', 'XCB::ICCCM', extra = ['COMPONENTS', 'ICCCM'], resultVariable='XCB_ICCCM'),
LibraryMapping('xcb_image', 'XCB', 'XCB::IMAGE', extra = ['COMPONENTS', 'IMAGE'], resultVariable='XCB_IMAGE'),
LibraryMapping('xcb_keysyms', 'XCB', 'XCB::KEYSYMS', extra = ['COMPONENTS', 'KEYSYMS'], resultVariable='XCB_KEYSYMS'),
LibraryMapping('xcb_randr', 'XCB', 'XCB::RANDR', extra = ['COMPONENTS', 'RANDR'], resultVariable='XCB_RANDR'),
LibraryMapping('xcb_render', 'XCB', 'XCB::RENDER', extra = ['COMPONENTS', 'RENDER'], resultVariable='XCB_RENDER'),
LibraryMapping('xcb_renderutil', 'XCB', 'XCB::RENDERUTIL', extra = ['COMPONENTS', 'RENDERUTIL'], resultVariable='XCB_RENDERUTIL'),
LibraryMapping('xcb_shape', 'XCB', 'XCB::SHAPE', extra = ['COMPONENTS', 'SHAPE'], resultVariable='XCB_SHAPE'),
LibraryMapping('xcb_shm', 'XCB', 'XCB::SHM', extra = ['COMPONENTS', 'SHM'], resultVariable='XCB_SHM'),
LibraryMapping('xcb_sync', 'XCB', 'XCB::SYNC', extra = ['COMPONENTS', 'SYNC'], resultVariable='XCB_SYNC'),
LibraryMapping('xcb_xfixes', 'XCB', 'XCB::XFIXES', extra = ['COMPONENTS', 'XFIXES'], resultVariable='XCB_XFIXES'),
LibraryMapping('xcb_xinerama', 'XCB', 'XCB::XINERAMA', extra = ['COMPONENTS', 'XINERAMA'], resultVariable='XCB_XINERAMA'),
LibraryMapping('xcb_xinput', 'XCB', 'XCB::XINPUT', extra = ['COMPONENTS', 'XINPUT'], resultVariable='XCB_XINPUT'),
LibraryMapping('xcb_xkb', 'XCB', 'XCB::XKB', extra = ['COMPONENTS', 'XKB'], resultVariable='XCB_XKB'),
LibraryMapping('xcb_xlib', 'X11_XCB', 'X11::XCB'),
LibraryMapping('xkbcommon_evdev', 'XKB', 'XKB::XKB', extra = ['0.4.1']), # see also xkbcommon
LibraryMapping('xkbcommon_x11', 'XKB', 'XKB::XKB', extra = ['0.4.1']), # see also xkbcommon
LibraryMapping('xkbcommon', 'XKB', 'XKB::XKB', extra = ['0.4.1']),
LibraryMapping('xlib', 'X11', 'X11::XCB'), # FIXME: Is this correct?
LibraryMapping('xrender', 'XRender', 'PkgConfig::xrender'),
LibraryMapping('zlib', 'ZLIB', 'ZLIB::ZLIB'),
LibraryMapping('zstd', 'ZSTD', 'ZSTD::ZSTD'),
]
def find_library_mapping(soName: str) -> typing.Optional[LibraryMapping]:
for i in _library_map:
if i.soName == soName:
return i
return None
def find_qt_library_mapping(soName: str) -> typing.Optional[LibraryMapping]:
for i in _qt_library_map:
if i.soName == soName:
return i
return None
def featureName(input: str) -> str: def featureName(input: str) -> str:
return re.sub(r'[^a-zA-Z0-9_]', '_', input) return re.sub(r'[^a-zA-Z0-9_]', '_', input)
def map_qt_base_library(lib: str) -> str:
library_map = {
'global': 'Qt::Core', # manually added special case
'accessibility_support': 'Qt::AccessibilitySupport',
'androidextras': 'Qt::AndroidExtras',
'animation': 'Qt::3DAnimation',
'application-lib': 'Qt::AppManApplication',
'bluetooth': 'Qt::Bluetooth',
'bootstrap-dbus': 'Qt::BootstrapDBus',
'bootstrap': 'Qt::Bootstrap',
'client': 'Qt::WaylandClient',
'clipboard_support': 'Qt::ClipboardSupport',
'common-lib': 'Qt::AppManCommon',
'compositor': 'Qt::WaylandCompositor',
'concurrent': 'Qt::Concurrent',
'container': 'Qt::AxContainer',
'control': 'Qt::AxServer',
'core_headers': 'Qt::WebEngineCore',
'core': 'Qt::Core',
'coretest': 'Qt::3DCoreTest',
'crypto-lib': 'Qt::AppManCrypto',
'dbus': 'Qt::DBus',
'devicediscovery': 'Qt::DeviceDiscoverySupport',
'devicediscovery_support': 'Qt::DeviceDiscoverySupport',
'edid': 'Qt::EdidSupport',
'eglconvenience': 'Qt::EglSupport',
'eglfsdeviceintegration': 'Qt::EglFSDeviceIntegration',
'eglfs_kms_support': 'Qt::EglFsKmsSupport',
'egl_support': 'Qt::EglSupport',
'enginio_client': 'Enginio',
'eventdispatchers': 'Qt::EventDispatcherSupport',
'extras': 'Qt::3DExtras',
'fb_support': 'Qt::FbSupport',
'fbconvenience': 'Qt::FbSupport',
'fontdatabase_support': 'Qt::FontDatabaseSupport',
'gamepad': 'Qt::Gamepad',
'glx_support': 'Qt::GlxSupport',
'graphics_support': 'Qt::GraphicsSupport',
'gsttools': 'Qt::MultimediaGstTools',
'gui': 'Qt::Gui',
'help': 'Qt::Help',
'hunspellinputmethod': 'Qt::HunspellInputMethod',
'input': 'Qt::InputSupport',
'input_support': 'Qt::InputSupport',
'installer-lib': 'Qt::AppManInstaller',
'kmsconvenience': 'Qt::KmsSupport',
'kms_support': 'Qt::KmsSupport',
'launcher-lib': 'Qt::AppManLauncher',
'lib': 'Qt::Designer',
'linuxaccessibility_support': 'Qt::LinuxAccessibilitySupport',
'location': 'Qt::Location',
'logic': 'Qt::3DLogic',
'macextras': 'Qt::MacExtras',
'main-lib': 'Qt::AppManMain',
'manager-lib': 'Qt::AppManManager',
'monitor-lib': 'Qt::AppManMonitor',
'multimedia': 'Qt::Multimedia',
'multimediawidgets': 'Qt::MultimediaWidgets',
'network': 'Qt::Network',
'nfc': 'Qt::Nfc',
'oauth': 'Qt::NetworkAuth',
'openglextensions': 'Qt::OpenGLExtensions',
'opengl': 'Qt::OpenGL',
'package-lib': 'Qt::AppManPackage',
'packetprotocol': 'Qt::PacketProtocol',
'particles': 'Qt::QuickParticles',
'platformcompositor': 'Qt::PlatformCompositorSupport',
'platformcompositor_support': 'Qt::PlatformCompositorSupport',
'plugin-interfaces': 'Qt::AppManPluginInterfaces',
'positioning': 'Qt::Positioning',
'positioningquick': 'Qt::PositioningQuick',
'printsupport': 'Qt::PrintSupport',
'purchasing': 'Qt::Purchasing',
'qmldebug': 'Qt::QmlDebug',
'qmldevtools': 'Qt::QmlDevTools',
'qml': 'Qt::Qml',
'qmltest': 'Qt::QuickTest',
'qtmultimediaquicktools': 'Qt::MultimediaQuick',
'qtzlib': 'Qt::Zlib',
'quick3danimation': 'Qt::3DQuickAnimation',
'quick3dextras': 'Qt::3DQuickExtras',
'quick3dinput': 'Qt::3DQuickInput',
'quick3d': 'Qt::3DQuick',
'quick3drender': 'Qt::3DQuickRender',
'quick3dscene2d': 'Qt::3DQuickScene2D',
'quickcontrols2': 'Qt::QuickControls2',
'quick': 'Qt::Quick',
'quickshapes': 'Qt::QuickShapes',
'quicktemplates2': 'Qt::QuickTemplates2',
'quickwidgets': 'Qt::QuickWidgets',
'render': 'Qt::3DRender',
'script': 'Qt::Script',
'scripttools': 'Qt::ScriptTools',
'sensors': 'Qt::Sensors',
'serialport': 'Qt::SerialPort',
'services': 'Qt::ServiceSupport',
'sql': 'Qt::Sql',
'svg': 'Qt::Svg',
'testlib': 'Qt::Test',
'theme_support': 'Qt::ThemeSupport',
'service_support': 'Qt::ServiceSupport',
'eventdispatcher_support': 'Qt::EventDispatcherSupport',
'edid_support': 'Qt::EdidSupport',
'tts': 'Qt::TextToSpeech',
'uiplugin': 'Qt::UiPlugin',
'uitools': 'Qt::UiTools',
'virtualkeyboard': 'Qt::VirtualKeyboard',
'vulkan_support': 'Qt::VulkanSupport',
'webchannel': 'Qt::WebChannel',
'webengine': 'Qt::WebEngine',
'webenginewidgets': 'Qt::WebEngineWidgets',
'websockets': 'Qt::WebSockets',
'webview': 'Qt::WebView',
'widgets': 'Qt::Widgets',
'window-lib': 'Qt::AppManWindow',
'windowsuiautomation_support': 'Qt::WindowsUIAutomationSupport',
'winextras': 'Qt::WinExtras',
'x11extras': 'Qt::X11Extras',
'xcb_qpa_lib': 'Qt::XcbQpa',
'xkbcommon_support': 'Qt::XkbCommonSupport',
'xmlpatterns': 'Qt::XmlPatterns',
'xml': 'Qt::Xml',
}
return library_map.get(lib, lib)
def map_qt_library(lib: str) -> str: def map_qt_library(lib: str) -> str:
private = False private = False
if lib.endswith('-private'): if lib.endswith('-private'):
private = True private = True
lib = lib[:-8] lib = lib[:-8]
mapped = map_qt_base_library(lib) mapped = find_qt_library_mapping(lib)
qt_name = lib
if mapped:
qt_name = mapped.targetName
if private: if private:
mapped += 'Private' qt_name += 'Private'
return mapped return qt_name
platform_mapping = { platform_mapping = {
@ -211,63 +319,14 @@ def substitute_platform(platform: str) -> str:
return platform_mapping.get(platform, platform) return platform_mapping.get(platform, platform)
qmake_library_to_cmake_target_mapping = {
'atspi': 'PkgConfig::ATSPI2',
'cups': 'Cups::Cups',
'drm': 'Libdrm::Libdrm',
'doubleconversion': 'double-conversion',
'fontconfig': 'Fontconfig::Fontconfig',
'freetype': 'Freetype::Freetype',
'gbm': 'gbm::gbm',
'glib': 'GLIB2::GLIB2',
'glx_support': 'Qt::GlxSupport',
'glx_supportPrivate': 'Qt::GlxSupportPrivate',
'harfbuzz': 'harfbuzz::harfbuzz',
'icu': 'ICU::i18n ICU::uc ICU::data',
'libatomic': 'Atomic',
'libdl': '${CMAKE_DL_LIBS}',
'libinput': 'Libinput::Libinput',
'libpng' : 'PNG::PNG',
'libproxy': 'PkgConfig::Libproxy',
'librt': 'WrapRt',
'libudev': 'PkgConfig::Libudev',
'mtdev': 'PkgConfig::Mtdev',
'odbc': 'ODBC::ODBC',
'openssl': 'OpenSSL::SSL',
'pcre2': 'PCRE2',
'psql': 'PostgreSQL::PostgreSQL',
'sqlite': 'SQLite::SQLite3',
'SQLite3': 'SQLite::SQLite3',
'tslib': 'PkgConfig::Tslib',
'x11sm': '${X11_SM_LIB} ${X11_ICE_LIB}',
'xcb_glx': 'XCB::GLX',
'xcb_icccm': 'XCB::ICCCM',
'xcb_image': 'XCB::IMAGE',
'xcb_keysyms': 'XCB::KEYSYMS',
'xcb_randr': 'XCB::RANDR',
'xcb_renderutil': 'XCB::RENDERUTIL',
'xcb_render': 'XCB::RENDER',
'xcb_shape': 'XCB::SHAPE',
'xcb_shm': 'XCB::SHM',
'xcb_sync': 'XCB::SYNC',
'xcb': 'XCB::XCB',
'xcb_xfixes': 'XCB::XFIXES',
'xcb_xinerama': 'XCB::XINERAMA',
'xcb_xinput': 'XCB::XINPUT',
'xcb_xkb': 'XCB::XKB',
'xcb_xlib': 'X11::XCB',
'xkbcommon_evdev': 'XKB::XKB',
'xkbcommon_x11': 'XKB::XKB',
'xkbcommon': 'XKB::XKB',
'xrender': 'XCB::RENDER',
'zlib': 'ZLIB::ZLIB',
'zstd': 'ZSTD::ZSTD',
}
def substitute_libs(lib: str) -> str: def substitute_libs(lib: str) -> str:
libpostfix = '' libpostfix = ''
if lib.endswith('/nolink'): if lib.endswith('/nolink'):
lib = lib[:-7] lib = lib[:-7]
libpostfix = '_nolink' libpostfix = '_nolink'
return qmake_library_to_cmake_target_mapping.get(lib, lib) + libpostfix mapping = find_qt_library_mapping(lib)
if not mapping:
mapping = find_library_mapping(lib)
if not mapping:
return lib + libpostfix
return mapping.targetName + libpostfix

View File

@ -42,7 +42,7 @@ import typing
from sympy.logic import (simplify_logic, And, Or, Not,) from sympy.logic import (simplify_logic, And, Or, Not,)
import pyparsing as pp import pyparsing as pp
from helper import map_qt_library, map_qt_base_library, featureName, \ from helper import map_qt_library, featureName, \
substitute_platform, substitute_libs substitute_platform, substitute_libs