aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/Qt6QmlMacros.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-08-14 20:40:51 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-08-17 15:24:39 +0200
commitf722c5eca06765327bbc08e69244b3e69536f2a7 (patch)
treeda6b21b57afa83236cb4c5acc63bba5896cb835e /src/qml/Qt6QmlMacros.cmake
parent55dff384c1c8361a65feed452584d40ad9e1bcb0 (diff)
CMake: Adjust naming of Qt Qml plugins for Android
The names are identical to the qmake ones now, following the scheme that the plugin file name should contain the TARGET_PATH, aka the directory path of the plugin, encoded in the file name itself because that's how the Android Qml plugin loader expects them. A second change is needed to pass the correct library suffix as the define, so that the Qml plugin loader actually finds them. After that, the following error goes away. libemitters_x86: qrc:/particles/emitters/emitters.qml:51:1: module "QtQuick" plugin "qtquick2plugin" not found import QtQuick 2.0 Task-number: QTBUG-85399 Change-Id: I16b9f877db3e5c8266429772a44231f1a356515c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/qml/Qt6QmlMacros.cmake')
-rw-r--r--src/qml/Qt6QmlMacros.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index d16e48c420..07c99200af 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -170,6 +170,26 @@ function(qt6_add_qml_module target)
string(REPLACE "." "/" arg_TARGET_PATH ${arg_URI})
endif()
+ if (ANDROID)
+ # Adjust Qml plugin names on Android similar to qml_plugin.prf which calls
+ # $$qt5LibraryTarget($$TARGET, "qml/$$TARGETPATH/").
+ # Example plugin names:
+ # qtdeclarative
+ # TARGET_PATH: QtQml/Models
+ # file name: libqml_QtQml_Models_modelsplugin_arm64-v8a.so
+ # qtquickcontrols2
+ # TARGET_PATH: QtQuick/Controls.2/Material
+ # file name:
+ # libqml_QtQuick_Controls.2_Material_qtquickcontrols2materialstyleplugin_arm64-v8a.so
+ string(REPLACE "/" "_" android_plugin_name_infix_name "${arg_TARGET_PATH}")
+
+ set(final_android_qml_plugin_name "qml_${android_plugin_name_infix_name}_${target}")
+ set_target_properties(${target}
+ PROPERTIES
+ LIBRARY_OUTPUT_NAME "${final_android_qml_plugin_name}"
+ )
+ endif()
+
if (NOT arg_RESOURCE_PREFIX)
set(arg_RESOURCE_PREFIX "/org.qt-project/imports")
endif()