diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2021-05-19 19:46:24 +0200 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2021-05-27 14:28:17 +0200 |
commit | 19e789bace887105badae83c0a79429bbf8e8221 (patch) | |
tree | 1e369b20032c64cc5cb49b9073dbc70df11325d5 /tests/auto/cmake/test_static_resources/test_init_resources_static_plugin/pluginmain.cpp | |
parent | 029425478aed1454ec3f374af0284371d050ca68 (diff) |
Implement propagation of object files to the end-point executable
This proposal collects all the resource objects to the qt-specific
property of the static libraries. This is done to avoid littering
of other static libraries and put resource object files to the
source part of the linker line when linking the end-point
executable.
The way we link object resource libraries is changed back to the
target_link_libraries approach as we may omit using finalizers
with linkers other than ld. Users may enforce finalizers by calling
the qt6_enable_resource_objects_finalizer_mode function if need.
Refactor tests related to the static resources.
Amends ddaa7150d85624ab545ccfe098fe8b2d18241940
Task-number: QTBUG-93002
Change-Id: I74135e291cd82fb54d1b284b4b4a1e002b1fef98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/cmake/test_static_resources/test_init_resources_static_plugin/pluginmain.cpp')
-rw-r--r-- | tests/auto/cmake/test_static_resources/test_init_resources_static_plugin/pluginmain.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/auto/cmake/test_static_resources/test_init_resources_static_plugin/pluginmain.cpp b/tests/auto/cmake/test_static_resources/test_init_resources_static_plugin/pluginmain.cpp new file mode 100644 index 0000000000..992c948e55 --- /dev/null +++ b/tests/auto/cmake/test_static_resources/test_init_resources_static_plugin/pluginmain.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore/qfile.h> +#include <QtCore/qdebug.h> + +QT_BEGIN_NAMESPACE + +class TestStaticPlugin : public QObject +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "TestStaticPlugin" URI "qt.teststaticplugin") +public: + TestStaticPlugin() = default; + Q_INVOKABLE bool checkResources() + { + return QFile::exists(":/teststaticplugin1/testfile1.txt") + && QFile::exists(":/teststaticplugin2/testfile2.txt"); + } +}; + +QT_END_NAMESPACE + +#include "pluginmain.moc" |