Fix build of static plugins with resources
This patch reverts388c4ef9f7
. 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 reverts388c4ef9f7
, 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>
This commit is contained in:
parent
6a221f3d05
commit
826b09f0c5
@ -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" \
|
||||
|
Loading…
Reference in New Issue
Block a user