From 7971202b3c58f78008f5b651c048910fcc49c49f Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 19:27:10 +0100 Subject: Autogen: Tests: Separate MocDepends test --- Tests/QtAutogen/CMakeLists.txt | 4 - Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/MocDepends/CMakeLists.txt | 139 +++++++++++++++++++++ Tests/QtAutogen/MocDepends/object_invalid.hpp.in | 1 + Tests/QtAutogen/MocDepends/object_valid.hpp.in | 14 +++ Tests/QtAutogen/MocDepends/simpleLib.cpp.in | 9 ++ Tests/QtAutogen/MocDepends/simpleLib.hpp.in | 14 +++ Tests/QtAutogen/MocDepends/testATDFile.cpp | 9 ++ Tests/QtAutogen/MocDepends/testATDTarget.cpp | 9 ++ Tests/QtAutogen/MocDepends/testGenFile.cpp | 8 ++ Tests/QtAutogen/MocDepends/testGenLib.cpp | 12 ++ Tests/QtAutogen/MocDepends/testGenLib.hpp | 16 +++ Tests/QtAutogen/MocDepends/testGenTarget.cpp | 9 ++ Tests/QtAutogen/mocDepends/CMakeLists.txt | 151 ----------------------- Tests/QtAutogen/mocDepends/object_invalid.hpp.in | 1 - Tests/QtAutogen/mocDepends/object_valid.hpp.in | 14 --- Tests/QtAutogen/mocDepends/simpleLib.cpp.in | 9 -- Tests/QtAutogen/mocDepends/simpleLib.hpp.in | 14 --- Tests/QtAutogen/mocDepends/testATDFile.cpp | 9 -- Tests/QtAutogen/mocDepends/testATDTarget.cpp | 9 -- Tests/QtAutogen/mocDepends/testGenFile.cpp | 8 -- Tests/QtAutogen/mocDepends/testGenLib.cpp | 12 -- Tests/QtAutogen/mocDepends/testGenLib.hpp | 16 --- Tests/QtAutogen/mocDepends/testGenTarget.cpp | 9 -- 24 files changed, 241 insertions(+), 256 deletions(-) create mode 100644 Tests/QtAutogen/MocDepends/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocDepends/object_invalid.hpp.in create mode 100644 Tests/QtAutogen/MocDepends/object_valid.hpp.in create mode 100644 Tests/QtAutogen/MocDepends/simpleLib.cpp.in create mode 100644 Tests/QtAutogen/MocDepends/simpleLib.hpp.in create mode 100644 Tests/QtAutogen/MocDepends/testATDFile.cpp create mode 100644 Tests/QtAutogen/MocDepends/testATDTarget.cpp create mode 100644 Tests/QtAutogen/MocDepends/testGenFile.cpp create mode 100644 Tests/QtAutogen/MocDepends/testGenLib.cpp create mode 100644 Tests/QtAutogen/MocDepends/testGenLib.hpp create mode 100644 Tests/QtAutogen/MocDepends/testGenTarget.cpp delete mode 100644 Tests/QtAutogen/mocDepends/CMakeLists.txt delete mode 100644 Tests/QtAutogen/mocDepends/object_invalid.hpp.in delete mode 100644 Tests/QtAutogen/mocDepends/object_valid.hpp.in delete mode 100644 Tests/QtAutogen/mocDepends/simpleLib.cpp.in delete mode 100644 Tests/QtAutogen/mocDepends/simpleLib.hpp.in delete mode 100644 Tests/QtAutogen/mocDepends/testATDFile.cpp delete mode 100644 Tests/QtAutogen/mocDepends/testATDTarget.cpp delete mode 100644 Tests/QtAutogen/mocDepends/testGenFile.cpp delete mode 100644 Tests/QtAutogen/mocDepends/testGenLib.cpp delete mode 100644 Tests/QtAutogen/mocDepends/testGenLib.hpp delete mode 100644 Tests/QtAutogen/mocDepends/testGenTarget.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 6b54b1a..43fc851 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,10 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Tests AUTOMOC with generated sources -add_subdirectory(mocDepends) - -# -- Test # Tests various include moc patterns if(ALLOW_WRAP_CPP) add_subdirectory(mocIncludeStrict) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 6a92873..3cd93ab 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -15,3 +15,4 @@ ADD_AUTOGEN_TEST(RccSkipSource) if(NOT QT_TEST_VERSION STREQUAL 4) ADD_AUTOGEN_TEST(MocMacroName mocMacroName) endif() +ADD_AUTOGEN_TEST(MocDepends) diff --git a/Tests/QtAutogen/MocDepends/CMakeLists.txt b/Tests/QtAutogen/MocDepends/CMakeLists.txt new file mode 100644 index 0000000..6ea72be --- /dev/null +++ b/Tests/QtAutogen/MocDepends/CMakeLists.txt @@ -0,0 +1,139 @@ +cmake_minimum_required(VERSION 3.10) +project(MocDepends) +include("../AutogenTest.cmake") + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) + +# -- Test dependency on header generated by a custom command +# +# The ORIGIN_autogen target must depend on the same *GENERATED* source files as +# the ORIGIN target. This is a requirement to ensure that all files for the +# ORIGIN target are generated before the ORIGIN_autogen target is built. +# +# This tests the dependency of the mocDepGenFile_autogen target of +# mocDepGenFile to the source file GenFile.hpp, which is *GENERATED* +# by a custom command. +# If mocDepGenFile_autogen gets built *before* or in *parallel* to the +# custom command, the build will fail. That's because GenFile.hpp, +# which is required by mocDepGenFile_autogen, is only valid after the +# custom command has been completed. +# +# The sleep seconds artificially increase the build time of the custom command +# to simulate a slow file generation process that takes longer to run than +# the build of the mocDepGenFile_autogen target. +add_custom_command( + OUTPUT ${CBD}/GenFile.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenFile.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenFile.hpp) + +add_executable(mocDepGenFile testGenFile.cpp ${CBD}/GenFile.hpp) +target_link_libraries(mocDepGenFile ${QT_QTCORE_TARGET}) +set_target_properties(mocDepGenFile PROPERTIES AUTOMOC TRUE) + + +# -- Test dependency on header generating custom target +# +# The ORIGIN_autogen target must depend on the same user defined targets +# as the ORIGIN target. This is a requirement to ensure that all files for the +# ORIGIN target are generated before the ORIGIN_autogen target is built. +# +# This tests the dependency of the mocDepTarget_autogen target of +# mocDepTarget to the utility target mocDepTargetUtil. +# If mocDepTarget_autogen gets built *before* or in *parallel* to +# mocDepTargetUtil, the build will fail. That's +# because GenTarget.hpp, which is required by mocDepTarget_autogen, +# is only valid after the mocDepTargetUtil build has been completed. +# +# The sleep seconds artificially increase the build time of mocDepTargetUtil +# to simulate a slow utility target build that takes longer to run than +# the build of the mocDepTarget_autogen target. +add_custom_target(mocDepTargetUtil + BYPRODUCTS ${CBD}/GenTarget.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenTarget.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenTarget.hpp) + +add_executable(mocDepTarget testGenTarget.cpp) +target_link_libraries(mocDepTarget ${QT_QTCORE_TARGET}) +set_target_properties(mocDepTarget PROPERTIES AUTOMOC TRUE) +add_dependencies(mocDepTarget mocDepTargetUtil) + + +# -- Test 3: Depend on generated linked library +# The ORIGIN_autogen target must depend on the same linked libraries +# as the ORIGIN target. This is a requirement to ensure that all files for the +# ORIGIN target are generated before the ORIGIN_autogen target is built. +# +# This tests the dependency of the mocDepGenLib_autogen target of mocDepGenLib +# to the user generated library SimpleLib, which mocDepGenLib links to. +# If mocDepGenLib_autogen gets built *before* or in *parallel* to SimpleLib, +# the build will fail. That's because simpleLib.hpp, which is required by +# mocDepGenLib_autogen, is only valid after the SimpleLib build has been +# completed. +# +# The sleep seconds artificially increase the build time of SimpleLib +# to simulate a slow utility library build that takes longer to run than +# the build of the mocDepGenLib_autogen target. +add_custom_command( + OUTPUT ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/simpleLib.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.hpp.in ${CBD}/simpleLib.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.cpp.in ${CBD}/simpleLib.cpp) +add_library(SimpleLib STATIC ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp) +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/MocDepends/object_invalid.hpp.in b/Tests/QtAutogen/MocDepends/object_invalid.hpp.in new file mode 100644 index 0000000..854d9a1 --- /dev/null +++ b/Tests/QtAutogen/MocDepends/object_invalid.hpp.in @@ -0,0 +1 @@ +#ifndef diff --git a/Tests/QtAutogen/MocDepends/object_valid.hpp.in b/Tests/QtAutogen/MocDepends/object_valid.hpp.in new file mode 100644 index 0000000..f364f7c --- /dev/null +++ b/Tests/QtAutogen/MocDepends/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/MocDepends/simpleLib.cpp.in b/Tests/QtAutogen/MocDepends/simpleLib.cpp.in new file mode 100644 index 0000000..fa33bd3 --- /dev/null +++ b/Tests/QtAutogen/MocDepends/simpleLib.cpp.in @@ -0,0 +1,9 @@ +#include "simpleLib.hpp" + +SimpleLib::SimpleLib() +{ +} + +SimpleLib::~SimpleLib() +{ +} diff --git a/Tests/QtAutogen/MocDepends/simpleLib.hpp.in b/Tests/QtAutogen/MocDepends/simpleLib.hpp.in new file mode 100644 index 0000000..b65b0cb --- /dev/null +++ b/Tests/QtAutogen/MocDepends/simpleLib.hpp.in @@ -0,0 +1,14 @@ +#ifndef SIMPLE_LIB_H +#define SIMPLE_LIB_H + +#include + +class SimpleLib : public QObject +{ + Q_OBJECT +public: + SimpleLib(); + ~SimpleLib(); +}; + +#endif diff --git a/Tests/QtAutogen/MocDepends/testATDFile.cpp b/Tests/QtAutogen/MocDepends/testATDFile.cpp new file mode 100644 index 0000000..6bddfcd --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testATDFile.cpp @@ -0,0 +1,9 @@ + +#include "ATDFile.hpp" +#include "moc_ATDFile.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/MocDepends/testATDTarget.cpp b/Tests/QtAutogen/MocDepends/testATDTarget.cpp new file mode 100644 index 0000000..831fc26 --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testATDTarget.cpp @@ -0,0 +1,9 @@ + +#include "ATDTarget.hpp" +#include "moc_ATDTarget.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/MocDepends/testGenFile.cpp b/Tests/QtAutogen/MocDepends/testGenFile.cpp new file mode 100644 index 0000000..7df6e13 --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testGenFile.cpp @@ -0,0 +1,8 @@ + +#include "GenFile.hpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/MocDepends/testGenLib.cpp b/Tests/QtAutogen/MocDepends/testGenLib.cpp new file mode 100644 index 0000000..c14e159 --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testGenLib.cpp @@ -0,0 +1,12 @@ + +#include "testGenLib.hpp" + +int main() +{ + SimpleLib libObject; + LObject lobject; + return 0; +} + +// Depend on and AUTOMOC the SimpleLib header simpleLib.hpp +#include "moc_simpleLib.cpp" diff --git a/Tests/QtAutogen/MocDepends/testGenLib.hpp b/Tests/QtAutogen/MocDepends/testGenLib.hpp new file mode 100644 index 0000000..408335b --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testGenLib.hpp @@ -0,0 +1,16 @@ +#ifndef TEST3_HPP +#define TEST3_HPP + +#include "simpleLib.hpp" +#include + +// This object triggers the AUTOMOC on this file +class LObject : public QObject +{ + Q_OBJECT +public: + Q_SLOT + void aSlot(){}; +}; + +#endif diff --git a/Tests/QtAutogen/MocDepends/testGenTarget.cpp b/Tests/QtAutogen/MocDepends/testGenTarget.cpp new file mode 100644 index 0000000..911076e --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testGenTarget.cpp @@ -0,0 +1,9 @@ + +#include "GenTarget.hpp" +#include "moc_GenTarget.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/mocDepends/CMakeLists.txt b/Tests/QtAutogen/mocDepends/CMakeLists.txt deleted file mode 100644 index 8217b8d..0000000 --- a/Tests/QtAutogen/mocDepends/CMakeLists.txt +++ /dev/null @@ -1,151 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -cmake_policy(SET CMP0071 NEW) -project(mocDepends CXX) - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - set(QT_CORE_TARGET Qt4::QtCore) -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - - find_package(Qt5Core REQUIRED) - set(QT_CORE_TARGET Qt5::Core) -endif() - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) -set(CBD ${CMAKE_CURRENT_BINARY_DIR}) - -# -- Test dependency on header generated by a custom command -# -# The ORIGIN_autogen target must depend on the same *GENERATED* source files as -# the ORIGIN target. This is a requirement to ensure that all files for the -# ORIGIN target are generated before the ORIGIN_autogen target is built. -# -# This tests the dependency of the mocDepGenFile_autogen target of -# mocDepGenFile to the source file GenFile.hpp, which is *GENERATED* -# by a custom command. -# If mocDepGenFile_autogen gets built *before* or in *parallel* to the -# custom command, the build will fail. That's because GenFile.hpp, -# which is required by mocDepGenFile_autogen, is only valid after the -# custom command has been completed. -# -# The sleep seconds artificially increase the build time of the custom command -# to simulate a slow file generation process that takes longer to run than -# the build of the mocDepGenFile_autogen target. -add_custom_command( - OUTPUT ${CBD}/GenFile.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenFile.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenFile.hpp) - -add_executable(mocDepGenFile testGenFile.cpp ${CBD}/GenFile.hpp) -target_link_libraries(mocDepGenFile ${QT_CORE_TARGET}) -set_target_properties(mocDepGenFile PROPERTIES AUTOMOC TRUE) - - -# -- Test dependency on header generating custom target -# -# The ORIGIN_autogen target must depend on the same user defined targets -# as the ORIGIN target. This is a requirement to ensure that all files for the -# ORIGIN target are generated before the ORIGIN_autogen target is built. -# -# This tests the dependency of the mocDepTarget_autogen target of -# mocDepTarget to the utility target mocDepTargetUtil. -# If mocDepTarget_autogen gets built *before* or in *parallel* to -# mocDepTargetUtil, the build will fail. That's -# because GenTarget.hpp, which is required by mocDepTarget_autogen, -# is only valid after the mocDepTargetUtil build has been completed. -# -# The sleep seconds artificially increase the build time of mocDepTargetUtil -# to simulate a slow utility target build that takes longer to run than -# the build of the mocDepTarget_autogen target. -add_custom_target(mocDepTargetUtil - BYPRODUCTS ${CBD}/GenTarget.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenTarget.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenTarget.hpp) - -add_executable(mocDepTarget testGenTarget.cpp) -target_link_libraries(mocDepTarget ${QT_CORE_TARGET}) -set_target_properties(mocDepTarget PROPERTIES AUTOMOC TRUE) -add_dependencies(mocDepTarget mocDepTargetUtil) - - -# -- Test 3: Depend on generated linked library -# The ORIGIN_autogen target must depend on the same linked libraries -# as the ORIGIN target. This is a requirement to ensure that all files for the -# ORIGIN target are generated before the ORIGIN_autogen target is built. -# -# This tests the dependency of the mocDepGenLib_autogen target of mocDepGenLib -# to the user generated library SimpleLib, which mocDepGenLib links to. -# If mocDepGenLib_autogen gets built *before* or in *parallel* to SimpleLib, -# the build will fail. That's because simpleLib.hpp, which is required by -# mocDepGenLib_autogen, is only valid after the SimpleLib build has been -# completed. -# -# The sleep seconds artificially increase the build time of SimpleLib -# to simulate a slow utility library build that takes longer to run than -# the build of the mocDepGenLib_autogen target. -add_custom_command( - OUTPUT ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/simpleLib.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.hpp.in ${CBD}/simpleLib.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.cpp.in ${CBD}/simpleLib.cpp) -add_library(SimpleLib STATIC ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp) -target_link_libraries(SimpleLib ${QT_CORE_TARGET}) - -add_executable(mocDepGenLib testGenLib.cpp) -target_link_libraries(mocDepGenLib SimpleLib ${QT_CORE_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_CORE_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_CORE_TARGET}) -set_target_properties(mocDepATDTarget PROPERTIES AUTOMOC TRUE) -set_target_properties(mocDepATDTarget PROPERTIES AUTOGEN_TARGET_DEPENDS mocDepATDTargetUtil) diff --git a/Tests/QtAutogen/mocDepends/object_invalid.hpp.in b/Tests/QtAutogen/mocDepends/object_invalid.hpp.in deleted file mode 100644 index 854d9a1..0000000 --- a/Tests/QtAutogen/mocDepends/object_invalid.hpp.in +++ /dev/null @@ -1 +0,0 @@ -#ifndef diff --git a/Tests/QtAutogen/mocDepends/object_valid.hpp.in b/Tests/QtAutogen/mocDepends/object_valid.hpp.in deleted file mode 100644 index f364f7c..0000000 --- a/Tests/QtAutogen/mocDepends/object_valid.hpp.in +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef OBJECT_HPP -#define OBJECT_HPP - -#include - -class Object : public QObject -{ - Q_OBJECT -public: - Q_SLOT - void aSlot(){}; -}; - -#endif diff --git a/Tests/QtAutogen/mocDepends/simpleLib.cpp.in b/Tests/QtAutogen/mocDepends/simpleLib.cpp.in deleted file mode 100644 index fa33bd3..0000000 --- a/Tests/QtAutogen/mocDepends/simpleLib.cpp.in +++ /dev/null @@ -1,9 +0,0 @@ -#include "simpleLib.hpp" - -SimpleLib::SimpleLib() -{ -} - -SimpleLib::~SimpleLib() -{ -} diff --git a/Tests/QtAutogen/mocDepends/simpleLib.hpp.in b/Tests/QtAutogen/mocDepends/simpleLib.hpp.in deleted file mode 100644 index b65b0cb..0000000 --- a/Tests/QtAutogen/mocDepends/simpleLib.hpp.in +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef SIMPLE_LIB_H -#define SIMPLE_LIB_H - -#include - -class SimpleLib : public QObject -{ - Q_OBJECT -public: - SimpleLib(); - ~SimpleLib(); -}; - -#endif diff --git a/Tests/QtAutogen/mocDepends/testATDFile.cpp b/Tests/QtAutogen/mocDepends/testATDFile.cpp deleted file mode 100644 index 6bddfcd..0000000 --- a/Tests/QtAutogen/mocDepends/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/mocDepends/testATDTarget.cpp b/Tests/QtAutogen/mocDepends/testATDTarget.cpp deleted file mode 100644 index 831fc26..0000000 --- a/Tests/QtAutogen/mocDepends/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/mocDepends/testGenFile.cpp b/Tests/QtAutogen/mocDepends/testGenFile.cpp deleted file mode 100644 index 7df6e13..0000000 --- a/Tests/QtAutogen/mocDepends/testGenFile.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "GenFile.hpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/mocDepends/testGenLib.cpp b/Tests/QtAutogen/mocDepends/testGenLib.cpp deleted file mode 100644 index c14e159..0000000 --- a/Tests/QtAutogen/mocDepends/testGenLib.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -#include "testGenLib.hpp" - -int main() -{ - SimpleLib libObject; - LObject lobject; - return 0; -} - -// Depend on and AUTOMOC the SimpleLib header simpleLib.hpp -#include "moc_simpleLib.cpp" diff --git a/Tests/QtAutogen/mocDepends/testGenLib.hpp b/Tests/QtAutogen/mocDepends/testGenLib.hpp deleted file mode 100644 index 408335b..0000000 --- a/Tests/QtAutogen/mocDepends/testGenLib.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef TEST3_HPP -#define TEST3_HPP - -#include "simpleLib.hpp" -#include - -// This object triggers the AUTOMOC on this file -class LObject : public QObject -{ - Q_OBJECT -public: - Q_SLOT - void aSlot(){}; -}; - -#endif diff --git a/Tests/QtAutogen/mocDepends/testGenTarget.cpp b/Tests/QtAutogen/mocDepends/testGenTarget.cpp deleted file mode 100644 index 911076e..0000000 --- a/Tests/QtAutogen/mocDepends/testGenTarget.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "GenTarget.hpp" -#include "moc_GenTarget.cpp" - -int main() -{ - Object obj; - return 0; -} -- cgit v0.12