summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-02-22 20:08:36 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-02-22 20:15:03 (GMT)
commit94e3f82cf114d12b190d1999a72838018eb171c9 (patch)
tree2bb559338400ac951533ff3c872e99931e73982e
parent70ebf35cdaaf391138df7564a07cd205de4af971 (diff)
downloadCMake-94e3f82cf114d12b190d1999a72838018eb171c9.zip
CMake-94e3f82cf114d12b190d1999a72838018eb171c9.tar.gz
CMake-94e3f82cf114d12b190d1999a72838018eb171c9.tar.bz2
Autogen: Add AUTOMOC_DEPEND_FILTERS test
-rw-r--r--Tests/QtAutogen/CMakeLists.txt22
-rw-r--r--Tests/QtAutogen/mocPlugin/CMakeLists.txt11
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA.hpp2
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA_Custom.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleB.hpp2
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleC.hpp2
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleCommon.hpp7
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleD.hpp2
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleE.hpp2
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json1
10 files changed, 46 insertions, 6 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 260331b..257c187 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -247,10 +247,7 @@ if (NOT QT_TEST_VERSION STREQUAL 4)
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/StyleC.json")
execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/sub/StyleD.json")
-
- execute_process(COMMAND "${CMAKE_COMMAND}" --build .
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin"
- )
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPluginBinDir}")
file(TIMESTAMP "${style_a_file}" style_a_after "${timeformat}")
file(TIMESTAMP "${style_b_file}" style_b_after "${timeformat}")
@@ -269,6 +266,23 @@ if (NOT QT_TEST_VERSION STREQUAL 4)
if (NOT style_d_after GREATER style_d_before)
message(SEND_ERROR "file (${style_d_file}) should have changed!")
endif()
+
+ # Test custom macro
+ file(TIMESTAMP "${style_c_file}" style_c_before "${timeformat}")
+ file(TIMESTAMP "${style_d_file}" style_d_before "${timeformat}")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/StyleC_Custom.json")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/sub/StyleD_Custom.json")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPluginBinDir}")
+ file(TIMESTAMP "${style_c_file}" style_c_after "${timeformat}")
+ file(TIMESTAMP "${style_d_file}" style_d_after "${timeformat}")
+ if (NOT style_c_after GREATER style_c_before)
+ message(SEND_ERROR "file (${style_c_file}) should have changed!")
+ endif()
+ if (NOT style_d_after GREATER style_d_before)
+ message(SEND_ERROR "file (${style_d_file}) should have changed!")
+ endif()
+
endif()
# -- Test
diff --git a/Tests/QtAutogen/mocPlugin/CMakeLists.txt b/Tests/QtAutogen/mocPlugin/CMakeLists.txt
index eed7d39..b72b05d 100644
--- a/Tests/QtAutogen/mocPlugin/CMakeLists.txt
+++ b/Tests/QtAutogen/mocPlugin/CMakeLists.txt
@@ -1,5 +1,10 @@
cmake_minimum_required(VERSION 3.8)
+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()
@@ -9,8 +14,10 @@ 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 @ONLY)
-configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json @ONLY)
+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)
diff --git a/Tests/QtAutogen/mocPlugin/StyleA.hpp b/Tests/QtAutogen/mocPlugin/StyleA.hpp
index b105b02..1b6154d 100644
--- a/Tests/QtAutogen/mocPlugin/StyleA.hpp
+++ b/Tests/QtAutogen/mocPlugin/StyleA.hpp
@@ -1,6 +1,7 @@
#ifndef STYLEA_HPP
#define STYLEA_HPP
+#include "StyleCommon.hpp"
#include <QStylePlugin>
class StyleA : public QStylePlugin
@@ -8,6 +9,7 @@ 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);
};
diff --git a/Tests/QtAutogen/mocPlugin/StyleA_Custom.json b/Tests/QtAutogen/mocPlugin/StyleA_Custom.json
new file mode 100644
index 0000000..cc33953
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleA_Custom.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "Starbuster" ] }
diff --git a/Tests/QtAutogen/mocPlugin/StyleB.hpp b/Tests/QtAutogen/mocPlugin/StyleB.hpp
index ba89127..163c9b2 100644
--- a/Tests/QtAutogen/mocPlugin/StyleB.hpp
+++ b/Tests/QtAutogen/mocPlugin/StyleB.hpp
@@ -1,6 +1,7 @@
#ifndef STYLEB_HPP
#define STYLEB_HPP
+#include "StyleCommon.hpp"
#include <QStylePlugin>
class StyleB : public QStylePlugin
@@ -8,6 +9,7 @@ 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);
};
diff --git a/Tests/QtAutogen/mocPlugin/StyleC.hpp b/Tests/QtAutogen/mocPlugin/StyleC.hpp
index 9f71d75..52a887a 100644
--- a/Tests/QtAutogen/mocPlugin/StyleC.hpp
+++ b/Tests/QtAutogen/mocPlugin/StyleC.hpp
@@ -1,6 +1,7 @@
#ifndef STYLEC_HPP
#define STYLEC_HPP
+#include "StyleCommon.hpp"
#include <QStylePlugin>
class StyleC : public QStylePlugin
@@ -8,6 +9,7 @@ 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);
};
diff --git a/Tests/QtAutogen/mocPlugin/StyleCommon.hpp b/Tests/QtAutogen/mocPlugin/StyleCommon.hpp
new file mode 100644
index 0000000..f1a7ec6
--- /dev/null
+++ b/Tests/QtAutogen/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/QtAutogen/mocPlugin/StyleD.hpp b/Tests/QtAutogen/mocPlugin/StyleD.hpp
index e58444d..df8a439 100644
--- a/Tests/QtAutogen/mocPlugin/StyleD.hpp
+++ b/Tests/QtAutogen/mocPlugin/StyleD.hpp
@@ -1,6 +1,7 @@
#ifndef STYLED_HPP
#define STYLED_HPP
+#include "StyleCommon.hpp"
#include <QStylePlugin>
class StyleD : public QStylePlugin
@@ -8,6 +9,7 @@ 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);
};
diff --git a/Tests/QtAutogen/mocPlugin/StyleE.hpp b/Tests/QtAutogen/mocPlugin/StyleE.hpp
index 80e0b79..e7915a8 100644
--- a/Tests/QtAutogen/mocPlugin/StyleE.hpp
+++ b/Tests/QtAutogen/mocPlugin/StyleE.hpp
@@ -1,6 +1,7 @@
#ifndef STYLEE_HPP
#define STYLEE_HPP
+#include "StyleCommon.hpp"
#include <QStylePlugin>
class StyleE : public QStylePlugin
@@ -8,6 +9,7 @@ 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);
};
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json
new file mode 100644
index 0000000..129cac4
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "StarbusterB" ] }