2018-10-24 13:20:27 +00:00
|
|
|
#############################################################################
|
|
|
|
##
|
|
|
|
## Copyright (C) 2018 The Qt Company Ltd.
|
|
|
|
## Contact: https://www.qt.io/licensing/
|
|
|
|
##
|
|
|
|
## This file is part of the plugins of the Qt Toolkit.
|
|
|
|
##
|
|
|
|
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
|
|
|
## Commercial License Usage
|
|
|
|
## Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
## accordance with the commercial license agreement provided with the
|
|
|
|
## Software or, alternatively, in accordance with the terms contained in
|
|
|
|
## a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
## and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
## information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
##
|
|
|
|
## GNU General Public License Usage
|
|
|
|
## Alternatively, this file may be used under the terms of the GNU
|
|
|
|
## General Public License version 3 as published by the Free Software
|
|
|
|
## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
## included in the packaging of this file. Please review the following
|
|
|
|
## information to ensure the GNU General Public License requirements will
|
|
|
|
## be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
##
|
|
|
|
## $QT_END_LICENSE$
|
|
|
|
##
|
|
|
|
#############################################################################
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
def featureName(input: str) -> str:
|
|
|
|
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',
|
2019-02-15 14:48:58 +00:00
|
|
|
'devicediscovery_support': 'Qt::DeviceDiscoverySupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'edid': 'Qt::EdidSupport',
|
|
|
|
'eglconvenience': 'Qt::EglSupport',
|
|
|
|
'eglfsdeviceintegration': 'Qt::EglFSDeviceIntegration',
|
|
|
|
'eglfs_kms_support': 'Qt::EglFsKmsSupport',
|
2019-02-15 14:48:58 +00:00
|
|
|
'egl_support': 'Qt::EglSupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'enginio_client': 'Enginio',
|
|
|
|
'eventdispatchers': 'Qt::EventDispatcherSupport',
|
|
|
|
'extras': 'Qt::3DExtras',
|
2019-02-12 16:27:16 +00:00
|
|
|
'fb_support': 'Qt::FbSupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'fbconvenience': 'Qt::FbSupport',
|
|
|
|
'fontdatabase_support': 'Qt::FontDatabaseSupport',
|
|
|
|
'gamepad': 'Qt::Gamepad',
|
2019-04-08 14:07:23 +00:00
|
|
|
'glx_support': 'Qt::GlxSupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'graphics_support': 'Qt::GraphicsSupport',
|
|
|
|
'gsttools': 'Qt::MultimediaGstTools',
|
|
|
|
'gui': 'Qt::Gui',
|
|
|
|
'help': 'Qt::Help',
|
|
|
|
'hunspellinputmethod': 'Qt::HunspellInputMethod',
|
|
|
|
'input': 'Qt::InputSupport',
|
2019-02-12 16:27:16 +00:00
|
|
|
'input_support': 'Qt::InputSupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'installer-lib': 'Qt::AppManInstaller',
|
|
|
|
'kmsconvenience': 'Qt::KmsSupport',
|
2019-02-15 16:30:04 +00:00
|
|
|
'kms_support': 'Qt::KmsSupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'launcher-lib': 'Qt::AppManLauncher',
|
|
|
|
'lib': 'Qt::Designer',
|
2019-04-08 14:07:23 +00:00
|
|
|
'linuxaccessibility_support': 'Qt::LinuxAccessibilitySupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'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',
|
2019-02-15 14:48:58 +00:00
|
|
|
'platformcompositor_support': 'Qt::PlatformCompositorSupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'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',
|
2019-04-08 14:07:23 +00:00
|
|
|
'vulkan_support': 'Qt::VulkanSupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'webchannel': 'Qt::WebChannel',
|
|
|
|
'webengine': 'Qt::WebEngine',
|
|
|
|
'webenginewidgets': 'Qt::WebEngineWidgets',
|
|
|
|
'websockets': 'Qt::WebSockets',
|
|
|
|
'webview': 'Qt::WebView',
|
|
|
|
'widgets': 'Qt::Widgets',
|
|
|
|
'window-lib': 'Qt::AppManWindow',
|
2019-04-09 11:20:19 +00:00
|
|
|
'windowsuiautomation_support': 'Qt::WindowsUIAutomationSupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'winextras': 'Qt::WinExtras',
|
|
|
|
'x11extras': 'Qt::X11Extras',
|
|
|
|
'xcb_qpa_lib': 'Qt::XcbQpa',
|
2019-04-11 15:05:06 +00:00
|
|
|
'xkbcommon_support': 'Qt::XkbCommonSupport',
|
2018-10-24 13:20:27 +00:00
|
|
|
'xmlpatterns': 'Qt::XmlPatterns',
|
|
|
|
'xml': 'Qt::Xml',
|
|
|
|
}
|
|
|
|
return library_map.get(lib, lib)
|
|
|
|
|
|
|
|
|
|
|
|
def map_qt_library(lib: str) -> str:
|
|
|
|
private = False
|
|
|
|
if lib.endswith('-private'):
|
|
|
|
private = True
|
|
|
|
lib = lib[:-8]
|
|
|
|
mapped = map_qt_base_library(lib)
|
|
|
|
if private:
|
|
|
|
mapped += 'Private'
|
|
|
|
return mapped
|
|
|
|
|
|
|
|
|
|
|
|
platform_mapping = {
|
|
|
|
'win32': 'WIN32',
|
|
|
|
'unix': 'UNIX',
|
|
|
|
'darwin': 'APPLE',
|
|
|
|
'linux': 'LINUX',
|
|
|
|
'integrity': 'INTEGRITY',
|
|
|
|
'qnx': 'QNX',
|
|
|
|
'vxworks': 'VXWORKS',
|
|
|
|
'hpux': 'HPUX',
|
|
|
|
'nacl': 'NACL',
|
|
|
|
'android': 'ANDROID',
|
|
|
|
'android-embedded': 'ANDROID_EMBEDDED',
|
|
|
|
'uikit': 'APPLE_UIKIT',
|
|
|
|
'tvos': 'APPLE_TVOS',
|
|
|
|
'watchos': 'APPLE_WATCHOS',
|
|
|
|
'winrt': 'WINRT',
|
|
|
|
'wasm': 'WASM',
|
|
|
|
'msvc': 'MSVC',
|
|
|
|
'clang': 'CLANG',
|
|
|
|
'gcc': 'GCC',
|
2019-01-23 15:38:07 +00:00
|
|
|
'icc': 'ICC',
|
2019-01-29 11:53:24 +00:00
|
|
|
'intel_icc': 'ICC',
|
2018-10-24 13:20:27 +00:00
|
|
|
'osx': 'APPLE_OSX',
|
2019-01-23 15:38:07 +00:00
|
|
|
'ios': 'APPLE_IOS',
|
2018-10-24 13:20:27 +00:00
|
|
|
'freebsd': 'FREEBSD',
|
2019-01-23 15:38:07 +00:00
|
|
|
'openbsd': 'OPENBSD',
|
|
|
|
'netbsd': 'NETBSD',
|
2018-10-24 13:20:27 +00:00
|
|
|
'haiku': 'HAIKU',
|
|
|
|
'netbsd': 'NETBSD',
|
|
|
|
'mac': 'APPLE_OSX',
|
2019-01-23 15:38:07 +00:00
|
|
|
'macx': 'APPLE_OSX',
|
|
|
|
'macos': 'APPLE_OSX',
|
|
|
|
'macx-icc': '(APPLE_OSX AND ICC)',
|
2018-10-24 13:20:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def substitute_platform(platform: str) -> str:
|
|
|
|
""" Return the qmake platform as cmake platform or the unchanged string. """
|
|
|
|
return platform_mapping.get(platform, platform)
|
|
|
|
|
|
|
|
|
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-24 15:14:25 +00:00
|
|
|
qmake_library_to_cmake_target_mapping = {
|
2019-03-28 14:24:44 +00:00
|
|
|
'atspi': 'PkgConfig::ATSPI2',
|
2019-04-02 09:27:36 +00:00
|
|
|
'cups': 'Cups::Cups',
|
2019-02-15 16:30:04 +00:00
|
|
|
'drm': 'Libdrm::Libdrm',
|
2019-01-30 15:41:45 +00:00
|
|
|
'doubleconversion': 'double-conversion',
|
2019-03-28 13:56:33 +00:00
|
|
|
'fontconfig': 'Fontconfig::Fontconfig',
|
2019-01-31 15:18:06 +00:00
|
|
|
'freetype': 'Freetype::Freetype',
|
2019-02-15 16:30:04 +00:00
|
|
|
'gbm': 'gbm::gbm',
|
2019-01-29 11:53:24 +00:00
|
|
|
'glib': 'GLIB2::GLIB2',
|
2019-03-29 11:34:22 +00:00
|
|
|
'glx_support': 'Qt::GlxSupport',
|
|
|
|
'glx_supportPrivate': 'Qt::GlxSupportPrivate',
|
2019-02-11 16:45:35 +00:00
|
|
|
'harfbuzz': 'harfbuzz::harfbuzz',
|
2019-01-30 15:41:45 +00:00
|
|
|
'icu': 'ICU::i18n ICU::uc ICU::data',
|
|
|
|
'libatomic': 'Atomic',
|
2019-01-31 15:18:06 +00:00
|
|
|
'libdl': '${CMAKE_DL_LIBS}',
|
2019-03-28 14:02:01 +00:00
|
|
|
'libinput': 'Libinput::Libinput',
|
2019-03-01 14:54:40 +00:00
|
|
|
'libpng' : 'PNG::PNG',
|
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-24 15:14:25 +00:00
|
|
|
'libproxy': 'PkgConfig::Libproxy',
|
2019-01-30 15:41:45 +00:00
|
|
|
'librt': 'WrapRt',
|
2019-03-28 13:47:53 +00:00
|
|
|
'libudev': 'PkgConfig::Libudev',
|
2019-03-28 14:02:01 +00:00
|
|
|
'mtdev': 'PkgConfig::Mtdev',
|
2019-03-29 11:18:19 +00:00
|
|
|
'odbc': 'ODBC::ODBC',
|
2019-03-28 14:25:17 +00:00
|
|
|
'openssl': 'OpenSSL::SSL',
|
2019-01-31 15:18:06 +00:00
|
|
|
'pcre2': 'PCRE2',
|
2019-03-29 11:16:05 +00:00
|
|
|
'psql': 'PostgreSQL::PostgreSQL',
|
2019-03-29 11:21:23 +00:00
|
|
|
'sqlite': 'SQLite::SQLite3',
|
|
|
|
'SQLite3': 'SQLite::SQLite3',
|
2019-03-28 14:02:01 +00:00
|
|
|
'tslib': 'PkgConfig::Tslib',
|
2019-01-31 15:18:06 +00:00
|
|
|
'x11sm': '${X11_SM_LIB} ${X11_ICE_LIB}',
|
2019-05-03 07:46:47 +00:00
|
|
|
'xcb_glx': 'XCB::GLX',
|
2019-01-31 15:18:06 +00:00
|
|
|
'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',
|
2019-03-28 14:02:01 +00:00
|
|
|
'xkbcommon_evdev': 'XKB::XKB',
|
2019-01-31 15:18:06 +00:00
|
|
|
'xkbcommon_x11': 'XKB::XKB',
|
|
|
|
'xkbcommon': 'XKB::XKB',
|
|
|
|
'xrender': 'XCB::RENDER',
|
2019-01-30 15:41:45 +00:00
|
|
|
'zlib': 'ZLIB::ZLIB',
|
|
|
|
'zstd': 'ZSTD::ZSTD',
|
2018-10-24 13:20:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def substitute_libs(lib: str) -> str:
|
2019-03-28 14:25:17 +00:00
|
|
|
libpostfix = ''
|
|
|
|
if lib.endswith('/nolink'):
|
|
|
|
lib = lib[:-7]
|
|
|
|
libpostfix = '_nolink'
|
Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-24 15:14:25 +00:00
|
|
|
return qmake_library_to_cmake_target_mapping.get(lib, lib) + libpostfix
|