summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2018-05-18 12:19:38 +0200
committerAndy Shaw <andy.shaw@qt.io>2018-08-16 08:56:27 +0000
commitcdccd0222bbed1954d5d7fe0da9d2308c202f3b1 (patch)
tree6dfe692118d1bb591258cfc2cfcb13b2fc0189b1 /tests/auto
parent44b6757fe50b6bf581864d3da519a3ff60818fa8 (diff)
Add support for big resources with CMake
Task-number: QTBUG-55680 Change-Id: I09570a4e959ffd0e6d378bc315b13d57baaa82e8 Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/cmake/CMakeLists.txt1
-rw-r--r--tests/auto/cmake/test_add_big_resource/CMakeLists.txt13
-rw-r--r--tests/auto/cmake/test_add_big_resource/myobject.cpp44
-rw-r--r--tests/auto/cmake/test_add_big_resource/myobject.h44
-rw-r--r--tests/auto/cmake/test_add_big_resource/resource_file.txt1
-rw-r--r--tests/auto/cmake/test_add_big_resource/resource_file2.txt1
-rw-r--r--tests/auto/cmake/test_add_big_resource/test_add_big_resource.qrc6
-rw-r--r--tests/auto/cmake/test_add_big_resource/test_add_big_resource2.qrc6
8 files changed, 116 insertions, 0 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index ec75ec7caf..eac5b9976d 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -146,6 +146,7 @@ endif()
expect_pass(test_interface_link_libraries)
expect_pass(test_moc_macro_target)
+expect_pass(test_add_big_resource)
if (NOT CMAKE_VERSION VERSION_LESS 3.8)
# With earlier CMake versions, this test would simply run moc multiple times and lead to:
diff --git a/tests/auto/cmake/test_add_big_resource/CMakeLists.txt b/tests/auto/cmake/test_add_big_resource/CMakeLists.txt
new file mode 100644
index 0000000000..f928b11278
--- /dev/null
+++ b/tests/auto/cmake/test_add_big_resource/CMakeLists.txt
@@ -0,0 +1,13 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(test_add_big_resource)
+
+find_package(Qt5Core REQUIRED)
+
+qt5_wrap_cpp(moc_files myobject.h)
+
+qt5_add_big_resources(rcc_files "test_add_big_resource.qrc" "test_add_big_resource2.qrc")
+
+add_executable(myobject myobject.cpp ${moc_files} ${rcc_files})
+target_link_libraries(myobject ${Qt5Core_LIBRARIES})
diff --git a/tests/auto/cmake/test_add_big_resource/myobject.cpp b/tests/auto/cmake/test_add_big_resource/myobject.cpp
new file mode 100644
index 0000000000..5d320b8592
--- /dev/null
+++ b/tests/auto/cmake/test_add_big_resource/myobject.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "myobject.h"
+
+MyObject::MyObject(QObject *parent)
+ : QObject(parent)
+{
+ emit someSignal();
+}
+
+int main(int argc, char **argv)
+{
+ MyObject myObject;
+ // Compile error if the resource file was not created.
+ Q_INIT_RESOURCE(test_add_big_resource);
+ Q_INIT_RESOURCE(test_add_big_resource2);
+ return 0;
+}
diff --git a/tests/auto/cmake/test_add_big_resource/myobject.h b/tests/auto/cmake/test_add_big_resource/myobject.h
new file mode 100644
index 0000000000..b6fbce32cd
--- /dev/null
+++ b/tests/auto/cmake/test_add_big_resource/myobject.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MYOBJECT_H
+#define MYOBJECT_H
+
+#include <QObject>
+
+class MyObject : public QObject
+{
+ Q_OBJECT
+public:
+ MyObject(QObject *parent = 0);
+
+signals:
+ void someSignal();
+};
+
+#endif
diff --git a/tests/auto/cmake/test_add_big_resource/resource_file.txt b/tests/auto/cmake/test_add_big_resource/resource_file.txt
new file mode 100644
index 0000000000..2c604a4f18
--- /dev/null
+++ b/tests/auto/cmake/test_add_big_resource/resource_file.txt
@@ -0,0 +1 @@
+Ken sent me.
diff --git a/tests/auto/cmake/test_add_big_resource/resource_file2.txt b/tests/auto/cmake/test_add_big_resource/resource_file2.txt
new file mode 100644
index 0000000000..2c604a4f18
--- /dev/null
+++ b/tests/auto/cmake/test_add_big_resource/resource_file2.txt
@@ -0,0 +1 @@
+Ken sent me.
diff --git a/tests/auto/cmake/test_add_big_resource/test_add_big_resource.qrc b/tests/auto/cmake/test_add_big_resource/test_add_big_resource.qrc
new file mode 100644
index 0000000000..00a17f541f
--- /dev/null
+++ b/tests/auto/cmake/test_add_big_resource/test_add_big_resource.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>resource_file.txt</file>
+</qresource>
+</RCC>
+
diff --git a/tests/auto/cmake/test_add_big_resource/test_add_big_resource2.qrc b/tests/auto/cmake/test_add_big_resource/test_add_big_resource2.qrc
new file mode 100644
index 0000000000..e21cc5e138
--- /dev/null
+++ b/tests/auto/cmake/test_add_big_resource/test_add_big_resource2.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>resource_file2.txt</file>
+</qresource>
+</RCC>
+