Change the -qpa configure argument logic
Parse the -qpa configure argument as list and translate it to the QT_QPA_PLATFORMS cmake variable. This variable is new to the Qt build procedure. The QT_QPA_DEFAULT_PLATFORM variable supposed to get multiple values, but this didn't work at all, since the variable value then was used in the compile definition that is expected to be a single value QPA platfrom definition. This inconsistency forced to introduce a new variable. The QT_QPA_DEFAULT_PLATFORM variable now controls the first-choice QPA plugin for the GUI applications. The new configure argument -default-qpa is now translated to the QT_QPA_DEFAULT_PLATFORM variable instead the of -qpa one. The -qpa configure argument is now translated to the QT_QPA_PLATFORMS variable, which is new one as well. The variable contains the list of QPA plugins that are "default" for this Qt configuration. The meaning of the "default" plugins is related to the DEFAULT_IF argument of qt_internal_add_plugin command. Plugins that are listed in the QT_QPA_PLATFORMS variable will be treated as default by the build system and will be deployed within user applications when using deployment API or linked statically when using static Qt. The QT_QPA_DEFAULT_PLATFORM falls back to the QT_QPA_PLATFORMS first value in the list if it's not set explicitly and either '-DQT_QPA_PLATFORMS' or '-qpa' arguments are specified. [ChangeLog][CMake] Added QT_QPA_PLATFORMS variable which controls the list of QPA plugins that will be deployed within the applications by default. [ChangeLog][CMake] The '-qpa' configure argument now is mapped to the QT_QPA_PLATFORMS variable and has different functionality. It doesn't control the platform plugin that the GUI application is using by default, but controls the list of QPA plugins that will be deployed within the applications by default. [ChangeLog][CMake] Added '-default-qpa' argument which replaces the '-qpa' one. The argument is translated to the QT_DEFAULT_QPA_PLATFORM CMake variable and selects the default platform that should be used by GUI application if QT_QPA_PLATFORM environment variable is not set. Task-number: QTBUG-124265 Task-number: QTBUG-87805 Task-number: QTBUG-124449 Change-Id: Ibcebaccc535aaed6374f15ccfeddb3e6128f5ce0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
e227a4bfbd
commit
90c2cde691
@ -653,13 +653,19 @@ set(__qt_internal_initial_qt_cmake_build_type \"${CMAKE_BUILD_TYPE}\")
|
||||
endif()
|
||||
|
||||
# Save the default qpa platform.
|
||||
# Used by qtwayland/src/plugins/platforms/qwayland-generic/CMakeLists.txt. Otherwise
|
||||
# the DEFAULT_IF condition is evaluated incorrectly.
|
||||
if(DEFINED QT_QPA_DEFAULT_PLATFORM)
|
||||
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
|
||||
"set(QT_QPA_DEFAULT_PLATFORM \"${QT_QPA_DEFAULT_PLATFORM}\" CACHE STRING \"\")\n")
|
||||
endif()
|
||||
|
||||
# Save the list of default qpa platforms.
|
||||
# Used by qtwayland/src/plugins/platforms/qwayland-generic/CMakeLists.txt. Otherwise
|
||||
# the DEFAULT_IF condition is evaluated incorrectly.
|
||||
if(DEFINED QT_QPA_PLATFORMS)
|
||||
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
|
||||
"set(QT_QPA_PLATFORMS \"${QT_QPA_PLATFORMS}\" CACHE STRING \"\")\n")
|
||||
endif()
|
||||
|
||||
# Save minimum and policy-related CMake versions to ensure the same minimum is
|
||||
# checked for when building other downstream repos (qtsvg, etc) and the policy settings
|
||||
# will be consistent unless the downstream repos explicitly override them.
|
||||
|
@ -943,6 +943,7 @@ translate_string_input(platform QT_QMAKE_TARGET_MKSPEC)
|
||||
translate_string_input(xplatform QT_QMAKE_TARGET_MKSPEC)
|
||||
guess_compiler_from_mkspec()
|
||||
translate_string_input(qpa_default_platform QT_QPA_DEFAULT_PLATFORM)
|
||||
translate_list_input(qpa_platforms QT_QPA_PLATFORMS)
|
||||
|
||||
translate_path_input(android-sdk ANDROID_SDK_ROOT)
|
||||
translate_path_input(android-ndk ANDROID_NDK_ROOT)
|
||||
|
@ -145,7 +145,8 @@ The following table describes the mapping of configure options to CMake argument
|
||||
| -opengl <api> | -DINPUT_opengl=<api> | |
|
||||
| -opengles3 | -DFEATURE_opengles3=ON | |
|
||||
| -egl | -DFEATURE_egl=ON | |
|
||||
| -qpa <name> | -DQT_QPA_DEFAULT_PLATFORM=<name> | |
|
||||
| -qpa <name>;...;<name_n> | -DQT_QPA_PLATFORMS=<name>;...;<name_n> | |
|
||||
| -default-qpa <name> | -DQT_QPA_DEFAULT_PLATFORM=<name> | |
|
||||
| -xcb-xlib | -DFEATURE_xcb_xlib=ON | |
|
||||
| -direct2d | -DFEATURE_direct2d=ON | |
|
||||
| -directfb | -DFEATURE_directfb=ON | |
|
||||
|
@ -290,8 +290,10 @@ Gui, printing, widget options:
|
||||
-opengles3 ........... Enable OpenGL ES 3.x support instead of ES 2.x [auto]
|
||||
-egl ................. Enable EGL support [auto]
|
||||
|
||||
-qpa <name> .......... Select default QPA backend(s) (e.g., xcb, cocoa, windows)
|
||||
A prioritized list separated by semi-colons.
|
||||
-qpa <qpa1>[;<qpa2>] . Select supported QPA backend(s) (e.g., xcb, cocoa,
|
||||
windows). A list separated by semi-colons.
|
||||
-default-qpa <name> .. Select the default QPA backend (e.g., xcb, cocoa,
|
||||
windows).
|
||||
-xcb-xlib............. Enable Xcb-Xlib support [auto]
|
||||
|
||||
Platform backends:
|
||||
|
@ -7,7 +7,9 @@ qt_find_package(WrapPNG PROVIDED_TARGETS WrapPNG::WrapPNG)
|
||||
qt_find_package(WrapFreetype PROVIDED_TARGETS WrapFreetype::WrapFreetype)
|
||||
|
||||
if (QT_FEATURE_gui)
|
||||
if(WIN32)
|
||||
if(QT_QPA_PLATFORMS)
|
||||
list(GET QT_QPA_PLATFORMS 0 _default_platform)
|
||||
elseif(WIN32)
|
||||
set(_default_platform "windows")
|
||||
elseif(ANDROID)
|
||||
set(_default_platform "android")
|
||||
@ -30,6 +32,11 @@ if (QT_FEATURE_gui)
|
||||
endif()
|
||||
|
||||
set(QT_QPA_DEFAULT_PLATFORM "${_default_platform}" CACHE STRING "QPA default platform")
|
||||
if(NOT "${QT_QPA_DEFAULT_PLATFORM}" IN_LIST QT_QPA_PLATFORMS)
|
||||
list(APPEND QT_QPA_PLATFORMS "${QT_QPA_DEFAULT_PLATFORM}")
|
||||
set(QT_QPA_PLATFORMS "${QT_QPA_PLATFORMS}" CACHE STRING
|
||||
"QPA platforms deployed by default" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Silence warnings in 3rdparty code
|
||||
|
@ -27,7 +27,8 @@ qt_commandline_option(opengl TYPE optionalString VALUES no yes desktop es2 dynam
|
||||
qt_commandline_option(opengl-es-2 TYPE void NAME opengl VALUE es2)
|
||||
qt_commandline_option(opengles3 TYPE boolean)
|
||||
qt_commandline_option(openvg TYPE boolean)
|
||||
qt_commandline_option(qpa TYPE string NAME qpa_default_platform)
|
||||
qt_commandline_option(qpa TYPE string NAME qpa_platforms)
|
||||
qt_commandline_option(default-qpa TYPE string NAME qpa_default_platform)
|
||||
qt_commandline_option(sm TYPE boolean NAME sessionmanager)
|
||||
qt_commandline_option(tslib TYPE boolean)
|
||||
qt_commandline_option(vulkan TYPE boolean)
|
||||
|
@ -9,7 +9,7 @@ qt_find_package(EGL)
|
||||
qt_internal_add_plugin(QAndroidIntegrationPlugin
|
||||
OUTPUT_NAME qtforandroid
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES android
|
||||
DEFAULT_IF "android" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
androidcontentfileengine.cpp androidcontentfileengine.h
|
||||
androiddeadlockprotector.h
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
qt_internal_add_plugin(QCocoaIntegrationPlugin
|
||||
OUTPUT_NAME qcocoa
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES cocoa
|
||||
DEFAULT_IF "cocoa" IN_LIST QT_QPA_PLATFORMS
|
||||
PLUGIN_TYPE platforms
|
||||
SOURCES
|
||||
main.mm
|
||||
|
@ -92,7 +92,7 @@ endif()
|
||||
qt_internal_add_plugin(QEglFSIntegrationPlugin
|
||||
OUTPUT_NAME qeglfs
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES eglfs
|
||||
DEFAULT_IF "eglfs" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
qeglfsmain.cpp
|
||||
DEFINES
|
||||
|
@ -21,7 +21,7 @@ endif()
|
||||
qt_internal_add_plugin(QIOSIntegrationPlugin
|
||||
OUTPUT_NAME qios
|
||||
STATIC # Force static, even in shared builds
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES ios
|
||||
DEFAULT_IF "ios" IN_LIST QT_QPA_PLATFORMS
|
||||
PLUGIN_TYPE platforms
|
||||
SOURCES
|
||||
plugin.mm
|
||||
|
@ -8,7 +8,7 @@
|
||||
qt_internal_add_plugin(QLinuxFbIntegrationPlugin
|
||||
OUTPUT_NAME qlinuxfb
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES linuxfb
|
||||
DEFAULT_IF "linuxfb" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
main.cpp
|
||||
qlinuxfbintegration.cpp qlinuxfbintegration.h
|
||||
|
@ -10,7 +10,7 @@ qt_find_package(WrapFreetype PROVIDED_TARGETS WrapFreetype::WrapFreetype)
|
||||
qt_internal_add_plugin(QMinimalIntegrationPlugin
|
||||
OUTPUT_NAME qminimal
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES minimal
|
||||
DEFAULT_IF "minimal" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
main.cpp
|
||||
qminimalbackingstore.cpp qminimalbackingstore.h
|
||||
|
@ -10,7 +10,7 @@ qt_find_package(EGL)
|
||||
qt_internal_add_plugin(QMinimalEglIntegrationPlugin
|
||||
OUTPUT_NAME qminimalegl
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES minimalegl
|
||||
DEFAULT_IF "minimalegl" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
main.cpp
|
||||
qminimaleglintegration.cpp qminimaleglintegration.h
|
||||
|
@ -8,7 +8,7 @@
|
||||
qt_internal_add_plugin(QOffscreenIntegrationPlugin
|
||||
OUTPUT_NAME qoffscreen
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES offscreen
|
||||
DEFAULT_IF "offscreen" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
main.cpp
|
||||
qoffscreencommon.cpp qoffscreencommon.h
|
||||
|
@ -8,7 +8,7 @@
|
||||
qt_internal_add_plugin(QQnxIntegrationPlugin
|
||||
OUTPUT_NAME qqnx
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES qnx
|
||||
DEFAULT_IF "qnx" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
main.cpp main.h
|
||||
qqnxabstractcover.h
|
||||
|
@ -6,7 +6,7 @@ qt_find_package(WrapFreetype PROVIDED_TARGETS WrapFreetype::WrapFreetype)
|
||||
qt_internal_add_plugin(QVkKhrDisplayIntegrationPlugin
|
||||
OUTPUT_NAME qvkkhrdisplay
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES vkkhrdisplay
|
||||
DEFAULT_IF "vkkhrdisplay" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
main.cpp
|
||||
qvkkhrdisplayintegration.cpp qvkkhrdisplayintegration.h
|
||||
|
@ -8,7 +8,7 @@
|
||||
qt_internal_add_plugin(QVncIntegrationPlugin
|
||||
OUTPUT_NAME qvnc
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES vnc
|
||||
DEFAULT_IF "vnc" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
main.cpp
|
||||
qvnc.cpp qvnc_p.h
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
qt_internal_add_plugin(QWasmIntegrationPlugin
|
||||
OUTPUT_NAME qwasm
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES wasm
|
||||
DEFAULT_IF "wasm" IN_LIST QT_QPA_PLATFORMS
|
||||
PLUGIN_TYPE platforms
|
||||
SOURCES
|
||||
main.cpp
|
||||
|
@ -8,7 +8,7 @@
|
||||
qt_internal_add_plugin(QWindowsIntegrationPlugin
|
||||
OUTPUT_NAME qwindows
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES windows
|
||||
DEFAULT_IF "windows" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
main.cpp
|
||||
qtwindowsglobal.h
|
||||
|
@ -164,7 +164,7 @@ endif()
|
||||
qt_internal_add_plugin(QXcbIntegrationPlugin
|
||||
OUTPUT_NAME qxcb
|
||||
PLUGIN_TYPE platforms
|
||||
DEFAULT_IF ${QT_QPA_DEFAULT_PLATFORM} MATCHES xcb
|
||||
DEFAULT_IF "xcb" IN_LIST QT_QPA_PLATFORMS
|
||||
SOURCES
|
||||
qxcbmain.cpp
|
||||
DEFINES
|
||||
|
Loading…
x
Reference in New Issue
Block a user