diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-07-20 20:35:05 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-07-21 15:03:40 (GMT) |
commit | 0e434fcf0428f43dcc5f540ca0a61e078c9f4b4c (patch) | |
tree | 598fd1f91b2855d43064db6d5afb18687efaf155 /Tests/QtAutogenRerun/mocPlugin | |
parent | af9708881f4c2d8f501ae63a4088c020edb6f070 (diff) | |
download | CMake-0e434fcf0428f43dcc5f540ca0a61e078c9f4b4c.zip CMake-0e434fcf0428f43dcc5f540ca0a61e078c9f4b4c.tar.gz CMake-0e434fcf0428f43dcc5f540ca0a61e078c9f4b4c.tar.bz2 |
Autogen: Move repeated tests to new QtAutogenRerun test
By moving QtAutogen tests that run repeatedly to a new QtAutogenRerun
test, the `ctest -R Qt[45]Autogen -j4` call runs approximately 25%
faster.
Diffstat (limited to 'Tests/QtAutogenRerun/mocPlugin')
19 files changed, 167 insertions, 0 deletions
diff --git a/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt b/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt new file mode 100644 index 0000000..9b224fb --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.9) +project(mocPlugin CXX) + +set(CMAKE_AUTOMOC_DEPEND_FILTERS + "A_CUSTOM_MACRO" + "[\n][ \t]*A_CUSTOM_MACRO[ \t\r\n]*\\([^,]+,[ \t\r\n]*\"([^\"]+)\"" + ) + +if (NOT QT_TEST_VERSION STREQUAL 5) + message(SEND_ERROR "Invalid Qt version specified.") +endif() +find_package(Qt5Widgets REQUIRED) + +if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) + add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) +endif() + +configure_file(jsonIn/StyleC.json jsonFiles/StyleC.json) +configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json) +configure_file(jsonIn/StyleC.json jsonFiles/StyleC_Custom.json) +configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD_Custom.json) + +# Enable automoc +set(CMAKE_AUTOMOC TRUE) + +include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles") +link_libraries(Qt5::Widgets) + +add_library(PlugA STATIC StyleA.cpp) +add_library(PlugB STATIC StyleB.cpp) +add_library(PlugC STATIC StyleC.cpp) +add_library(PlugD STATIC StyleD.cpp) +add_library(PlugE STATIC StyleE.cpp) diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleA.cpp new file mode 100644 index 0000000..b5e8753 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleA.cpp @@ -0,0 +1,6 @@ +#include "StyleA.hpp" + +QStyle* StyleA::create(const QString& key) +{ + return 0; +} diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp new file mode 100644 index 0000000..1b6154d --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp @@ -0,0 +1,17 @@ +#ifndef STYLEA_HPP +#define STYLEA_HPP + +#include "StyleCommon.hpp" +#include <QStylePlugin> + +class StyleA : public QStylePlugin +{ + Q_OBJECT + // Json file in local directory + Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json") + A_CUSTOM_MACRO(SomeArg, "StyleA_Custom.json", AnotherArg) +public: + QStyle* create(const QString& key); +}; + +#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.json b/Tests/QtAutogenRerun/mocPlugin/StyleA.json new file mode 100644 index 0000000..cc33953 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleA.json @@ -0,0 +1 @@ +{ "Keys": [ "Rocket", "Starbuster" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json b/Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json new file mode 100644 index 0000000..cc33953 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json @@ -0,0 +1 @@ +{ "Keys": [ "Rocket", "Starbuster" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleB.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleB.cpp new file mode 100644 index 0000000..17d4400 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleB.cpp @@ -0,0 +1,6 @@ +#include "StyleB.hpp" + +QStyle* StyleB::create(const QString& key) +{ + return 0; +} diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp new file mode 100644 index 0000000..163c9b2 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp @@ -0,0 +1,17 @@ +#ifndef STYLEB_HPP +#define STYLEB_HPP + +#include "StyleCommon.hpp" +#include <QStylePlugin> + +class StyleB : public QStylePlugin +{ + Q_OBJECT + // Json file in local subdirectory + Q_PLUGIN_METADATA(IID "org.styles.B" FILE "jsonIn/StyleB.json") + A_CUSTOM_MACRO(SomeArg, "jsonIn/StyleB_Custom.json", AnotherArg) +public: + QStyle* create(const QString& key); +}; + +#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleC.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleC.cpp new file mode 100644 index 0000000..37e7564 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleC.cpp @@ -0,0 +1,6 @@ +#include "StyleC.hpp" + +QStyle* StyleC::create(const QString& key) +{ + return 0; +} diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp new file mode 100644 index 0000000..52a887a --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp @@ -0,0 +1,17 @@ +#ifndef STYLEC_HPP +#define STYLEC_HPP + +#include "StyleCommon.hpp" +#include <QStylePlugin> + +class StyleC : public QStylePlugin +{ + Q_OBJECT + // Json file in global root directory + Q_PLUGIN_METADATA(IID "org.styles.C" FILE "StyleC.json") + A_CUSTOM_MACRO(SomeArg, "StyleC_Custom.json", AnotherArg) +public: + QStyle* create(const QString& key); +}; + +#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp new file mode 100644 index 0000000..f1a7ec6 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp @@ -0,0 +1,7 @@ +#ifndef STYLECOMMON_HPP +#define STYLECOMMON_HPP + +// Empty test macro definition +#define A_CUSTOM_MACRO(name, jsonFile, pluginRegistrations) + +#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleD.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleD.cpp new file mode 100644 index 0000000..7e4b121 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleD.cpp @@ -0,0 +1,6 @@ +#include "StyleD.hpp" + +QStyle* StyleD::create(const QString& key) +{ + return 0; +} diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp new file mode 100644 index 0000000..df8a439 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp @@ -0,0 +1,17 @@ +#ifndef STYLED_HPP +#define STYLED_HPP + +#include "StyleCommon.hpp" +#include <QStylePlugin> + +class StyleD : public QStylePlugin +{ + Q_OBJECT + // Json file in global sub director + Q_PLUGIN_METADATA(IID "org.styles.D" FILE "sub/StyleD.json") + A_CUSTOM_MACRO(SomeArg, "sub/StyleD_Custom.json", AnotherArg) +public: + QStyle* create(const QString& key); +}; + +#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp new file mode 100644 index 0000000..8fc9a7f --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp @@ -0,0 +1,6 @@ +#include "StyleE.hpp" + +QStyle* StyleE::create(const QString& key) +{ + return 0; +} diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp new file mode 100644 index 0000000..e7915a8 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp @@ -0,0 +1,17 @@ +#ifndef STYLEE_HPP +#define STYLEE_HPP + +#include "StyleCommon.hpp" +#include <QStylePlugin> + +class StyleE : public QStylePlugin +{ + Q_OBJECT + // No Json file + Q_PLUGIN_METADATA(IID "org.styles.E") + A_CUSTOM_MACRO(SomeArg, InvalidFileArg, AnotherArg) +public: + QStyle* create(const QString& key); +}; + +#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json new file mode 100644 index 0000000..129cac4 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json @@ -0,0 +1 @@ +{ "Keys": [ "Rocket", "StarbusterB" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json new file mode 100644 index 0000000..129cac4 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json @@ -0,0 +1 @@ +{ "Keys": [ "Rocket", "StarbusterB" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json new file mode 100644 index 0000000..119aaa4 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json @@ -0,0 +1 @@ +{ "Keys": [ "Boat", "Ship" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json new file mode 100644 index 0000000..732c547 --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json @@ -0,0 +1 @@ +{ "Keys": [ "Bike", "Car" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/main.cpp b/Tests/QtAutogenRerun/mocPlugin/main.cpp new file mode 100644 index 0000000..3ba2ddc --- /dev/null +++ b/Tests/QtAutogenRerun/mocPlugin/main.cpp @@ -0,0 +1,6 @@ +#include "StyleA.hpp" + +int main(int argv, char** args) +{ + return 0; +} |