From 457ab46936f4c90099a0f1b16abaff5312037fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 14 Jan 2020 16:52:54 +0100 Subject: Handle resources with dots in the qrc file name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were removing the .qrc suffix of resources in a way that assumed the filenames would not have any dots in them, but this is not always the case, and we would end up resolving an empty resource name for file names such as .rcc-bar.qrc (e.g. as produced by the qmlcache system). We now remove the .qrc extension explicitly. Change-Id: I50e1d88ac71ca1335bb05f3dbbb2d9bb441a8d64 Fixes: QTBUG-81255 Reviewed-by: Tor Arne Vestbø --- mkspecs/features/resources.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mkspecs/features/resources.prf') diff --git a/mkspecs/features/resources.prf b/mkspecs/features/resources.prf index cee0981db0..6d9f27b86b 100644 --- a/mkspecs/features/resources.prf +++ b/mkspecs/features/resources.prf @@ -30,7 +30,7 @@ qtFlattenResources() "{" \ for (resource, RESOURCES) { - resource_name = $$section($$list($$basename(resource)), ., 0, 0) + resource_name = $$replace($$list($$basename(resource)),\.qrc$, ) resource_name = $$replace(resource_name, [^a-zA-Z0-9_], _) RESOURCE_INIT_CONT += " Q_INIT_RESOURCE($$resource_name);" } -- cgit v1.2.3 From 495db2cd2bb9130864f2dd1291788288765dfe7a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 30 Jan 2020 13:59:27 +0100 Subject: Add function for initializing plugin resources for static builds Also move the setting of default RCC_DIR into qtFlattenResources as we need a valid RCC_DIR there. Fixes: QTBUG-81699 Fixes: QTBUG-81713 Change-Id: I7558d99f3aca75d2e9cad0ec89fbb0aa0758dcc7 Reviewed-by: Simon Hausmann --- mkspecs/features/resources.prf | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) (limited to 'mkspecs/features/resources.prf') diff --git a/mkspecs/features/resources.prf b/mkspecs/features/resources.prf index 6d9f27b86b..151051163d 100644 --- a/mkspecs/features/resources.prf +++ b/mkspecs/features/resources.prf @@ -1,6 +1,5 @@ qtPrepareTool(QMAKE_RCC, rcc, _DEP) -isEmpty(RCC_DIR):RCC_DIR = . isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc !contains(QMAKE_RESOURCE_FLAGS, -root):!isEmpty(QMAKE_RESOURCE_ROOT):QMAKE_RESOURCE_FLAGS += -root $$QMAKE_RESOURCE_ROOT @@ -8,39 +7,7 @@ isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc load(resources_functions) qtFlattenResources() - -!isEmpty(RESOURCES):contains(TEMPLATE, .*lib):plugin:static { - pluginBaseName = $$basename(TARGET) - pluginName = $$lower($$replace(pluginBaseName, [-], _)) - resource_init_function = $${pluginName}_plugin_resource_init - DEFINES += "QT_PLUGIN_RESOURCE_INIT_FUNCTION=$$resource_init_function" - RESOURCE_INIT_CPP = $$OUT_PWD/$${pluginName}_plugin_resources.cpp - - GENERATED_SOURCES += $$RESOURCE_INIT_CPP - QMAKE_DISTCLEAN += $$RESOURCE_INIT_CPP - - 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" \ - "// referenced by Qt_(MOC_)EXPORT_PLUGIN to ensure the inclusion in" \ - "// the statically linked plugin." \ - "$${LITERAL_HASH}include " \ - "void $${resource_init_function}() " \ - "{" \ - - for (resource, RESOURCES) { - resource_name = $$replace($$list($$basename(resource)),\.qrc$, ) - resource_name = $$replace(resource_name, [^a-zA-Z0-9_], _) - RESOURCE_INIT_CONT += " Q_INIT_RESOURCE($$resource_name);" - } - - RESOURCE_INIT_CONT += \ - "}" - - write_file($$RESOURCE_INIT_CPP, RESOURCE_INIT_CONT)|error() - } -} +qtEnsurePluginResourcesCpp() rcc.input = RESOURCES rcc.name = RCC ${QMAKE_FILE_IN} -- cgit v1.2.3