summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-12-04 12:00:37 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-12-10 12:18:52 +0000
commit826b09f0c507fe5321a8534054a4f0b7bdd2699b (patch)
tree4ebcbabc154324cc1acc7dfa72c5c2e81a36b65c /mkspecs
parent6a221f3d05b6d0e902d86d75428364747268c6c9 (diff)
Fix build of static plugins with resources
This patch reverts 388c4ef9f78c8e. The reason is that it generates a symbol (resource_init_function) based on the name of the pro-file. But if different plugins are built from a pro-file with the same name, you end up linking in many symbols with the same name as well. Which one that ends up being used at runtime will typically depend on the linking order of the plugins. This problem will happen if you build an app for iOS that uses both controls 1 and controls 2. In that case, both QML plugins are built from a "controls.pro" file. At runtime, only one of the plugins will be imported correctly. This patch therefore reverts 388c4ef9f78c8e, but at the same time, to not re-introduce the problem it fixed, we instead genereate both a debug and release version of the plugin_resources.cpp file. That way we can still depend on the TARGET variable for generating both the resource_init_function symbol and the cpp file. Fixes: QTBUG-62647 Fixes: QTBUG-71386 Fixes: QTBUG-72108 Change-Id: I3d8c53132458b30ed9f47a259f1f8e4fa4d44130 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/resources.prf9
1 files changed, 3 insertions, 6 deletions
diff --git a/mkspecs/features/resources.prf b/mkspecs/features/resources.prf
index a25846bd77..48e9f83885 100644
--- a/mkspecs/features/resources.prf
+++ b/mkspecs/features/resources.prf
@@ -73,17 +73,14 @@ for(resource, RESOURCES) {
}
!isEmpty(RESOURCES):contains(TEMPLATE, .*lib):plugin:static {
- pluginName = $$lower($$replace(_PRO_FILE_, .*/([^/.]+)\\.[^/.]+, \\1))
-
- resource_init_function = $${pluginName}_plugin_resource_init
+ resource_init_function = $$lower($$basename(TARGET))_plugin_resource_init
DEFINES += "QT_PLUGIN_RESOURCE_INIT_FUNCTION=$$resource_init_function"
-
- RESOURCE_INIT_CPP = $$OUT_PWD/$${pluginName}_plugin_resources.cpp
+ RESOURCE_INIT_CPP = $$OUT_PWD/$$lower($$basename(TARGET))_plugin_resources.cpp
GENERATED_SOURCES += $$RESOURCE_INIT_CPP
QMAKE_DISTCLEAN += $$RESOURCE_INIT_CPP
- !build_pass {
+ isEmpty(BUILDS)|build_pass {
RESOURCE_INIT_CONT = \
"// This file is autogenerated by qmake. It contains a function that" \
"// references all resources the plugin includes and the function is" \