From cc66d356510c51b5240239a212a511fb0d23dc9a Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 19:40:17 +0100 Subject: Autogen: Tests: Separate MocInclude test --- Tests/QtAutogen/CMakeLists.txt | 7 --- Tests/QtAutogen/CommonTests.cmake | 4 ++ Tests/QtAutogen/MocInclude/EObjA.cpp | 44 ++++++++++++++ Tests/QtAutogen/MocInclude/EObjA.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/EObjAExtra.cpp | 20 ++++++ Tests/QtAutogen/MocInclude/EObjAExtra.hpp | 18 ++++++ Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp | 12 ++++ Tests/QtAutogen/MocInclude/EObjA_p.hpp | 12 ++++ Tests/QtAutogen/MocInclude/EObjB.cpp | 45 ++++++++++++++ Tests/QtAutogen/MocInclude/EObjB.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/EObjB_p.hpp | 12 ++++ Tests/QtAutogen/MocInclude/LObjA.cpp | 39 ++++++++++++ Tests/QtAutogen/MocInclude/LObjA.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/LObjA_p.h | 12 ++++ Tests/QtAutogen/MocInclude/LObjB.cpp | 40 ++++++++++++ Tests/QtAutogen/MocInclude/LObjB.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/LObjB_p.h | 12 ++++ Tests/QtAutogen/MocInclude/ObjA.cpp | 20 ++++++ Tests/QtAutogen/MocInclude/ObjA.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/ObjA_p.h | 12 ++++ Tests/QtAutogen/MocInclude/ObjB.cpp | 22 +++++++ Tests/QtAutogen/MocInclude/ObjB.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/ObjB_p.h | 12 ++++ Tests/QtAutogen/MocInclude/SObjA.cpp | 11 ++++ Tests/QtAutogen/MocInclude/SObjA.hpp | 15 +++++ Tests/QtAutogen/MocInclude/SObjB.cpp.in | 11 ++++ Tests/QtAutogen/MocInclude/SObjB.hpp.in | 15 +++++ Tests/QtAutogen/MocInclude/SObjC.cpp | 35 +++++++++++ Tests/QtAutogen/MocInclude/SObjC.hpp | 15 +++++ Tests/QtAutogen/MocInclude/SObjCExtra.cpp | 31 ++++++++++ Tests/QtAutogen/MocInclude/SObjCExtra.hpp | 15 +++++ Tests/QtAutogen/MocInclude/SObjCExtra.moc.in | 4 ++ Tests/QtAutogen/MocInclude/shared.cmake | 71 ++++++++++++++++++++++ Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp | 20 ++++++ Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp | 18 ++++++ .../QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp | 12 ++++ Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp | 41 +++++++++++++ Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp | 17 ++++++ Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp | 15 +++++ Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt | 20 ++++++ Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp | 12 ++++ Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp | 12 ++++ Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp | 14 +++++ Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp | 22 +++++++ Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp | 14 +++++ Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp | 14 +++++ Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp | 30 +++++++++ Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp | 14 +++++ Tests/QtAutogen/MocIncludeRelaxed/main.cpp | 26 ++++++++ Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt | 10 +++ Tests/QtAutogen/MocIncludeStrict/main.cpp | 26 ++++++++ Tests/QtAutogen/mocInclude/EObjA.cpp | 43 ------------- Tests/QtAutogen/mocInclude/EObjA.hpp | 19 ------ Tests/QtAutogen/mocInclude/EObjAExtra.cpp | 20 ------ Tests/QtAutogen/mocInclude/EObjAExtra.hpp | 18 ------ Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp | 12 ---- Tests/QtAutogen/mocInclude/EObjA_p.hpp | 12 ---- Tests/QtAutogen/mocInclude/EObjB.cpp | 44 -------------- Tests/QtAutogen/mocInclude/EObjB.hpp | 19 ------ Tests/QtAutogen/mocInclude/EObjB_p.hpp | 12 ---- Tests/QtAutogen/mocInclude/LObjA.cpp | 39 ------------ Tests/QtAutogen/mocInclude/LObjA.hpp | 19 ------ Tests/QtAutogen/mocInclude/LObjA_p.h | 12 ---- Tests/QtAutogen/mocInclude/LObjB.cpp | 40 ------------ Tests/QtAutogen/mocInclude/LObjB.hpp | 19 ------ Tests/QtAutogen/mocInclude/LObjB_p.h | 12 ---- Tests/QtAutogen/mocInclude/ObjA.cpp | 20 ------ Tests/QtAutogen/mocInclude/ObjA.hpp | 19 ------ Tests/QtAutogen/mocInclude/ObjA_p.h | 12 ---- Tests/QtAutogen/mocInclude/ObjB.cpp | 22 ------- Tests/QtAutogen/mocInclude/ObjB.hpp | 19 ------ Tests/QtAutogen/mocInclude/ObjB_p.h | 12 ---- Tests/QtAutogen/mocInclude/SObjA.cpp | 11 ---- Tests/QtAutogen/mocInclude/SObjA.hpp | 15 ----- Tests/QtAutogen/mocInclude/SObjB.cpp.in | 11 ---- Tests/QtAutogen/mocInclude/SObjB.hpp.in | 15 ----- Tests/QtAutogen/mocInclude/SObjC.cpp | 35 ----------- Tests/QtAutogen/mocInclude/SObjC.hpp | 15 ----- Tests/QtAutogen/mocInclude/SObjCExtra.cpp | 31 ---------- Tests/QtAutogen/mocInclude/SObjCExtra.hpp | 15 ----- Tests/QtAutogen/mocInclude/SObjCExtra.moc.in | 4 -- Tests/QtAutogen/mocInclude/shared.cmake | 71 ---------------------- Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp | 20 ------ Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp | 18 ------ .../QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp | 12 ---- Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp | 41 ------------- Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp | 17 ------ Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp | 15 ----- Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt | 17 ------ Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp | 12 ---- Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp | 12 ---- Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp | 14 ----- Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp | 22 ------- Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp | 14 ----- Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp | 14 ----- Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp | 30 --------- Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp | 14 ----- Tests/QtAutogen/mocIncludeRelaxed/main.cpp | 26 -------- Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt | 6 -- Tests/QtAutogen/mocIncludeStrict/main.cpp | 26 -------- 100 files changed, 1010 insertions(+), 1004 deletions(-) create mode 100644 Tests/QtAutogen/MocInclude/EObjA.cpp create mode 100644 Tests/QtAutogen/MocInclude/EObjA.hpp create mode 100644 Tests/QtAutogen/MocInclude/EObjAExtra.cpp create mode 100644 Tests/QtAutogen/MocInclude/EObjAExtra.hpp create mode 100644 Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp create mode 100644 Tests/QtAutogen/MocInclude/EObjA_p.hpp create mode 100644 Tests/QtAutogen/MocInclude/EObjB.cpp create mode 100644 Tests/QtAutogen/MocInclude/EObjB.hpp create mode 100644 Tests/QtAutogen/MocInclude/EObjB_p.hpp create mode 100644 Tests/QtAutogen/MocInclude/LObjA.cpp create mode 100644 Tests/QtAutogen/MocInclude/LObjA.hpp create mode 100644 Tests/QtAutogen/MocInclude/LObjA_p.h create mode 100644 Tests/QtAutogen/MocInclude/LObjB.cpp create mode 100644 Tests/QtAutogen/MocInclude/LObjB.hpp create mode 100644 Tests/QtAutogen/MocInclude/LObjB_p.h create mode 100644 Tests/QtAutogen/MocInclude/ObjA.cpp create mode 100644 Tests/QtAutogen/MocInclude/ObjA.hpp create mode 100644 Tests/QtAutogen/MocInclude/ObjA_p.h create mode 100644 Tests/QtAutogen/MocInclude/ObjB.cpp create mode 100644 Tests/QtAutogen/MocInclude/ObjB.hpp create mode 100644 Tests/QtAutogen/MocInclude/ObjB_p.h create mode 100644 Tests/QtAutogen/MocInclude/SObjA.cpp create mode 100644 Tests/QtAutogen/MocInclude/SObjA.hpp create mode 100644 Tests/QtAutogen/MocInclude/SObjB.cpp.in create mode 100644 Tests/QtAutogen/MocInclude/SObjB.hpp.in create mode 100644 Tests/QtAutogen/MocInclude/SObjC.cpp create mode 100644 Tests/QtAutogen/MocInclude/SObjC.hpp create mode 100644 Tests/QtAutogen/MocInclude/SObjCExtra.cpp create mode 100644 Tests/QtAutogen/MocInclude/SObjCExtra.hpp create mode 100644 Tests/QtAutogen/MocInclude/SObjCExtra.moc.in create mode 100644 Tests/QtAutogen/MocInclude/shared.cmake create mode 100644 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp create mode 100644 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp create mode 100644 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp create mode 100644 Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp create mode 100644 Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp create mode 100644 Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/main.cpp create mode 100644 Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocIncludeStrict/main.cpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjA.cpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjA.hpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjAExtra.cpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjAExtra.hpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjA_p.hpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjB.cpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjB.hpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjB_p.hpp delete mode 100644 Tests/QtAutogen/mocInclude/LObjA.cpp delete mode 100644 Tests/QtAutogen/mocInclude/LObjA.hpp delete mode 100644 Tests/QtAutogen/mocInclude/LObjA_p.h delete mode 100644 Tests/QtAutogen/mocInclude/LObjB.cpp delete mode 100644 Tests/QtAutogen/mocInclude/LObjB.hpp delete mode 100644 Tests/QtAutogen/mocInclude/LObjB_p.h delete mode 100644 Tests/QtAutogen/mocInclude/ObjA.cpp delete mode 100644 Tests/QtAutogen/mocInclude/ObjA.hpp delete mode 100644 Tests/QtAutogen/mocInclude/ObjA_p.h delete mode 100644 Tests/QtAutogen/mocInclude/ObjB.cpp delete mode 100644 Tests/QtAutogen/mocInclude/ObjB.hpp delete mode 100644 Tests/QtAutogen/mocInclude/ObjB_p.h delete mode 100644 Tests/QtAutogen/mocInclude/SObjA.cpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjA.hpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjB.cpp.in delete mode 100644 Tests/QtAutogen/mocInclude/SObjB.hpp.in delete mode 100644 Tests/QtAutogen/mocInclude/SObjC.cpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjC.hpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjCExtra.cpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjCExtra.hpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjCExtra.moc.in delete mode 100644 Tests/QtAutogen/mocInclude/shared.cmake delete mode 100644 Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp delete mode 100644 Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp delete mode 100644 Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp delete mode 100644 Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp delete mode 100644 Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp delete mode 100644 Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/main.cpp delete mode 100644 Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt delete mode 100644 Tests/QtAutogen/mocIncludeStrict/main.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 43fc851..5775117 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,13 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Tests various include moc patterns -if(ALLOW_WRAP_CPP) - add_subdirectory(mocIncludeStrict) - add_subdirectory(mocIncludeRelaxed) -endif() - -# -- Test # Tests policy 0071 if(ALLOW_WRAP_CPP) add_subdirectory(mocCMP0071) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 3cd93ab..4d89eae 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -16,3 +16,7 @@ if(NOT QT_TEST_VERSION STREQUAL 4) ADD_AUTOGEN_TEST(MocMacroName mocMacroName) endif() ADD_AUTOGEN_TEST(MocDepends) +if(QT_TEST_ALLOW_QT_MACROS) + ADD_AUTOGEN_TEST(MocIncludeStrict mocIncludeStrict) + ADD_AUTOGEN_TEST(MocIncludeRelaxed mocIncludeRelaxed) +endif() diff --git a/Tests/QtAutogen/MocInclude/EObjA.cpp b/Tests/QtAutogen/MocInclude/EObjA.cpp new file mode 100644 index 0000000..7681c29 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjA.cpp @@ -0,0 +1,44 @@ +#include "EObjA.hpp" +#include "EObjAExtra.hpp" +#include "EObjA_p.hpp" + +class EObjALocal : public QObject +{ + Q_OBJECT +public: + EObjALocal(); + ~EObjALocal(); +}; + +EObjALocal::EObjALocal() +{ +} + +EObjALocal::~EObjALocal() +{ +} + +EObjAPrivate::EObjAPrivate() +{ + EObjALocal localObj; + EObjAExtra extraObj; +} + +EObjAPrivate::~EObjAPrivate() +{ +} + +EObjA::EObjA() + : d(new EObjAPrivate) +{ +} + +EObjA::~EObjA() +{ + delete d; +} + +// For EObjALocal +#include "EObjA.moc" +// - Not the own header +#include "moc_EObjAExtra.cpp" diff --git a/Tests/QtAutogen/MocInclude/EObjA.hpp b/Tests/QtAutogen/MocInclude/EObjA.hpp new file mode 100644 index 0000000..0939ab6 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjA.hpp @@ -0,0 +1,19 @@ +#ifndef EOBJA_HPP +#define EOBJA_HPP + +#include + +// Sources includes a moc_ includes of an extra object +class EObjAPrivate; +class EObjA : public QObject +{ + Q_OBJECT +public: + EObjA(); + ~EObjA(); + +private: + EObjAPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/EObjAExtra.cpp b/Tests/QtAutogen/MocInclude/EObjAExtra.cpp new file mode 100644 index 0000000..369ca8f --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjAExtra.cpp @@ -0,0 +1,20 @@ +#include "EObjAExtra.hpp" +#include "EObjAExtra_p.hpp" + +EObjAExtraPrivate::EObjAExtraPrivate() +{ +} + +EObjAExtraPrivate::~EObjAExtraPrivate() +{ +} + +EObjAExtra::EObjAExtra() + : d(new EObjAExtraPrivate) +{ +} + +EObjAExtra::~EObjAExtra() +{ + delete d; +} diff --git a/Tests/QtAutogen/MocInclude/EObjAExtra.hpp b/Tests/QtAutogen/MocInclude/EObjAExtra.hpp new file mode 100644 index 0000000..b10681d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjAExtra.hpp @@ -0,0 +1,18 @@ +#ifndef EOBJAEXTRA_HPP +#define EOBJAEXTRA_HPP + +#include + +class EObjAExtraPrivate; +class EObjAExtra : public QObject +{ + Q_OBJECT +public: + EObjAExtra(); + ~EObjAExtra(); + +private: + EObjAExtraPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp b/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp new file mode 100644 index 0000000..dea6cb5 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp @@ -0,0 +1,12 @@ +#ifndef EOBJAEXTRA_P_HPP +#define EOBJAEXTRA_P_HPP + +class EObjAExtraPrivate : public QObject +{ + Q_OBJECT +public: + EObjAExtraPrivate(); + ~EObjAExtraPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/EObjA_p.hpp b/Tests/QtAutogen/MocInclude/EObjA_p.hpp new file mode 100644 index 0000000..1e0d7e1 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjA_p.hpp @@ -0,0 +1,12 @@ +#ifndef EOBJA_P_HPP +#define EOBJA_P_HPP + +class EObjAPrivate : public QObject +{ + Q_OBJECT +public: + EObjAPrivate(); + ~EObjAPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/EObjB.cpp b/Tests/QtAutogen/MocInclude/EObjB.cpp new file mode 100644 index 0000000..3068c68 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjB.cpp @@ -0,0 +1,45 @@ +#include "EObjB.hpp" +#include "EObjB_p.hpp" +#include "subExtra/EObjBExtra.hpp" + +class EObjBLocal : public QObject +{ + Q_OBJECT +public: + EObjBLocal(); + ~EObjBLocal(); +}; + +EObjBLocal::EObjBLocal() +{ +} + +EObjBLocal::~EObjBLocal() +{ +} + +EObjBPrivate::EObjBPrivate() +{ + EObjBLocal localObj; + EObjBExtra extraObj; +} + +EObjBPrivate::~EObjBPrivate() +{ +} + +EObjB::EObjB() + : d(new EObjBPrivate) +{ +} + +EObjB::~EObjB() +{ + delete d; +} + +// For EObjBLocal +#include "EObjB.moc" +// - Not the own header +// - in a subdirectory +#include "subExtra/moc_EObjBExtra.cpp" diff --git a/Tests/QtAutogen/MocInclude/EObjB.hpp b/Tests/QtAutogen/MocInclude/EObjB.hpp new file mode 100644 index 0000000..6632bdb --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjB.hpp @@ -0,0 +1,19 @@ +#ifndef EOBJB_HPP +#define EOBJB_HPP + +#include + +// Sources includes a moc_ includes of an extra object in a subdirectory +class EObjBPrivate; +class EObjB : public QObject +{ + Q_OBJECT +public: + EObjB(); + ~EObjB(); + +private: + EObjBPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/EObjB_p.hpp b/Tests/QtAutogen/MocInclude/EObjB_p.hpp new file mode 100644 index 0000000..2905f28 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjB_p.hpp @@ -0,0 +1,12 @@ +#ifndef EOBJB_P_HPP +#define EOBJB_P_HPP + +class EObjBPrivate : public QObject +{ + Q_OBJECT +public: + EObjBPrivate(); + ~EObjBPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/LObjA.cpp b/Tests/QtAutogen/MocInclude/LObjA.cpp new file mode 100644 index 0000000..9aae991 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjA.cpp @@ -0,0 +1,39 @@ +#include "LObjA.hpp" +#include "LObjA_p.h" + +class LObjALocal : public QObject +{ + Q_OBJECT +public: + LObjALocal(); + ~LObjALocal(); +}; + +LObjALocal::LObjALocal() +{ +} + +LObjALocal::~LObjALocal() +{ +} + +LObjAPrivate::LObjAPrivate() +{ + LObjALocal localObj; +} + +LObjAPrivate::~LObjAPrivate() +{ +} + +LObjA::LObjA() + : d(new LObjAPrivate) +{ +} + +LObjA::~LObjA() +{ + delete d; +} + +#include "LObjA.moc" diff --git a/Tests/QtAutogen/MocInclude/LObjA.hpp b/Tests/QtAutogen/MocInclude/LObjA.hpp new file mode 100644 index 0000000..aac670c --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjA.hpp @@ -0,0 +1,19 @@ +#ifndef LOBJA_HPP +#define LOBJA_HPP + +#include + +// Object source comes with a .moc include +class LObjAPrivate; +class LObjA : public QObject +{ + Q_OBJECT +public: + LObjA(); + ~LObjA(); + +private: + LObjAPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/LObjA_p.h b/Tests/QtAutogen/MocInclude/LObjA_p.h new file mode 100644 index 0000000..ebe8395 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjA_p.h @@ -0,0 +1,12 @@ +#ifndef LOBJA_P_HPP +#define LOBJA_P_HPP + +class LObjAPrivate : public QObject +{ + Q_OBJECT +public: + LObjAPrivate(); + ~LObjAPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/LObjB.cpp b/Tests/QtAutogen/MocInclude/LObjB.cpp new file mode 100644 index 0000000..7485d8f --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjB.cpp @@ -0,0 +1,40 @@ +#include "LObjB.hpp" +#include "LObjB_p.h" + +class LObjBLocal : public QObject +{ + Q_OBJECT +public: + LObjBLocal(); + ~LObjBLocal(); +}; + +LObjBLocal::LObjBLocal() +{ +} + +LObjBLocal::~LObjBLocal() +{ +} + +LObjBPrivate::LObjBPrivate() +{ + LObjBLocal localObj; +} + +LObjBPrivate::~LObjBPrivate() +{ +} + +LObjB::LObjB() + : d(new LObjBPrivate) +{ +} + +LObjB::~LObjB() +{ + delete d; +} + +#include "LObjB.moc" +#include "moc_LObjB.cpp" diff --git a/Tests/QtAutogen/MocInclude/LObjB.hpp b/Tests/QtAutogen/MocInclude/LObjB.hpp new file mode 100644 index 0000000..eb4e58d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjB.hpp @@ -0,0 +1,19 @@ +#ifndef LLObjB_HPP +#define LLObjB_HPP + +#include + +// Object source comes with a .moc and a _moc include +class LObjBPrivate; +class LObjB : public QObject +{ + Q_OBJECT +public: + LObjB(); + ~LObjB(); + +private: + LObjBPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/LObjB_p.h b/Tests/QtAutogen/MocInclude/LObjB_p.h new file mode 100644 index 0000000..b871f2d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjB_p.h @@ -0,0 +1,12 @@ +#ifndef LOBJB_P_HPP +#define LOBJB_P_HPP + +class LObjBPrivate : public QObject +{ + Q_OBJECT +public: + LObjBPrivate(); + ~LObjBPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/ObjA.cpp b/Tests/QtAutogen/MocInclude/ObjA.cpp new file mode 100644 index 0000000..6f6b90e --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjA.cpp @@ -0,0 +1,20 @@ +#include "ObjA.hpp" +#include "ObjA_p.h" + +ObjAPrivate::ObjAPrivate() +{ +} + +ObjAPrivate::~ObjAPrivate() +{ +} + +ObjA::ObjA() + : d(new ObjAPrivate) +{ +} + +ObjA::~ObjA() +{ + delete d; +} diff --git a/Tests/QtAutogen/MocInclude/ObjA.hpp b/Tests/QtAutogen/MocInclude/ObjA.hpp new file mode 100644 index 0000000..f16c924 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjA.hpp @@ -0,0 +1,19 @@ +#ifndef OBJA_HPP +#define OBJA_HPP + +#include + +// Object source comes without any _moc/.moc includes +class ObjAPrivate; +class ObjA : public QObject +{ + Q_OBJECT +public: + ObjA(); + ~ObjA(); + +private: + ObjAPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/ObjA_p.h b/Tests/QtAutogen/MocInclude/ObjA_p.h new file mode 100644 index 0000000..eb60c98 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjA_p.h @@ -0,0 +1,12 @@ +#ifndef OBJA_P_HPP +#define OBJA_P_HPP + +class ObjAPrivate : public QObject +{ + Q_OBJECT +public: + ObjAPrivate(); + ~ObjAPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/ObjB.cpp b/Tests/QtAutogen/MocInclude/ObjB.cpp new file mode 100644 index 0000000..a6f2509 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjB.cpp @@ -0,0 +1,22 @@ +#include "ObjB.hpp" +#include "ObjB_p.h" + +ObjBPrivate::ObjBPrivate() +{ +} + +ObjBPrivate::~ObjBPrivate() +{ +} + +ObjB::ObjB() + : d(new ObjBPrivate) +{ +} + +ObjB::~ObjB() +{ + delete d; +} + +#include "moc_ObjB.cpp" diff --git a/Tests/QtAutogen/MocInclude/ObjB.hpp b/Tests/QtAutogen/MocInclude/ObjB.hpp new file mode 100644 index 0000000..2ac8d17 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjB.hpp @@ -0,0 +1,19 @@ +#ifndef ObjB_HPP +#define ObjB_HPP + +#include + +// Object source comes with a _moc include +class ObjBPrivate; +class ObjB : public QObject +{ + Q_OBJECT +public: + ObjB(); + ~ObjB(); + +private: + ObjBPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/ObjB_p.h b/Tests/QtAutogen/MocInclude/ObjB_p.h new file mode 100644 index 0000000..418da65 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjB_p.h @@ -0,0 +1,12 @@ +#ifndef OBJB_P_HPP +#define OBJB_P_HPP + +class ObjBPrivate : public QObject +{ + Q_OBJECT +public: + ObjBPrivate(); + ~ObjBPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/SObjA.cpp b/Tests/QtAutogen/MocInclude/SObjA.cpp new file mode 100644 index 0000000..7e75bf9 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjA.cpp @@ -0,0 +1,11 @@ +#include "SObjA.hpp" + +SObjA::SObjA() +{ +} + +SObjA::~SObjA() +{ +} + +#include "SObjA.moc" diff --git a/Tests/QtAutogen/MocInclude/SObjA.hpp b/Tests/QtAutogen/MocInclude/SObjA.hpp new file mode 100644 index 0000000..1436abc --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjA.hpp @@ -0,0 +1,15 @@ +#ifndef SOBJA_HPP +#define SOBJA_HPP + +#include + +// Object source includes externally generated .moc file +class SObjA : public QObject +{ + Q_OBJECT +public: + SObjA(); + ~SObjA(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/SObjB.cpp.in b/Tests/QtAutogen/MocInclude/SObjB.cpp.in new file mode 100644 index 0000000..b1cc12a --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjB.cpp.in @@ -0,0 +1,11 @@ +#include "SObjB.hpp" + +SObjB::SObjB() +{ +} + +SObjB::~SObjB() +{ +} + +#include "SObjB.moc" diff --git a/Tests/QtAutogen/MocInclude/SObjB.hpp.in b/Tests/QtAutogen/MocInclude/SObjB.hpp.in new file mode 100644 index 0000000..5e396ae --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjB.hpp.in @@ -0,0 +1,15 @@ +#ifndef SOBJB_HPP +#define SOBJB_HPP + +#include + +// Object source includes externally generated .moc file +class SObjB : public QObject +{ + Q_OBJECT +public: + SObjB(); + ~SObjB(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/SObjC.cpp b/Tests/QtAutogen/MocInclude/SObjC.cpp new file mode 100644 index 0000000..1e8d397 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjC.cpp @@ -0,0 +1,35 @@ +#include "SObjC.hpp" + +void SObjCLocalFunction(); + +class SObjCLocal : public QObject +{ + Q_OBJECT + +public: + SObjCLocal(); + ~SObjCLocal(); +}; + +SObjCLocal::SObjCLocal() +{ +} + +SObjCLocal::~SObjCLocal() +{ +} + +SObjC::SObjC() +{ + SObjCLocal localObject; + SObjCLocalFunction(); +} + +SObjC::~SObjC() +{ +} + +#include "SObjC.moc" +#include "moc_SObjC.cpp" +// Include moc_ file for which the header is SKIP_AUTOMOC enabled +#include "moc_SObjCExtra.cpp" diff --git a/Tests/QtAutogen/MocInclude/SObjC.hpp b/Tests/QtAutogen/MocInclude/SObjC.hpp new file mode 100644 index 0000000..def0f9d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjC.hpp @@ -0,0 +1,15 @@ +#ifndef SOBJC_HPP +#define SOBJC_HPP + +#include + +// Object source includes externally generated .moc file +class SObjC : public QObject +{ + Q_OBJECT +public: + SObjC(); + ~SObjC(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/SObjCExtra.cpp b/Tests/QtAutogen/MocInclude/SObjCExtra.cpp new file mode 100644 index 0000000..55dd1c3 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjCExtra.cpp @@ -0,0 +1,31 @@ +#include "SObjCExtra.hpp" + +class SObjCLocalExtra : public QObject +{ + Q_OBJECT + +public: + SObjCLocalExtra(); + ~SObjCLocalExtra(); +}; + +SObjCLocalExtra::SObjCLocalExtra() +{ +} + +SObjCLocalExtra::~SObjCLocalExtra() +{ +} + +SObjCExtra::SObjCExtra() +{ +} + +SObjCExtra::~SObjCExtra() +{ +} + +// Externally generated header moc +#include "SObjCExtra_extMoc.cpp" +// AUTOMOC generated source moc +#include "SObjCExtra.moc" diff --git a/Tests/QtAutogen/MocInclude/SObjCExtra.hpp b/Tests/QtAutogen/MocInclude/SObjCExtra.hpp new file mode 100644 index 0000000..08545ac --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjCExtra.hpp @@ -0,0 +1,15 @@ +#ifndef SOBJCEXTRA_HPP +#define SOBJCEXTRA_HPP + +#include + +// Object source includes externally generated .moc file +class SObjCExtra : public QObject +{ + Q_OBJECT +public: + SObjCExtra(); + ~SObjCExtra(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/SObjCExtra.moc.in b/Tests/QtAutogen/MocInclude/SObjCExtra.moc.in new file mode 100644 index 0000000..00fc4aa --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjCExtra.moc.in @@ -0,0 +1,4 @@ + +void SObjCLocalFunction() +{ +} diff --git a/Tests/QtAutogen/MocInclude/shared.cmake b/Tests/QtAutogen/MocInclude/shared.cmake new file mode 100644 index 0000000..2ca2841 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/shared.cmake @@ -0,0 +1,71 @@ +# Test moc include patterns +include_directories("../MocInclude") +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +# Generate .moc file externally and enabled SKIP_AUTOMOC on the file +qtx_generate_moc( + ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjA.hpp + ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc) +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjA.cpp PROPERTY SKIP_AUTOMOC ON) + +# Generate .moc file externally from generated source file +# and enabled SKIP_AUTOMOC on the source file +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjB.hpp.in + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjB.cpp.in + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp) +qtx_generate_moc( + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc) +set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp PROPERTY SKIP_AUTOMOC ON) + +# Generate moc file externally and enabled SKIP_AUTOMOC on the header +qtx_generate_moc( + ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.hpp + ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp) +set_property( + SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.hpp + PROPERTY SKIP_AUTOMOC ON) +# Custom target to depend on +set(SOBJC_MOC ${CMAKE_CURRENT_BINARY_DIR}/moc_SObjCExtra.cpp) +add_custom_target("${MOC_INCLUDE_NAME}_SOBJC" + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp + BYPRODUCTS ${SOBJC_MOC} + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.moc.in + ${SOBJC_MOC}) + +# MOC_INCLUDE_NAME must be defined by the includer +add_executable(${MOC_INCLUDE_NAME} + # Common sources + ../MocInclude/ObjA.cpp + ../MocInclude/ObjB.cpp + + ../MocInclude/LObjA.cpp + ../MocInclude/LObjB.cpp + + ../MocInclude/EObjA.cpp + ../MocInclude/EObjAExtra.cpp + ../MocInclude/EObjB.cpp + ../MocInclude/subExtra/EObjBExtra.cpp + + ../MocInclude/SObjA.cpp + ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc + ../MocInclude/SObjC.cpp + ../MocInclude/SObjCExtra.hpp + ../MocInclude/SObjCExtra.cpp + + ../MocInclude/subGlobal/GObj.cpp + main.cpp +) +add_dependencies(${MOC_INCLUDE_NAME} "${MOC_INCLUDE_NAME}_SOBJC") +target_link_libraries(${MOC_INCLUDE_NAME} ${QT_LIBRARIES}) +set_target_properties(${MOC_INCLUDE_NAME} PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp new file mode 100644 index 0000000..c697866 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp @@ -0,0 +1,20 @@ +#include "EObjBExtra.hpp" +#include "EObjBExtra_p.hpp" + +EObjBExtraPrivate::EObjBExtraPrivate() +{ +} + +EObjBExtraPrivate::~EObjBExtraPrivate() +{ +} + +EObjBExtra::EObjBExtra() + : d(new EObjBExtraPrivate) +{ +} + +EObjBExtra::~EObjBExtra() +{ + delete d; +} diff --git a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp new file mode 100644 index 0000000..3798d7f --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp @@ -0,0 +1,18 @@ +#ifndef EOBJBEXTRA_HPP +#define EOBJBEXTRA_HPP + +#include + +class EObjBExtraPrivate; +class EObjBExtra : public QObject +{ + Q_OBJECT +public: + EObjBExtra(); + ~EObjBExtra(); + +private: + EObjBExtraPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp new file mode 100644 index 0000000..db8a096 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp @@ -0,0 +1,12 @@ +#ifndef EOBJBEXTRA_P_HPP +#define EOBJBEXTRA_P_HPP + +class EObjBExtraPrivate : public QObject +{ + Q_OBJECT +public: + EObjBExtraPrivate(); + ~EObjBExtraPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp b/Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp new file mode 100644 index 0000000..6b92f21 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp @@ -0,0 +1,41 @@ +#include "GObj.hpp" +#include "GObj_p.hpp" + +namespace subGlobal { + +class GObjLocal : public QObject +{ + Q_OBJECT +public: + GObjLocal(); + ~GObjLocal(); +}; + +GObjLocal::GObjLocal() +{ +} + +GObjLocal::~GObjLocal() +{ +} + +GObjPrivate::GObjPrivate() +{ +} + +GObjPrivate::~GObjPrivate() +{ +} + +GObj::GObj() +{ + GObjLocal localObj; +} + +GObj::~GObj() +{ +} +} + +// For the local QObject +#include "GObj.moc" diff --git a/Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp b/Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp new file mode 100644 index 0000000..2f9ee82 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp @@ -0,0 +1,17 @@ +#ifndef GOBJ_HPP +#define GOBJ_HPP + +#include + +namespace subGlobal { + +class GObj : public QObject +{ + Q_OBJECT +public: + GObj(); + ~GObj(); +}; +} + +#endif diff --git a/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp b/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp new file mode 100644 index 0000000..7b37dfd --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp @@ -0,0 +1,15 @@ +#ifndef GOBJ_P_HPP +#define GOBJ_P_HPP + +namespace subGlobal { + +class GObjPrivate : public QObject +{ + Q_OBJECT +public: + GObjPrivate(); + ~GObjPrivate(); +}; +} + +#endif diff --git a/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt b/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt new file mode 100644 index 0000000..b1c4fc3 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.10) +project(MocIncludeRelaxed) +include("../AutogenTest.cmake") + +# Test moc include patterns +set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) + +# Shared executable +set(MOC_INCLUDE_NAME "mocIncludeRelaxed") +include(${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/shared.cmake) + +# Relaxed ony executable +add_executable(mocIncludeRelaxedOnly + RObjA.cpp + RObjB.cpp + RObjC.cpp + RMain.cpp +) +target_link_libraries(mocIncludeRelaxedOnly ${QT_LIBRARIES}) +set_target_properties(mocIncludeRelaxedOnly PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp new file mode 100644 index 0000000..5b2c070 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp @@ -0,0 +1,12 @@ +// Relaxed AUTOMOC objects +#include "RObjA.hpp" +#include "RObjB.hpp" +#include "RObjC.hpp" + +int main(int argv, char** args) +{ + RObjA rObjA; + RObjB rObjB; + RObjC rObjC; + return 0; +} diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp new file mode 100644 index 0000000..2e2cf6a --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp @@ -0,0 +1,12 @@ +#include "RObjA.hpp" + +RObjA::RObjA() +{ +} + +RObjA::~RObjA() +{ +} + +// Relaxed include should moc the header instead +#include "RObjA.moc" diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp new file mode 100644 index 0000000..5974187 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp @@ -0,0 +1,14 @@ +#ifndef ROBJA_HPP +#define ROBJA_HPP + +#include + +class RObjA : public QObject +{ + Q_OBJECT +public: + RObjA(); + ~RObjA(); +}; + +#endif diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp new file mode 100644 index 0000000..c56d10f --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp @@ -0,0 +1,22 @@ +#include "RObjB.hpp" +#include "RObjBExtra.hpp" + +RObjBExtra::RObjBExtra() +{ +} + +RObjBExtra::~RObjBExtra() +{ +} + +RObjB::RObjB() +{ + RObjBExtra extraObject; +} + +RObjB::~RObjB() +{ +} + +// Relaxed mode should run moc on RObjBExtra.hpp instead +#include "RObjBExtra.moc" diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp new file mode 100644 index 0000000..d6d0474 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp @@ -0,0 +1,14 @@ +#ifndef ROBJB_HPP +#define ROBJB_HPP + +#include + +class RObjB : public QObject +{ + Q_OBJECT +public: + RObjB(); + ~RObjB(); +}; + +#endif diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp new file mode 100644 index 0000000..5d6be75 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp @@ -0,0 +1,14 @@ +#ifndef ROBJBEXTRA_HPP +#define ROBJBEXTRA_HPP + +#include + +class RObjBExtra : public QObject +{ + Q_OBJECT +public: + RObjBExtra(); + ~RObjBExtra(); +}; + +#endif diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp new file mode 100644 index 0000000..4ba32f5 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp @@ -0,0 +1,30 @@ +#include "RObjC.hpp" +#include + +class RObjCPrivate : public QObject +{ + Q_OBJECT +public: + RObjCPrivate(); + ~RObjCPrivate(); +}; + +RObjCPrivate::RObjCPrivate() +{ +} + +RObjCPrivate::~RObjCPrivate() +{ +} + +RObjC::RObjC() +{ + RObjCPrivate privateObject; +} + +RObjC::~RObjC() +{ +} + +// Relaxed include should moc this source instead of the header +#include "moc_RObjC.cpp" diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp new file mode 100644 index 0000000..5552ede --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp @@ -0,0 +1,14 @@ +#ifndef ROBJC_HPP +#define ROBJC_HPP + +#include + +class RObjC : public QObject +{ + Q_OBJECT +public: + RObjC(); + ~RObjC(); +}; + +#endif diff --git a/Tests/QtAutogen/MocIncludeRelaxed/main.cpp b/Tests/QtAutogen/MocIncludeRelaxed/main.cpp new file mode 100644 index 0000000..5a3148d --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/main.cpp @@ -0,0 +1,26 @@ +#include "EObjA.hpp" +#include "EObjB.hpp" +#include "LObjA.hpp" +#include "LObjB.hpp" +#include "ObjA.hpp" +#include "ObjB.hpp" +#include "SObjA.hpp" +#include "SObjB.hpp" +#include "subGlobal/GObj.hpp" + +int main(int argv, char** args) +{ + subGlobal::GObj gObj; + ObjA objA; + ObjB objB; + LObjA lObjA; + LObjB lObjB; + EObjA eObjA; + EObjB eObjB; + SObjA sObjA; + SObjB sObjB; + return 0; +} + +// Header in global subdirectory +#include "subGlobal/moc_GObj.cpp" diff --git a/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt b/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt new file mode 100644 index 0000000..2cf0fed --- /dev/null +++ b/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) +project(MocIncludeStrict) +include("../AutogenTest.cmake") + +# Test moc include patterns +set(CMAKE_AUTOMOC_RELAXED_MODE FALSE) + +# Shared executable +set(MOC_INCLUDE_NAME "mocIncludeStrict") +include(${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/shared.cmake) diff --git a/Tests/QtAutogen/MocIncludeStrict/main.cpp b/Tests/QtAutogen/MocIncludeStrict/main.cpp new file mode 100644 index 0000000..5a3148d --- /dev/null +++ b/Tests/QtAutogen/MocIncludeStrict/main.cpp @@ -0,0 +1,26 @@ +#include "EObjA.hpp" +#include "EObjB.hpp" +#include "LObjA.hpp" +#include "LObjB.hpp" +#include "ObjA.hpp" +#include "ObjB.hpp" +#include "SObjA.hpp" +#include "SObjB.hpp" +#include "subGlobal/GObj.hpp" + +int main(int argv, char** args) +{ + subGlobal::GObj gObj; + ObjA objA; + ObjB objB; + LObjA lObjA; + LObjB lObjB; + EObjA eObjA; + EObjB eObjB; + SObjA sObjA; + SObjB sObjB; + return 0; +} + +// Header in global subdirectory +#include "subGlobal/moc_GObj.cpp" diff --git a/Tests/QtAutogen/mocInclude/EObjA.cpp b/Tests/QtAutogen/mocInclude/EObjA.cpp deleted file mode 100644 index ca713b2..0000000 --- a/Tests/QtAutogen/mocInclude/EObjA.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "EObjA.hpp" -#include "EObjAExtra.hpp" -#include "EObjA_p.hpp" - -class EObjALocal : public QObject -{ - Q_OBJECT -public: - EObjALocal(); - ~EObjALocal(); -}; - -EObjALocal::EObjALocal() -{ -} - -EObjALocal::~EObjALocal() -{ -} - -EObjAPrivate::EObjAPrivate() -{ - EObjALocal localObj; - EObjAExtra extraObj; -} - -EObjAPrivate::~EObjAPrivate() -{ -} - -EObjA::EObjA() - : d(new EObjAPrivate) -{ -} - -EObjA::~EObjA() -{ -} - -// For EObjALocal -#include "EObjA.moc" -// - Not the own header -#include "moc_EObjAExtra.cpp" diff --git a/Tests/QtAutogen/mocInclude/EObjA.hpp b/Tests/QtAutogen/mocInclude/EObjA.hpp deleted file mode 100644 index 0939ab6..0000000 --- a/Tests/QtAutogen/mocInclude/EObjA.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef EOBJA_HPP -#define EOBJA_HPP - -#include - -// Sources includes a moc_ includes of an extra object -class EObjAPrivate; -class EObjA : public QObject -{ - Q_OBJECT -public: - EObjA(); - ~EObjA(); - -private: - EObjAPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/EObjAExtra.cpp b/Tests/QtAutogen/mocInclude/EObjAExtra.cpp deleted file mode 100644 index 369ca8f..0000000 --- a/Tests/QtAutogen/mocInclude/EObjAExtra.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "EObjAExtra.hpp" -#include "EObjAExtra_p.hpp" - -EObjAExtraPrivate::EObjAExtraPrivate() -{ -} - -EObjAExtraPrivate::~EObjAExtraPrivate() -{ -} - -EObjAExtra::EObjAExtra() - : d(new EObjAExtraPrivate) -{ -} - -EObjAExtra::~EObjAExtra() -{ - delete d; -} diff --git a/Tests/QtAutogen/mocInclude/EObjAExtra.hpp b/Tests/QtAutogen/mocInclude/EObjAExtra.hpp deleted file mode 100644 index b10681d..0000000 --- a/Tests/QtAutogen/mocInclude/EObjAExtra.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef EOBJAEXTRA_HPP -#define EOBJAEXTRA_HPP - -#include - -class EObjAExtraPrivate; -class EObjAExtra : public QObject -{ - Q_OBJECT -public: - EObjAExtra(); - ~EObjAExtra(); - -private: - EObjAExtraPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp b/Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp deleted file mode 100644 index dea6cb5..0000000 --- a/Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef EOBJAEXTRA_P_HPP -#define EOBJAEXTRA_P_HPP - -class EObjAExtraPrivate : public QObject -{ - Q_OBJECT -public: - EObjAExtraPrivate(); - ~EObjAExtraPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/EObjA_p.hpp b/Tests/QtAutogen/mocInclude/EObjA_p.hpp deleted file mode 100644 index 1e0d7e1..0000000 --- a/Tests/QtAutogen/mocInclude/EObjA_p.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef EOBJA_P_HPP -#define EOBJA_P_HPP - -class EObjAPrivate : public QObject -{ - Q_OBJECT -public: - EObjAPrivate(); - ~EObjAPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/EObjB.cpp b/Tests/QtAutogen/mocInclude/EObjB.cpp deleted file mode 100644 index d19fbfa..0000000 --- a/Tests/QtAutogen/mocInclude/EObjB.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "EObjB.hpp" -#include "EObjB_p.hpp" -#include "subExtra/EObjBExtra.hpp" - -class EObjBLocal : public QObject -{ - Q_OBJECT -public: - EObjBLocal(); - ~EObjBLocal(); -}; - -EObjBLocal::EObjBLocal() -{ -} - -EObjBLocal::~EObjBLocal() -{ -} - -EObjBPrivate::EObjBPrivate() -{ - EObjBLocal localObj; - EObjBExtra extraObj; -} - -EObjBPrivate::~EObjBPrivate() -{ -} - -EObjB::EObjB() - : d(new EObjBPrivate) -{ -} - -EObjB::~EObjB() -{ -} - -// For EObjBLocal -#include "EObjB.moc" -// - Not the own header -// - in a subdirectory -#include "subExtra/moc_EObjBExtra.cpp" diff --git a/Tests/QtAutogen/mocInclude/EObjB.hpp b/Tests/QtAutogen/mocInclude/EObjB.hpp deleted file mode 100644 index 6632bdb..0000000 --- a/Tests/QtAutogen/mocInclude/EObjB.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef EOBJB_HPP -#define EOBJB_HPP - -#include - -// Sources includes a moc_ includes of an extra object in a subdirectory -class EObjBPrivate; -class EObjB : public QObject -{ - Q_OBJECT -public: - EObjB(); - ~EObjB(); - -private: - EObjBPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/EObjB_p.hpp b/Tests/QtAutogen/mocInclude/EObjB_p.hpp deleted file mode 100644 index 2905f28..0000000 --- a/Tests/QtAutogen/mocInclude/EObjB_p.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef EOBJB_P_HPP -#define EOBJB_P_HPP - -class EObjBPrivate : public QObject -{ - Q_OBJECT -public: - EObjBPrivate(); - ~EObjBPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/LObjA.cpp b/Tests/QtAutogen/mocInclude/LObjA.cpp deleted file mode 100644 index 9aae991..0000000 --- a/Tests/QtAutogen/mocInclude/LObjA.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "LObjA.hpp" -#include "LObjA_p.h" - -class LObjALocal : public QObject -{ - Q_OBJECT -public: - LObjALocal(); - ~LObjALocal(); -}; - -LObjALocal::LObjALocal() -{ -} - -LObjALocal::~LObjALocal() -{ -} - -LObjAPrivate::LObjAPrivate() -{ - LObjALocal localObj; -} - -LObjAPrivate::~LObjAPrivate() -{ -} - -LObjA::LObjA() - : d(new LObjAPrivate) -{ -} - -LObjA::~LObjA() -{ - delete d; -} - -#include "LObjA.moc" diff --git a/Tests/QtAutogen/mocInclude/LObjA.hpp b/Tests/QtAutogen/mocInclude/LObjA.hpp deleted file mode 100644 index aac670c..0000000 --- a/Tests/QtAutogen/mocInclude/LObjA.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef LOBJA_HPP -#define LOBJA_HPP - -#include - -// Object source comes with a .moc include -class LObjAPrivate; -class LObjA : public QObject -{ - Q_OBJECT -public: - LObjA(); - ~LObjA(); - -private: - LObjAPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/LObjA_p.h b/Tests/QtAutogen/mocInclude/LObjA_p.h deleted file mode 100644 index ebe8395..0000000 --- a/Tests/QtAutogen/mocInclude/LObjA_p.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef LOBJA_P_HPP -#define LOBJA_P_HPP - -class LObjAPrivate : public QObject -{ - Q_OBJECT -public: - LObjAPrivate(); - ~LObjAPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/LObjB.cpp b/Tests/QtAutogen/mocInclude/LObjB.cpp deleted file mode 100644 index 7485d8f..0000000 --- a/Tests/QtAutogen/mocInclude/LObjB.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "LObjB.hpp" -#include "LObjB_p.h" - -class LObjBLocal : public QObject -{ - Q_OBJECT -public: - LObjBLocal(); - ~LObjBLocal(); -}; - -LObjBLocal::LObjBLocal() -{ -} - -LObjBLocal::~LObjBLocal() -{ -} - -LObjBPrivate::LObjBPrivate() -{ - LObjBLocal localObj; -} - -LObjBPrivate::~LObjBPrivate() -{ -} - -LObjB::LObjB() - : d(new LObjBPrivate) -{ -} - -LObjB::~LObjB() -{ - delete d; -} - -#include "LObjB.moc" -#include "moc_LObjB.cpp" diff --git a/Tests/QtAutogen/mocInclude/LObjB.hpp b/Tests/QtAutogen/mocInclude/LObjB.hpp deleted file mode 100644 index eb4e58d..0000000 --- a/Tests/QtAutogen/mocInclude/LObjB.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef LLObjB_HPP -#define LLObjB_HPP - -#include - -// Object source comes with a .moc and a _moc include -class LObjBPrivate; -class LObjB : public QObject -{ - Q_OBJECT -public: - LObjB(); - ~LObjB(); - -private: - LObjBPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/LObjB_p.h b/Tests/QtAutogen/mocInclude/LObjB_p.h deleted file mode 100644 index b871f2d..0000000 --- a/Tests/QtAutogen/mocInclude/LObjB_p.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef LOBJB_P_HPP -#define LOBJB_P_HPP - -class LObjBPrivate : public QObject -{ - Q_OBJECT -public: - LObjBPrivate(); - ~LObjBPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/ObjA.cpp b/Tests/QtAutogen/mocInclude/ObjA.cpp deleted file mode 100644 index 6f6b90e..0000000 --- a/Tests/QtAutogen/mocInclude/ObjA.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "ObjA.hpp" -#include "ObjA_p.h" - -ObjAPrivate::ObjAPrivate() -{ -} - -ObjAPrivate::~ObjAPrivate() -{ -} - -ObjA::ObjA() - : d(new ObjAPrivate) -{ -} - -ObjA::~ObjA() -{ - delete d; -} diff --git a/Tests/QtAutogen/mocInclude/ObjA.hpp b/Tests/QtAutogen/mocInclude/ObjA.hpp deleted file mode 100644 index f16c924..0000000 --- a/Tests/QtAutogen/mocInclude/ObjA.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef OBJA_HPP -#define OBJA_HPP - -#include - -// Object source comes without any _moc/.moc includes -class ObjAPrivate; -class ObjA : public QObject -{ - Q_OBJECT -public: - ObjA(); - ~ObjA(); - -private: - ObjAPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/ObjA_p.h b/Tests/QtAutogen/mocInclude/ObjA_p.h deleted file mode 100644 index eb60c98..0000000 --- a/Tests/QtAutogen/mocInclude/ObjA_p.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef OBJA_P_HPP -#define OBJA_P_HPP - -class ObjAPrivate : public QObject -{ - Q_OBJECT -public: - ObjAPrivate(); - ~ObjAPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/ObjB.cpp b/Tests/QtAutogen/mocInclude/ObjB.cpp deleted file mode 100644 index a6f2509..0000000 --- a/Tests/QtAutogen/mocInclude/ObjB.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "ObjB.hpp" -#include "ObjB_p.h" - -ObjBPrivate::ObjBPrivate() -{ -} - -ObjBPrivate::~ObjBPrivate() -{ -} - -ObjB::ObjB() - : d(new ObjBPrivate) -{ -} - -ObjB::~ObjB() -{ - delete d; -} - -#include "moc_ObjB.cpp" diff --git a/Tests/QtAutogen/mocInclude/ObjB.hpp b/Tests/QtAutogen/mocInclude/ObjB.hpp deleted file mode 100644 index 2ac8d17..0000000 --- a/Tests/QtAutogen/mocInclude/ObjB.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ObjB_HPP -#define ObjB_HPP - -#include - -// Object source comes with a _moc include -class ObjBPrivate; -class ObjB : public QObject -{ - Q_OBJECT -public: - ObjB(); - ~ObjB(); - -private: - ObjBPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/ObjB_p.h b/Tests/QtAutogen/mocInclude/ObjB_p.h deleted file mode 100644 index 418da65..0000000 --- a/Tests/QtAutogen/mocInclude/ObjB_p.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef OBJB_P_HPP -#define OBJB_P_HPP - -class ObjBPrivate : public QObject -{ - Q_OBJECT -public: - ObjBPrivate(); - ~ObjBPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/SObjA.cpp b/Tests/QtAutogen/mocInclude/SObjA.cpp deleted file mode 100644 index 7e75bf9..0000000 --- a/Tests/QtAutogen/mocInclude/SObjA.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "SObjA.hpp" - -SObjA::SObjA() -{ -} - -SObjA::~SObjA() -{ -} - -#include "SObjA.moc" diff --git a/Tests/QtAutogen/mocInclude/SObjA.hpp b/Tests/QtAutogen/mocInclude/SObjA.hpp deleted file mode 100644 index 1436abc..0000000 --- a/Tests/QtAutogen/mocInclude/SObjA.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef SOBJA_HPP -#define SOBJA_HPP - -#include - -// Object source includes externally generated .moc file -class SObjA : public QObject -{ - Q_OBJECT -public: - SObjA(); - ~SObjA(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/SObjB.cpp.in b/Tests/QtAutogen/mocInclude/SObjB.cpp.in deleted file mode 100644 index b1cc12a..0000000 --- a/Tests/QtAutogen/mocInclude/SObjB.cpp.in +++ /dev/null @@ -1,11 +0,0 @@ -#include "SObjB.hpp" - -SObjB::SObjB() -{ -} - -SObjB::~SObjB() -{ -} - -#include "SObjB.moc" diff --git a/Tests/QtAutogen/mocInclude/SObjB.hpp.in b/Tests/QtAutogen/mocInclude/SObjB.hpp.in deleted file mode 100644 index 5e396ae..0000000 --- a/Tests/QtAutogen/mocInclude/SObjB.hpp.in +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef SOBJB_HPP -#define SOBJB_HPP - -#include - -// Object source includes externally generated .moc file -class SObjB : public QObject -{ - Q_OBJECT -public: - SObjB(); - ~SObjB(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/SObjC.cpp b/Tests/QtAutogen/mocInclude/SObjC.cpp deleted file mode 100644 index 1e8d397..0000000 --- a/Tests/QtAutogen/mocInclude/SObjC.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "SObjC.hpp" - -void SObjCLocalFunction(); - -class SObjCLocal : public QObject -{ - Q_OBJECT - -public: - SObjCLocal(); - ~SObjCLocal(); -}; - -SObjCLocal::SObjCLocal() -{ -} - -SObjCLocal::~SObjCLocal() -{ -} - -SObjC::SObjC() -{ - SObjCLocal localObject; - SObjCLocalFunction(); -} - -SObjC::~SObjC() -{ -} - -#include "SObjC.moc" -#include "moc_SObjC.cpp" -// Include moc_ file for which the header is SKIP_AUTOMOC enabled -#include "moc_SObjCExtra.cpp" diff --git a/Tests/QtAutogen/mocInclude/SObjC.hpp b/Tests/QtAutogen/mocInclude/SObjC.hpp deleted file mode 100644 index def0f9d..0000000 --- a/Tests/QtAutogen/mocInclude/SObjC.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef SOBJC_HPP -#define SOBJC_HPP - -#include - -// Object source includes externally generated .moc file -class SObjC : public QObject -{ - Q_OBJECT -public: - SObjC(); - ~SObjC(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/SObjCExtra.cpp b/Tests/QtAutogen/mocInclude/SObjCExtra.cpp deleted file mode 100644 index 55dd1c3..0000000 --- a/Tests/QtAutogen/mocInclude/SObjCExtra.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "SObjCExtra.hpp" - -class SObjCLocalExtra : public QObject -{ - Q_OBJECT - -public: - SObjCLocalExtra(); - ~SObjCLocalExtra(); -}; - -SObjCLocalExtra::SObjCLocalExtra() -{ -} - -SObjCLocalExtra::~SObjCLocalExtra() -{ -} - -SObjCExtra::SObjCExtra() -{ -} - -SObjCExtra::~SObjCExtra() -{ -} - -// Externally generated header moc -#include "SObjCExtra_extMoc.cpp" -// AUTOMOC generated source moc -#include "SObjCExtra.moc" diff --git a/Tests/QtAutogen/mocInclude/SObjCExtra.hpp b/Tests/QtAutogen/mocInclude/SObjCExtra.hpp deleted file mode 100644 index 08545ac..0000000 --- a/Tests/QtAutogen/mocInclude/SObjCExtra.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef SOBJCEXTRA_HPP -#define SOBJCEXTRA_HPP - -#include - -// Object source includes externally generated .moc file -class SObjCExtra : public QObject -{ - Q_OBJECT -public: - SObjCExtra(); - ~SObjCExtra(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/SObjCExtra.moc.in b/Tests/QtAutogen/mocInclude/SObjCExtra.moc.in deleted file mode 100644 index 00fc4aa..0000000 --- a/Tests/QtAutogen/mocInclude/SObjCExtra.moc.in +++ /dev/null @@ -1,4 +0,0 @@ - -void SObjCLocalFunction() -{ -} diff --git a/Tests/QtAutogen/mocInclude/shared.cmake b/Tests/QtAutogen/mocInclude/shared.cmake deleted file mode 100644 index d05f27c..0000000 --- a/Tests/QtAutogen/mocInclude/shared.cmake +++ /dev/null @@ -1,71 +0,0 @@ -# Test moc include patterns -include_directories("../mocInclude") -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -# Generate .moc file externally and enabled SKIP_AUTOMOC on the file -qtx_generate_moc( - ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjA.hpp - ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc) -set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjA.cpp PROPERTY SKIP_AUTOMOC ON) - -# Generate .moc file externally from generated source file -# and enabled SKIP_AUTOMOC on the source file -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjB.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp) -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjB.cpp.in - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp) -qtx_generate_moc( - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc) -set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp PROPERTY SKIP_AUTOMOC ON) - -# Generate moc file externally and enabled SKIP_AUTOMOC on the header -qtx_generate_moc( - ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjCExtra.hpp - ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp) -set_property( - SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjCExtra.hpp - PROPERTY SKIP_AUTOMOC ON) -# Custom target to depend on -set(SOBJC_MOC ${CMAKE_CURRENT_BINARY_DIR}/moc_SObjCExtra.cpp) -add_custom_target("${MOC_INCLUDE_NAME}_SOBJC" - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp - BYPRODUCTS ${SOBJC_MOC} - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjCExtra.moc.in - ${SOBJC_MOC}) - -# MOC_INCLUDE_NAME must be defined by the includer -add_executable(${MOC_INCLUDE_NAME} - # Common sources - ../mocInclude/ObjA.cpp - ../mocInclude/ObjB.cpp - - ../mocInclude/LObjA.cpp - ../mocInclude/LObjB.cpp - - ../mocInclude/EObjA.cpp - ../mocInclude/EObjAExtra.cpp - ../mocInclude/EObjB.cpp - ../mocInclude/subExtra/EObjBExtra.cpp - - ../mocInclude/SObjA.cpp - ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc - ../mocInclude/SObjC.cpp - ../mocInclude/SObjCExtra.hpp - ../mocInclude/SObjCExtra.cpp - - ../mocInclude/subGlobal/GObj.cpp - main.cpp -) -add_dependencies(${MOC_INCLUDE_NAME} "${MOC_INCLUDE_NAME}_SOBJC") -target_link_libraries(${MOC_INCLUDE_NAME} ${QT_LIBRARIES}) -set_target_properties(${MOC_INCLUDE_NAME} PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp deleted file mode 100644 index c697866..0000000 --- a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "EObjBExtra.hpp" -#include "EObjBExtra_p.hpp" - -EObjBExtraPrivate::EObjBExtraPrivate() -{ -} - -EObjBExtraPrivate::~EObjBExtraPrivate() -{ -} - -EObjBExtra::EObjBExtra() - : d(new EObjBExtraPrivate) -{ -} - -EObjBExtra::~EObjBExtra() -{ - delete d; -} diff --git a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp deleted file mode 100644 index 3798d7f..0000000 --- a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef EOBJBEXTRA_HPP -#define EOBJBEXTRA_HPP - -#include - -class EObjBExtraPrivate; -class EObjBExtra : public QObject -{ - Q_OBJECT -public: - EObjBExtra(); - ~EObjBExtra(); - -private: - EObjBExtraPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp deleted file mode 100644 index db8a096..0000000 --- a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef EOBJBEXTRA_P_HPP -#define EOBJBEXTRA_P_HPP - -class EObjBExtraPrivate : public QObject -{ - Q_OBJECT -public: - EObjBExtraPrivate(); - ~EObjBExtraPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp b/Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp deleted file mode 100644 index 6b92f21..0000000 --- a/Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "GObj.hpp" -#include "GObj_p.hpp" - -namespace subGlobal { - -class GObjLocal : public QObject -{ - Q_OBJECT -public: - GObjLocal(); - ~GObjLocal(); -}; - -GObjLocal::GObjLocal() -{ -} - -GObjLocal::~GObjLocal() -{ -} - -GObjPrivate::GObjPrivate() -{ -} - -GObjPrivate::~GObjPrivate() -{ -} - -GObj::GObj() -{ - GObjLocal localObj; -} - -GObj::~GObj() -{ -} -} - -// For the local QObject -#include "GObj.moc" diff --git a/Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp b/Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp deleted file mode 100644 index 2f9ee82..0000000 --- a/Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GOBJ_HPP -#define GOBJ_HPP - -#include - -namespace subGlobal { - -class GObj : public QObject -{ - Q_OBJECT -public: - GObj(); - ~GObj(); -}; -} - -#endif diff --git a/Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp b/Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp deleted file mode 100644 index 7b37dfd..0000000 --- a/Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef GOBJ_P_HPP -#define GOBJ_P_HPP - -namespace subGlobal { - -class GObjPrivate : public QObject -{ - Q_OBJECT -public: - GObjPrivate(); - ~GObjPrivate(); -}; -} - -#endif diff --git a/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt b/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt deleted file mode 100644 index 97ba1df..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Test moc include patterns - -set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) - -# Shared executable -set(MOC_INCLUDE_NAME "mocIncludeRelaxed") -include(${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/shared.cmake) - -# Relaxed ony executable -add_executable(mocIncludeRelaxedOnly - RObjA.cpp - RObjB.cpp - RObjC.cpp - RMain.cpp -) -target_link_libraries(mocIncludeRelaxedOnly ${QT_LIBRARIES}) -set_target_properties(mocIncludeRelaxedOnly PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp deleted file mode 100644 index 5b2c070..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Relaxed AUTOMOC objects -#include "RObjA.hpp" -#include "RObjB.hpp" -#include "RObjC.hpp" - -int main(int argv, char** args) -{ - RObjA rObjA; - RObjB rObjB; - RObjC rObjC; - return 0; -} diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp deleted file mode 100644 index 2e2cf6a..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "RObjA.hpp" - -RObjA::RObjA() -{ -} - -RObjA::~RObjA() -{ -} - -// Relaxed include should moc the header instead -#include "RObjA.moc" diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp deleted file mode 100644 index 5974187..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ROBJA_HPP -#define ROBJA_HPP - -#include - -class RObjA : public QObject -{ - Q_OBJECT -public: - RObjA(); - ~RObjA(); -}; - -#endif diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp deleted file mode 100644 index c56d10f..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "RObjB.hpp" -#include "RObjBExtra.hpp" - -RObjBExtra::RObjBExtra() -{ -} - -RObjBExtra::~RObjBExtra() -{ -} - -RObjB::RObjB() -{ - RObjBExtra extraObject; -} - -RObjB::~RObjB() -{ -} - -// Relaxed mode should run moc on RObjBExtra.hpp instead -#include "RObjBExtra.moc" diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp deleted file mode 100644 index d6d0474..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ROBJB_HPP -#define ROBJB_HPP - -#include - -class RObjB : public QObject -{ - Q_OBJECT -public: - RObjB(); - ~RObjB(); -}; - -#endif diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp deleted file mode 100644 index 5d6be75..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ROBJBEXTRA_HPP -#define ROBJBEXTRA_HPP - -#include - -class RObjBExtra : public QObject -{ - Q_OBJECT -public: - RObjBExtra(); - ~RObjBExtra(); -}; - -#endif diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp deleted file mode 100644 index 4ba32f5..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "RObjC.hpp" -#include - -class RObjCPrivate : public QObject -{ - Q_OBJECT -public: - RObjCPrivate(); - ~RObjCPrivate(); -}; - -RObjCPrivate::RObjCPrivate() -{ -} - -RObjCPrivate::~RObjCPrivate() -{ -} - -RObjC::RObjC() -{ - RObjCPrivate privateObject; -} - -RObjC::~RObjC() -{ -} - -// Relaxed include should moc this source instead of the header -#include "moc_RObjC.cpp" diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp deleted file mode 100644 index 5552ede..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ROBJC_HPP -#define ROBJC_HPP - -#include - -class RObjC : public QObject -{ - Q_OBJECT -public: - RObjC(); - ~RObjC(); -}; - -#endif diff --git a/Tests/QtAutogen/mocIncludeRelaxed/main.cpp b/Tests/QtAutogen/mocIncludeRelaxed/main.cpp deleted file mode 100644 index 5a3148d..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/main.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "EObjA.hpp" -#include "EObjB.hpp" -#include "LObjA.hpp" -#include "LObjB.hpp" -#include "ObjA.hpp" -#include "ObjB.hpp" -#include "SObjA.hpp" -#include "SObjB.hpp" -#include "subGlobal/GObj.hpp" - -int main(int argv, char** args) -{ - subGlobal::GObj gObj; - ObjA objA; - ObjB objB; - LObjA lObjA; - LObjB lObjB; - EObjA eObjA; - EObjB eObjB; - SObjA sObjA; - SObjB sObjB; - return 0; -} - -// Header in global subdirectory -#include "subGlobal/moc_GObj.cpp" diff --git a/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt b/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt deleted file mode 100644 index 789354a..0000000 --- a/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Test moc include patterns - -set(CMAKE_AUTOMOC_RELAXED_MODE FALSE) -set(MOC_INCLUDE_NAME "mocIncludeStrict") - -include(${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/shared.cmake) diff --git a/Tests/QtAutogen/mocIncludeStrict/main.cpp b/Tests/QtAutogen/mocIncludeStrict/main.cpp deleted file mode 100644 index 5a3148d..0000000 --- a/Tests/QtAutogen/mocIncludeStrict/main.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "EObjA.hpp" -#include "EObjB.hpp" -#include "LObjA.hpp" -#include "LObjB.hpp" -#include "ObjA.hpp" -#include "ObjB.hpp" -#include "SObjA.hpp" -#include "SObjB.hpp" -#include "subGlobal/GObj.hpp" - -int main(int argv, char** args) -{ - subGlobal::GObj gObj; - ObjA objA; - ObjB objB; - LObjA lObjA; - LObjB lObjB; - EObjA eObjA; - EObjB eObjB; - SObjA sObjA; - SObjB sObjB; - return 0; -} - -// Header in global subdirectory -#include "subGlobal/moc_GObj.cpp" -- cgit v0.12