From 3a62f9e0c98d1cc311846394b744c8553ea9739c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 6 May 2021 16:38:53 +0200 Subject: CMake: Resurrect test_import_plugins cmake build tests Now that we run tests for static Qt builds in the CI, it makes sense to restore the CMake build tests that check that static plugin importing works correctly. Resurrect the previously commented out test_import_plugins project and port the mockplugins qmake projects to CMake. mockplugins is a CMake project that uses the internal Qt CMake API to build and install some Qt modules and plugins. test_import_plugins depends on that test (via a CMake fixture) to build public projects that use those plugins. The installation of the mockplugins modules pollutes the Qt install prefix, but in the CI that only happens on the test VM, which means the release packages are not affected. Locally on a developer machine the Qt install path will be polluted, but it's not that much of a big deal. We could try and address that in a future change by using the QT_ADDITIONAL_PACKAGES_PREFIX_PATH functionality added for Conan to allow the installation of Qt packages into a non-standard prefix. Task-number: QTBUG-87580 Task-number: QTBUG-92933 Change-Id: I0841064a60a5ffba5118640d3197527a38ba6c30 Reviewed-by: Qt CI Bot Reviewed-by: Joerg Bornemann --- tests/auto/cmake/mockplugins/.cmake.conf | 1 + tests/auto/cmake/mockplugins/CMakeLists.txt | 32 ++++++++++++++++++++++ .../cmake/mockplugins/mock1plugin/CMakeLists.txt | 9 ++++++ .../cmake/mockplugins/mock2plugin/CMakeLists.txt | 9 ++++++ .../cmake/mockplugins/mock3plugin/CMakeLists.txt | 9 ++++++ .../cmake/mockplugins/mock4plugin/CMakeLists.txt | 10 +++++++ .../cmake/mockplugins/mock5plugin/CMakeLists.txt | 10 +++++++ .../cmake/mockplugins/mock6plugin/CMakeLists.txt | 9 ++++++ .../cmake/mockplugins/mockplugins1/CMakeLists.txt | 9 ++++++ .../cmake/mockplugins/mockplugins1/configure.cmake | 2 ++ .../cmake/mockplugins/mockplugins2/CMakeLists.txt | 8 ++++++ .../cmake/mockplugins/mockplugins3/CMakeLists.txt | 9 ++++++ .../cmake/mockplugins/mockplugins3/configure.cmake | 2 ++ 13 files changed, 119 insertions(+) create mode 100644 tests/auto/cmake/mockplugins/.cmake.conf create mode 100644 tests/auto/cmake/mockplugins/CMakeLists.txt create mode 100644 tests/auto/cmake/mockplugins/mock1plugin/CMakeLists.txt create mode 100644 tests/auto/cmake/mockplugins/mock2plugin/CMakeLists.txt create mode 100644 tests/auto/cmake/mockplugins/mock3plugin/CMakeLists.txt create mode 100644 tests/auto/cmake/mockplugins/mock4plugin/CMakeLists.txt create mode 100644 tests/auto/cmake/mockplugins/mock5plugin/CMakeLists.txt create mode 100644 tests/auto/cmake/mockplugins/mock6plugin/CMakeLists.txt create mode 100644 tests/auto/cmake/mockplugins/mockplugins1/CMakeLists.txt create mode 100644 tests/auto/cmake/mockplugins/mockplugins1/configure.cmake create mode 100644 tests/auto/cmake/mockplugins/mockplugins2/CMakeLists.txt create mode 100644 tests/auto/cmake/mockplugins/mockplugins3/CMakeLists.txt create mode 100644 tests/auto/cmake/mockplugins/mockplugins3/configure.cmake (limited to 'tests/auto/cmake/mockplugins') diff --git a/tests/auto/cmake/mockplugins/.cmake.conf b/tests/auto/cmake/mockplugins/.cmake.conf new file mode 100644 index 0000000000..4e73b3d607 --- /dev/null +++ b/tests/auto/cmake/mockplugins/.cmake.conf @@ -0,0 +1 @@ +set(QT_REPO_MODULE_VERSION "6.2.0") diff --git a/tests/auto/cmake/mockplugins/CMakeLists.txt b/tests/auto/cmake/mockplugins/CMakeLists.txt new file mode 100644 index 0000000000..c536cc3f09 --- /dev/null +++ b/tests/auto/cmake/mockplugins/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from qtsvg.pro. + +cmake_minimum_required(VERSION 3.15.0) + +include(.cmake.conf) +project(QtMockPlugins + VERSION "${QT_REPO_MODULE_VERSION}" + DESCRIPTION "Qt MockPlugins Libraries" + HOMEPAGE_URL "https://qt.io/" + LANGUAGES CXX C +) + +# Make sure we only use latest private CMake API, aka no compatibility wrappers. +set(QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS TRUE) + +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) +find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Gui Widgets Xml) + +qt_build_repo_begin() + +add_subdirectory(mockplugins1) +add_subdirectory(mockplugins2) +add_subdirectory(mockplugins3) + +add_subdirectory(mock1plugin) +add_subdirectory(mock2plugin) +add_subdirectory(mock3plugin) +add_subdirectory(mock4plugin) +add_subdirectory(mock5plugin) +add_subdirectory(mock6plugin) + +qt_build_repo_end() diff --git a/tests/auto/cmake/mockplugins/mock1plugin/CMakeLists.txt b/tests/auto/cmake/mockplugins/mock1plugin/CMakeLists.txt new file mode 100644 index 0000000000..9443e15c56 --- /dev/null +++ b/tests/auto/cmake/mockplugins/mock1plugin/CMakeLists.txt @@ -0,0 +1,9 @@ +qt_internal_add_plugin(QMock1Plugin + CLASS_NAME QMock1Plugin + TYPE mockplugin + SOURCES + qmock1plugin.cpp qmock1plugin.h + PUBLIC_LIBRARIES + Qt::Core + Qt::MockPlugins1 +) diff --git a/tests/auto/cmake/mockplugins/mock2plugin/CMakeLists.txt b/tests/auto/cmake/mockplugins/mock2plugin/CMakeLists.txt new file mode 100644 index 0000000000..7e88d2ea84 --- /dev/null +++ b/tests/auto/cmake/mockplugins/mock2plugin/CMakeLists.txt @@ -0,0 +1,9 @@ +qt_internal_add_plugin(QMock2Plugin + CLASS_NAME QMock2Plugin + TYPE mockplugin + SOURCES + qmock2plugin.cpp qmock2plugin.h + PUBLIC_LIBRARIES + Qt::Core + Qt::MockPlugins1 +) diff --git a/tests/auto/cmake/mockplugins/mock3plugin/CMakeLists.txt b/tests/auto/cmake/mockplugins/mock3plugin/CMakeLists.txt new file mode 100644 index 0000000000..e58947d5e7 --- /dev/null +++ b/tests/auto/cmake/mockplugins/mock3plugin/CMakeLists.txt @@ -0,0 +1,9 @@ +qt_internal_add_plugin(QMock3Plugin + CLASS_NAME QMock3Plugin + TYPE mockplugin + SOURCES + qmock3plugin.cpp qmock3plugin.h + PUBLIC_LIBRARIES + Qt::Core + Qt::MockPlugins1 +) diff --git a/tests/auto/cmake/mockplugins/mock4plugin/CMakeLists.txt b/tests/auto/cmake/mockplugins/mock4plugin/CMakeLists.txt new file mode 100644 index 0000000000..f254f044d5 --- /dev/null +++ b/tests/auto/cmake/mockplugins/mock4plugin/CMakeLists.txt @@ -0,0 +1,10 @@ +qt_internal_add_plugin(QMock4Plugin + CLASS_NAME QMock4Plugin + TYPE mockplugin + DEFAULT_IF FALSE + SOURCES + qmock4plugin.cpp qmock4plugin.h + PUBLIC_LIBRARIES + Qt::Core + Qt::MockPlugins1 +) diff --git a/tests/auto/cmake/mockplugins/mock5plugin/CMakeLists.txt b/tests/auto/cmake/mockplugins/mock5plugin/CMakeLists.txt new file mode 100644 index 0000000000..a66f8955a0 --- /dev/null +++ b/tests/auto/cmake/mockplugins/mock5plugin/CMakeLists.txt @@ -0,0 +1,10 @@ +qt_internal_add_plugin(QMock5Plugin + CLASS_NAME QMock5Plugin + TYPE mockplugin + DEFAULT_IF FALSE + SOURCES + qmock5plugin.cpp qmock5plugin.h + PUBLIC_LIBRARIES + Qt::Core + Qt::MockPlugins3 +) diff --git a/tests/auto/cmake/mockplugins/mock6plugin/CMakeLists.txt b/tests/auto/cmake/mockplugins/mock6plugin/CMakeLists.txt new file mode 100644 index 0000000000..974b891704 --- /dev/null +++ b/tests/auto/cmake/mockplugins/mock6plugin/CMakeLists.txt @@ -0,0 +1,9 @@ +qt_internal_add_plugin(QMock6Plugin + CLASS_NAME QMock6Plugin + TYPE mockauxplugin + SOURCES + qmock6plugin.cpp qmock6plugin.h + PUBLIC_LIBRARIES + Qt::Core + Qt::MockPlugins3 +) diff --git a/tests/auto/cmake/mockplugins/mockplugins1/CMakeLists.txt b/tests/auto/cmake/mockplugins/mockplugins1/CMakeLists.txt new file mode 100644 index 0000000000..705885c7fa --- /dev/null +++ b/tests/auto/cmake/mockplugins/mockplugins1/CMakeLists.txt @@ -0,0 +1,9 @@ +qt_internal_add_module(MockPlugins1 + PLUGIN_TYPES mockplugin + SOURCES + fake.cpp + LIBRARIES + Qt::CorePrivate + PUBLIC_LIBRARIES + Qt::Core +) diff --git a/tests/auto/cmake/mockplugins/mockplugins1/configure.cmake b/tests/auto/cmake/mockplugins/mockplugins1/configure.cmake new file mode 100644 index 0000000000..46da2db2b8 --- /dev/null +++ b/tests/auto/cmake/mockplugins/mockplugins1/configure.cmake @@ -0,0 +1,2 @@ +# This is needed so that MODULE_PLUGIN_TYPES property is set on the exported target. +# Fun times. diff --git a/tests/auto/cmake/mockplugins/mockplugins2/CMakeLists.txt b/tests/auto/cmake/mockplugins/mockplugins2/CMakeLists.txt new file mode 100644 index 0000000000..9d406ef483 --- /dev/null +++ b/tests/auto/cmake/mockplugins/mockplugins2/CMakeLists.txt @@ -0,0 +1,8 @@ +qt_internal_add_module(MockPlugins2 + SOURCES + fake.cpp + LIBRARIES + Qt::CorePrivate + PUBLIC_LIBRARIES + Qt::Core +) diff --git a/tests/auto/cmake/mockplugins/mockplugins3/CMakeLists.txt b/tests/auto/cmake/mockplugins/mockplugins3/CMakeLists.txt new file mode 100644 index 0000000000..fc7c7aa944 --- /dev/null +++ b/tests/auto/cmake/mockplugins/mockplugins3/CMakeLists.txt @@ -0,0 +1,9 @@ +qt_internal_add_module(MockPlugins3 + PLUGIN_TYPES mockauxplugin + SOURCES + fake.cpp + LIBRARIES + Qt::CorePrivate + PUBLIC_LIBRARIES + Qt::Core +) diff --git a/tests/auto/cmake/mockplugins/mockplugins3/configure.cmake b/tests/auto/cmake/mockplugins/mockplugins3/configure.cmake new file mode 100644 index 0000000000..46da2db2b8 --- /dev/null +++ b/tests/auto/cmake/mockplugins/mockplugins3/configure.cmake @@ -0,0 +1,2 @@ +# This is needed so that MODULE_PLUGIN_TYPES property is set on the exported target. +# Fun times. -- cgit v1.2.3