From 336893d9eb0ee732683b18e2e9e8a17e86e09d99 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Tue, 30 Oct 2018 11:41:37 +0100 Subject: Autogen: Separate AUTOGEN_TARGET_DEPENDS tests into own tests suite The tests for AUTOGEN_TARGET_DEPENDS were part of the AutogenOriginDependsOn tests suite. This separates them into an own AutogenTargetDepends tests suite. --- .../AutogenOriginDependsOn/CMakeLists.txt | 48 ------------------- .../AutogenOriginDependsOn/testATDFile.cpp | 9 ---- .../AutogenOriginDependsOn/testATDTarget.cpp | 9 ---- .../QtAutogen/AutogenTargetDepends/CMakeLists.txt | 54 ++++++++++++++++++++++ .../AutogenTargetDepends/object_invalid.hpp.in | 1 + .../AutogenTargetDepends/object_valid.hpp.in | 14 ++++++ .../QtAutogen/AutogenTargetDepends/testATDFile.cpp | 9 ++++ .../AutogenTargetDepends/testATDTarget.cpp | 9 ++++ Tests/QtAutogen/CommonTests.cmake | 1 + 9 files changed, 88 insertions(+), 66 deletions(-) delete mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp delete mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp create mode 100644 Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt create mode 100644 Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in create mode 100644 Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in create mode 100644 Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp create mode 100644 Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt b/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt index f70d9ce..60869eb 100644 --- a/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt +++ b/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt @@ -89,51 +89,3 @@ target_link_libraries(SimpleLib ${QT_QTCORE_TARGET}) add_executable(mocDepGenLib testGenLib.cpp) target_link_libraries(mocDepGenLib SimpleLib ${QT_QTCORE_TARGET}) set_target_properties(mocDepGenLib PROPERTIES AUTOMOC TRUE) - - -# -- Test AUTOGEN_TARGET_DEPENDS with GENERATED file dependency -# -# This tests the dependency of the mocDepATDFile_autogen target of -# mocDepATDTarget to the utility target mocDepATDFileUtil. -# If mocDepATDFile_autogen gets built *before* or in *parallel* to -# mocDepATDFileUtil, the build will fail. That's -# because ATDFile.hpp, which is required by mocDepATDFile_autogen, -# is only valid after the mocDepATDFileUtil build has been completed. -# -# The sleep seconds artificially increase the build time of -# mocDepATDFileUtil to simulate a slow utility target build that takes -# longer to run than the build of the mocDepATDFile_autogen target. -add_custom_command( - OUTPUT ${CBD}/ATDFile.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDFile.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDFile.hpp) - -add_executable(mocDepATDFile testATDFile.cpp) -target_link_libraries(mocDepATDFile ${QT_QTCORE_TARGET}) -set_target_properties(mocDepATDFile PROPERTIES AUTOMOC TRUE) -set_target_properties(mocDepATDFile PROPERTIES AUTOGEN_TARGET_DEPENDS ${CBD}/ATDFile.hpp) - - -# -- Test AUTOGEN_TARGET_DEPENDS with target dependency -# -# This tests the dependency of the mocDepATDTarget_autogen target of -# mocDepATDTarget to the utility target mocDepATDTargetUtil. -# If mocDepATDTarget_autogen gets built *before* or in *parallel* to -# mocDepATDTargetUtil, the build will fail. That's -# because ATDTarget.hpp, which is required by mocDepATDTarget_autogen, -# is only valid after the mocDepATDTargetUtil build has been completed. -# -# The sleep seconds artificially increase the build time of -# mocDepATDTargetUtil to simulate a slow utility target build that takes -# longer to run than the build of the mocDepATDTarget_autogen target. -add_custom_target(mocDepATDTargetUtil - BYPRODUCTS ${CBD}/ATDTarget.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDTarget.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDTarget.hpp) - -add_executable(mocDepATDTarget testATDTarget.cpp) -target_link_libraries(mocDepATDTarget ${QT_QTCORE_TARGET}) -set_target_properties(mocDepATDTarget PROPERTIES AUTOMOC TRUE) -set_target_properties(mocDepATDTarget PROPERTIES AUTOGEN_TARGET_DEPENDS mocDepATDTargetUtil) diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp deleted file mode 100644 index 6bddfcd..0000000 --- a/Tests/QtAutogen/AutogenOriginDependsOn/testATDFile.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "ATDFile.hpp" -#include "moc_ATDFile.cpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp deleted file mode 100644 index 831fc26..0000000 --- a/Tests/QtAutogen/AutogenOriginDependsOn/testATDTarget.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "ATDTarget.hpp" -#include "moc_ATDTarget.cpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt b/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt new file mode 100644 index 0000000..63b7c98 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt @@ -0,0 +1,54 @@ +cmake_minimum_required(VERSION 3.10) +project(AutogenTargetDepends) +include("../AutogenTest.cmake") + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) + +# -- Test AUTOGEN_TARGET_DEPENDS with GENERATED file dependency +# +# This tests the dependency of the mocDepATDFile_autogen target of +# mocDepATDTarget to the utility target mocDepATDFileUtil. +# If mocDepATDFile_autogen gets built *before* or in *parallel* to +# mocDepATDFileUtil, the build will fail. That's +# because ATDFile.hpp, which is required by mocDepATDFile_autogen, +# is only valid after the mocDepATDFileUtil build has been completed. +# +# The sleep seconds artificially increase the build time of +# mocDepATDFileUtil to simulate a slow utility target build that takes +# longer to run than the build of the mocDepATDFile_autogen target. +add_custom_command( + OUTPUT ${CBD}/ATDFile.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDFile.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDFile.hpp) + +add_executable(mocDepATDFile testATDFile.cpp) +target_link_libraries(mocDepATDFile ${QT_QTCORE_TARGET}) +set_target_properties(mocDepATDFile PROPERTIES AUTOMOC TRUE) +set_target_properties(mocDepATDFile PROPERTIES AUTOGEN_TARGET_DEPENDS ${CBD}/ATDFile.hpp) + + +# -- Test AUTOGEN_TARGET_DEPENDS with target dependency +# +# This tests the dependency of the mocDepATDTarget_autogen target of +# mocDepATDTarget to the utility target mocDepATDTargetUtil. +# If mocDepATDTarget_autogen gets built *before* or in *parallel* to +# mocDepATDTargetUtil, the build will fail. That's +# because ATDTarget.hpp, which is required by mocDepATDTarget_autogen, +# is only valid after the mocDepATDTargetUtil build has been completed. +# +# The sleep seconds artificially increase the build time of +# mocDepATDTargetUtil to simulate a slow utility target build that takes +# longer to run than the build of the mocDepATDTarget_autogen target. +add_custom_target(mocDepATDTargetUtil + BYPRODUCTS ${CBD}/ATDTarget.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDTarget.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDTarget.hpp) + +add_executable(mocDepATDTarget testATDTarget.cpp) +target_link_libraries(mocDepATDTarget ${QT_QTCORE_TARGET}) +set_target_properties(mocDepATDTarget PROPERTIES AUTOMOC TRUE) +set_target_properties(mocDepATDTarget PROPERTIES AUTOGEN_TARGET_DEPENDS mocDepATDTargetUtil) diff --git a/Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in b/Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in new file mode 100644 index 0000000..854d9a1 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in @@ -0,0 +1 @@ +#ifndef diff --git a/Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in b/Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in new file mode 100644 index 0000000..f364f7c --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in @@ -0,0 +1,14 @@ +#ifndef OBJECT_HPP +#define OBJECT_HPP + +#include + +class Object : public QObject +{ + Q_OBJECT +public: + Q_SLOT + void aSlot(){}; +}; + +#endif diff --git a/Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp b/Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp new file mode 100644 index 0000000..6bddfcd --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp @@ -0,0 +1,9 @@ + +#include "ATDFile.hpp" +#include "moc_ATDFile.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp b/Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp new file mode 100644 index 0000000..831fc26 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp @@ -0,0 +1,9 @@ + +#include "ATDTarget.hpp" +#include "moc_ATDTarget.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index ccbddbd..58d9f0b 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -17,6 +17,7 @@ if(QT_TEST_VERSION GREATER 4) endif() ADD_AUTOGEN_TEST(AutogenOriginDependsOff autogenOriginDependsOff) ADD_AUTOGEN_TEST(AutogenOriginDependsOn) +ADD_AUTOGEN_TEST(AutogenTargetDepends) if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocIncludeStrict mocIncludeStrict) ADD_AUTOGEN_TEST(MocIncludeRelaxed mocIncludeRelaxed) -- cgit v0.12