diff options
Diffstat (limited to 'Tests/QtAutogen')
98 files changed, 1092 insertions, 896 deletions
diff --git a/Tests/QtAutogen/MocInclude/CMakeLists.txt b/Tests/QtAutogen/MocInclude/CMakeLists.txt new file mode 100644 index 0000000..04c8baf --- /dev/null +++ b/Tests/QtAutogen/MocInclude/CMakeLists.txt @@ -0,0 +1,112 @@ +cmake_minimum_required(VERSION 3.15) +project(MocInclude) +get_filename_component(CS_REAL ${CMAKE_CURRENT_SOURCE_DIR} REALPATH) +include("${CS_REAL}/../AutogenCoreTest.cmake") + +# Test moc include patterns + +set(COM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Common") + +macro(addCopyCommand from to) + add_custom_command( + OUTPUT ${to} + COMMAND ${CMAKE_COMMAND} -E copy ${from} ${to} + DEPENDS ${from}) +endmacro() + +# Create an executable +function(makeExecutable TARGET_NAME) + # Utility variables + set(CB_DIR "${CMAKE_CURRENT_BINARY_DIR}") + + # Copy directory + file(REMOVE_RECURSE "${CB_DIR}/InIncludes") + file(COPY "${COM_DIR}/InIncludes.in" DESTINATION "${CB_DIR}") + file(RENAME "${CB_DIR}/InIncludes.in" "${CB_DIR}/InIncludes") + + # Generate .moc file from the header externally and + # enabled SKIP_AUTOMOC on the source file + qtx_wrap_cpp(ExternDotMOC ${COM_DIR}/ExternDot.hpp OPTIONS "-p" "./") + addCopyCommand(${ExternDotMOC} + ${CB_DIR}/ExternDot.moc) + set_property( + SOURCE ${COM_DIR}/ExternDot.cpp + PROPERTY SKIP_AUTOMOC ON) + + # Generate .moc file from the GENERATED header externally + # and enabled SKIP_AUTOMOC on the source file + addCopyCommand(${COM_DIR}/ExternDotGenerated.hpp.in + ${CB_DIR}/ExternDotGenerated.hpp) + addCopyCommand(${COM_DIR}/ExternDotGenerated.cpp.in + ${CB_DIR}/ExternDotGenerated.cpp) + qtx_wrap_cpp(ExternDotGeneratedMOC + ${CB_DIR}/ExternDotGenerated.hpp + OPTIONS "-p" "./") + addCopyCommand(${ExternDotGeneratedMOC} + ${CB_DIR}/ExternDotGenerated.moc) + set_property( + SOURCE ${CB_DIR}/ExternDotGenerated.cpp + PROPERTY SKIP_AUTOMOC ON) + + # Generate header moc file externally with a custom name + # and enabled SKIP_AUTOMOC on the header + qtx_wrap_cpp(MixedCustomMOC + ${COM_DIR}/MixedCustom.hpp + OPTIONS "-p" "./") + addCopyCommand(${MixedCustomMOC} + ${CB_DIR}/MixedCustom_extMoc.cpp) + set_property( + SOURCE ${COM_DIR}/MixedCustom.hpp + PROPERTY SKIP_AUTOMOC ON) + # Custom target to depend on + add_custom_target("${TARGET_NAME}_MixedCustom" + DEPENDS ${CB_DIR}/MixedCustom_extMoc.cpp + BYPRODUCTS ${CB_DIR}/moc_MixedCustom.cpp + COMMAND ${CMAKE_COMMAND} -E copy + ${COM_DIR}/moc_MixedCustom.cpp.in + ${CB_DIR}/moc_MixedCustom.cpp) + + add_executable(${TARGET_NAME} + # Test own "*.moc" and "moc_*.cpp" includes + ${COM_DIR}/None.cpp + ${COM_DIR}/OwnDot.cpp + ${COM_DIR}/OwnUnderscore.cpp + ${COM_DIR}/OwnDotUnderscore.cpp + + # Test "moc_*.cpp" includes of other files + ${COM_DIR}/OtherUnderscore.cpp + ${COM_DIR}/OtherUnderscoreExtra.cpp + ${COM_DIR}/OtherUnderscoreSub.cpp + ${COM_DIR}/OtherUnderscoreSubDir/SubExtra.cpp + + # Test relative ../../ path for moc includes + ${COM_DIR}/DualSub/Second/Second.cpp + ${COM_DIR}/DualSubMocked.cpp + + # Test externally generated moc files + ${COM_DIR}/ExternDot.cpp + ${CB_DIR}/ExternDot.moc + + # Test externally generated moc files for GENERATED source + ${CB_DIR}/ExternDotGenerated.cpp + ${CB_DIR}/ExternDotGenerated.moc + + # Test externally generated moc files and SKIP_AUTOMOC enabled header + ${COM_DIR}/MixedSkipped.cpp + ${COM_DIR}/MixedCustom.hpp + ${COM_DIR}/MixedCustom.cpp + + # Test sources in a subdirectory + ${CB_DIR}/InIncludes/SubOwnDot.cpp + ${COM_DIR}/InIncludesMoc.cpp + ) + add_dependencies(${TARGET_NAME} "${TARGET_NAME}_MixedCustom") + target_include_directories(${TARGET_NAME} PRIVATE "${COM_DIR}") + target_include_directories(${TARGET_NAME} PRIVATE "${CB_DIR}") + target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + target_link_libraries(${TARGET_NAME} ${QT_LIBRARIES}) + set_target_properties(${TARGET_NAME} PROPERTIES AUTOMOC ON) +endfunction() + +add_subdirectory(Strict) +add_subdirectory(Relaxed) diff --git a/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.cpp b/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.cpp new file mode 100644 index 0000000..453add1 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.cpp @@ -0,0 +1,11 @@ +#include "Second.hpp" + +Second::Second() +{ +} + +Second::~Second() +{ +} + +#include "../../moc_DualSubMocked.cpp" diff --git a/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.hpp b/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.hpp new file mode 100644 index 0000000..e1f3eac --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/DualSub/Second/Second.hpp @@ -0,0 +1,14 @@ +#ifndef Second_HPP +#define Second_HPP + +#include <QObject> + +class Second : public QObject +{ + Q_OBJECT +public: + Second(); + ~Second(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/DualSubMocked.cpp b/Tests/QtAutogen/MocInclude/Common/DualSubMocked.cpp new file mode 100644 index 0000000..1d4658d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/DualSubMocked.cpp @@ -0,0 +1,9 @@ +#include "DualSubMocked.hpp" + +DualSubMocked::DualSubMocked() +{ +} + +DualSubMocked::~DualSubMocked() +{ +} diff --git a/Tests/QtAutogen/MocInclude/Common/DualSubMocked.hpp b/Tests/QtAutogen/MocInclude/Common/DualSubMocked.hpp new file mode 100644 index 0000000..58cb571 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/DualSubMocked.hpp @@ -0,0 +1,15 @@ +#ifndef DualSubMocked_HPP +#define DualSubMocked_HPP + +#include <QObject> + +// Header moc file is included by DualSub/Second/Second.cpp +class DualSubMocked : public QObject +{ + Q_OBJECT +public: + DualSubMocked(); + ~DualSubMocked(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/ExternDot.cpp b/Tests/QtAutogen/MocInclude/Common/ExternDot.cpp new file mode 100644 index 0000000..2495aa7 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/ExternDot.cpp @@ -0,0 +1,11 @@ +#include "ExternDot.hpp" + +ExternDot::ExternDot() +{ +} + +ExternDot::~ExternDot() +{ +} + +#include "ExternDot.moc" diff --git a/Tests/QtAutogen/MocInclude/SObjA.hpp b/Tests/QtAutogen/MocInclude/Common/ExternDot.hpp index 1436abc..7eaab2a 100644 --- a/Tests/QtAutogen/MocInclude/SObjA.hpp +++ b/Tests/QtAutogen/MocInclude/Common/ExternDot.hpp @@ -1,15 +1,15 @@ -#ifndef SOBJA_HPP -#define SOBJA_HPP +#ifndef ExternDot_HPP +#define ExternDot_HPP #include <QObject> // Object source includes externally generated .moc file -class SObjA : public QObject +class ExternDot : public QObject { Q_OBJECT public: - SObjA(); - ~SObjA(); + ExternDot(); + ~ExternDot(); }; #endif diff --git a/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.cpp.in b/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.cpp.in new file mode 100644 index 0000000..09ce5cd --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.cpp.in @@ -0,0 +1,11 @@ +#include "ExternDotGenerated.hpp" + +ExternDotGenerated::ExternDotGenerated() +{ +} + +ExternDotGenerated::~ExternDotGenerated() +{ +} + +#include "ExternDotGenerated.moc" diff --git a/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.hpp.in b/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.hpp.in new file mode 100644 index 0000000..21c69be --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/ExternDotGenerated.hpp.in @@ -0,0 +1,15 @@ +#ifndef ExternDotGenerated_HPP +#define ExternDotGenerated_HPP + +#include <QObject> + +// GENERATED Object source includes externally generated .moc file +class ExternDotGenerated : public QObject +{ + Q_OBJECT +public: + ExternDotGenerated(); + ~ExternDotGenerated(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.cpp b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.cpp new file mode 100644 index 0000000..af35711 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.cpp @@ -0,0 +1,43 @@ +#include "SubOwnDot.hpp" +#include "SubOwnDot_p.hpp" + +namespace InIncludes { + +class SubOwnDotLocal : public QObject +{ + Q_OBJECT +public: + SubOwnDotLocal(); + ~SubOwnDotLocal(); +}; + +SubOwnDotLocal::SubOwnDotLocal() +{ +} + +SubOwnDotLocal::~SubOwnDotLocal() +{ +} + +SubOwnDotPrivate::SubOwnDotPrivate() +{ +} + +SubOwnDotPrivate::~SubOwnDotPrivate() +{ +} + +SubOwnDot::SubOwnDot() +{ + SubOwnDotPrivate privateObj; + SubOwnDotLocal localObj; +} + +SubOwnDot::~SubOwnDot() +{ +} + +} // End of namespace + +// For the local QObject +#include "SubOwnDot.moc" diff --git a/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.hpp b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.hpp new file mode 100644 index 0000000..038ddfa --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot.hpp @@ -0,0 +1,17 @@ +#ifndef InIncludes_SubOwnDot_HPP +#define InIncludes_SubOwnDot_HPP + +#include <QObject> + +namespace InIncludes { + +class SubOwnDot : public QObject +{ + Q_OBJECT +public: + SubOwnDot(); + ~SubOwnDot(); +}; +} + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot_p.hpp b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot_p.hpp new file mode 100644 index 0000000..626a9a8 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/InIncludes.in/SubOwnDot_p.hpp @@ -0,0 +1,18 @@ +#ifndef InIncludes_SubOwnDot_P_HPP +#define InIncludes_SubOwnDot_P_HPP + +#include <QObject> + +namespace InIncludes { + +class SubOwnDotPrivate : public QObject +{ + Q_OBJECT +public: + SubOwnDotPrivate(); + ~SubOwnDotPrivate(); +}; + +} // End of namespace + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/InIncludesMoc.cpp b/Tests/QtAutogen/MocInclude/Common/InIncludesMoc.cpp new file mode 100644 index 0000000..88f53a4 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/InIncludesMoc.cpp @@ -0,0 +1,4 @@ + +// Moc a header that is not in the sources but in a directory that +// is in the list of include directories. +#include "InIncludes/moc_SubOwnDot.cpp" diff --git a/Tests/QtAutogen/MocInclude/Common/MixedCustom.cpp b/Tests/QtAutogen/MocInclude/Common/MixedCustom.cpp new file mode 100644 index 0000000..557cc62 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/MixedCustom.cpp @@ -0,0 +1,32 @@ +#include "MixedCustom.hpp" + +class MixedCustomLocal : public QObject +{ + Q_OBJECT + +public: + MixedCustomLocal(); + ~MixedCustomLocal(); +}; + +MixedCustomLocal::MixedCustomLocal() +{ +} + +MixedCustomLocal::~MixedCustomLocal() +{ +} + +MixedCustom::MixedCustom() +{ + MixedCustomLocal local; +} + +MixedCustom::~MixedCustom() +{ +} + +// AUTOMOC generated source moc +#include "MixedCustom.moc" +// Externally generated header moc +#include "MixedCustom_extMoc.cpp" diff --git a/Tests/QtAutogen/MocInclude/Common/MixedCustom.hpp b/Tests/QtAutogen/MocInclude/Common/MixedCustom.hpp new file mode 100644 index 0000000..6e8ff88 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/MixedCustom.hpp @@ -0,0 +1,20 @@ +#ifndef MixedCustom_HPP +#define MixedCustom_HPP + +#include <QObject> + +// Object source includes +// - externally generated header moc file +// - AUTOMOC generated source .moc file +class MixedCustom : public QObject +{ + Q_OBJECT +public: + MixedCustom(); + ~MixedCustom(); +}; + +// Function forward declaration +void moc_MixedCustom(MixedCustom const& arg); + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/MixedSkipped.cpp b/Tests/QtAutogen/MocInclude/Common/MixedSkipped.cpp new file mode 100644 index 0000000..df08ff1 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/MixedSkipped.cpp @@ -0,0 +1,39 @@ +#include "MixedSkipped.hpp" +#include "MixedCustom.hpp" + +class MixedSkippedLocal : public QObject +{ + Q_OBJECT + +public: + MixedSkippedLocal(); + ~MixedSkippedLocal(); +}; + +MixedSkippedLocal::MixedSkippedLocal() +{ +} + +MixedSkippedLocal::~MixedSkippedLocal() +{ +} + +MixedSkipped::MixedSkipped() +{ + MixedSkippedLocal local; + MixedCustom externCutom; + // Call moc named function + moc_MixedCustom(externCutom); +} + +MixedSkipped::~MixedSkipped() +{ +} + +// Include AUTOMOC generated moc files +#include "MixedSkipped.moc" +#include "moc_MixedSkipped.cpp" + +// Include externally generated moc_ named file that is not a moc file +// and for which the relevant header is SKIP_AUTOMOC enabled +#include "moc_MixedCustom.cpp" diff --git a/Tests/QtAutogen/MocInclude/Common/MixedSkipped.hpp b/Tests/QtAutogen/MocInclude/Common/MixedSkipped.hpp new file mode 100644 index 0000000..5f6c664 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/MixedSkipped.hpp @@ -0,0 +1,17 @@ +#ifndef MixedSkipped_HPP +#define MixedSkipped_HPP + +#include <QObject> + +// Object source includes +// - Own moc_ and .moc files. +// - externally generated moc_ file from a SKIP_AUTOMOC enabled header +class MixedSkipped : public QObject +{ + Q_OBJECT +public: + MixedSkipped(); + ~MixedSkipped(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/None.cpp b/Tests/QtAutogen/MocInclude/Common/None.cpp new file mode 100644 index 0000000..d01d5ec --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/None.cpp @@ -0,0 +1,20 @@ +#include "None.hpp" +#include "None_p.h" + +NonePrivate::NonePrivate() +{ +} + +NonePrivate::~NonePrivate() +{ +} + +None::None() + : d(new NonePrivate) +{ +} + +None::~None() +{ + delete d; +} diff --git a/Tests/QtAutogen/MocInclude/Common/None.hpp b/Tests/QtAutogen/MocInclude/Common/None.hpp new file mode 100644 index 0000000..ca0713e --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/None.hpp @@ -0,0 +1,19 @@ +#ifndef None_HPP +#define None_HPP + +#include <QObject> + +// Object source comes without any _moc/.moc includes +class NonePrivate; +class None : public QObject +{ + Q_OBJECT +public: + None(); + ~None(); + +private: + NonePrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/None_p.h b/Tests/QtAutogen/MocInclude/Common/None_p.h new file mode 100644 index 0000000..e209aeb --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/None_p.h @@ -0,0 +1,14 @@ +#ifndef None_P_HPP +#define None_P_HPP + +#include <QObject> + +class NonePrivate : public QObject +{ + Q_OBJECT +public: + NonePrivate(); + ~NonePrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.cpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.cpp new file mode 100644 index 0000000..219619f --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.cpp @@ -0,0 +1,44 @@ +#include "OtherUnderscore.hpp" +#include "OtherUnderscoreExtra.hpp" +#include "OtherUnderscore_p.hpp" + +class OtherUnderscoreLocal : public QObject +{ + Q_OBJECT +public: + OtherUnderscoreLocal(); + ~OtherUnderscoreLocal(); +}; + +OtherUnderscoreLocal::OtherUnderscoreLocal() +{ +} + +OtherUnderscoreLocal::~OtherUnderscoreLocal() +{ +} + +OtherUnderscorePrivate::OtherUnderscorePrivate() +{ + OtherUnderscoreLocal localObj; + OtherUnderscoreExtra extraObj; +} + +OtherUnderscorePrivate::~OtherUnderscorePrivate() +{ +} + +OtherUnderscore::OtherUnderscore() + : d(new OtherUnderscorePrivate) +{ +} + +OtherUnderscore::~OtherUnderscore() +{ + delete d; +} + +// For OtherUnderscoreLocal +#include "OtherUnderscore.moc" +// - Not the own header +#include "moc_OtherUnderscoreExtra.cpp" diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.hpp new file mode 100644 index 0000000..a4ff603 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore.hpp @@ -0,0 +1,19 @@ +#ifndef OtherUnderscore_HPP +#define OtherUnderscore_HPP + +#include <QObject> + +// Sources includes a moc_ includes of an extra object +class OtherUnderscorePrivate; +class OtherUnderscore : public QObject +{ + Q_OBJECT +public: + OtherUnderscore(); + ~OtherUnderscore(); + +private: + OtherUnderscorePrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.cpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.cpp new file mode 100644 index 0000000..4ccf080 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.cpp @@ -0,0 +1,20 @@ +#include "OtherUnderscoreExtra.hpp" +#include "OtherUnderscoreExtra_p.hpp" + +OtherUnderscoreExtraPrivate::OtherUnderscoreExtraPrivate() +{ +} + +OtherUnderscoreExtraPrivate::~OtherUnderscoreExtraPrivate() +{ +} + +OtherUnderscoreExtra::OtherUnderscoreExtra() + : d(new OtherUnderscoreExtraPrivate) +{ +} + +OtherUnderscoreExtra::~OtherUnderscoreExtra() +{ + delete d; +} diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.hpp new file mode 100644 index 0000000..5afe48c --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra.hpp @@ -0,0 +1,18 @@ +#ifndef OtherUnderscoreEXTRA_HPP +#define OtherUnderscoreEXTRA_HPP + +#include <QObject> + +class OtherUnderscoreExtraPrivate; +class OtherUnderscoreExtra : public QObject +{ + Q_OBJECT +public: + OtherUnderscoreExtra(); + ~OtherUnderscoreExtra(); + +private: + OtherUnderscoreExtraPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra_p.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra_p.hpp new file mode 100644 index 0000000..2066ac3 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreExtra_p.hpp @@ -0,0 +1,14 @@ +#ifndef OtherUnderscoreEXTRA_P_HPP +#define OtherUnderscoreEXTRA_P_HPP + +#include <QObject> + +class OtherUnderscoreExtraPrivate : public QObject +{ + Q_OBJECT +public: + OtherUnderscoreExtraPrivate(); + ~OtherUnderscoreExtraPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.cpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.cpp new file mode 100644 index 0000000..28850aa --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.cpp @@ -0,0 +1,45 @@ +#include "OtherUnderscoreSub.hpp" +#include "OtherUnderscoreSubDir/SubExtra.hpp" +#include "OtherUnderscoreSub_p.hpp" + +class OtherUnderscoreSubLocal : public QObject +{ + Q_OBJECT +public: + OtherUnderscoreSubLocal(); + ~OtherUnderscoreSubLocal(); +}; + +OtherUnderscoreSubLocal::OtherUnderscoreSubLocal() +{ +} + +OtherUnderscoreSubLocal::~OtherUnderscoreSubLocal() +{ +} + +OtherUnderscoreSubPrivate::OtherUnderscoreSubPrivate() +{ + OtherUnderscoreSubLocal localObj; + SubExtra extraObj; +} + +OtherUnderscoreSubPrivate::~OtherUnderscoreSubPrivate() +{ +} + +OtherUnderscoreSub::OtherUnderscoreSub() + : d(new OtherUnderscoreSubPrivate) +{ +} + +OtherUnderscoreSub::~OtherUnderscoreSub() +{ + delete d; +} + +// For OtherUnderscoreSubLocal +#include "OtherUnderscoreSub.moc" +// - Not the own header +// - in a subdirectory +#include "OtherUnderscoreSubDir/moc_SubExtra.cpp" diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.hpp new file mode 100644 index 0000000..7feaa46 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub.hpp @@ -0,0 +1,19 @@ +#ifndef OtherUnderscoreSub_HPP +#define OtherUnderscoreSub_HPP + +#include <QObject> + +// Sources includes a moc_ includes of an extra object in a subdirectory +class OtherUnderscoreSubPrivate; +class OtherUnderscoreSub : public QObject +{ + Q_OBJECT +public: + OtherUnderscoreSub(); + ~OtherUnderscoreSub(); + +private: + OtherUnderscoreSubPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.cpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.cpp new file mode 100644 index 0000000..e323ed8 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.cpp @@ -0,0 +1,20 @@ +#include "SubExtra.hpp" +#include "SubExtra_p.hpp" + +SubExtraPrivate::SubExtraPrivate() +{ +} + +SubExtraPrivate::~SubExtraPrivate() +{ +} + +SubExtra::SubExtra() + : d(new SubExtraPrivate) +{ +} + +SubExtra::~SubExtra() +{ + delete d; +} diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.hpp new file mode 100644 index 0000000..5700634 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra.hpp @@ -0,0 +1,18 @@ +#ifndef SubExtra_HPP +#define SubExtra_HPP + +#include <QObject> + +class SubExtraPrivate; +class SubExtra : public QObject +{ + Q_OBJECT +public: + SubExtra(); + ~SubExtra(); + +private: + SubExtraPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra_p.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra_p.hpp new file mode 100644 index 0000000..5a14a2d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSubDir/SubExtra_p.hpp @@ -0,0 +1,14 @@ +#ifndef SubExtra_P_HPP +#define SubExtra_P_HPP + +#include <QObject> + +class SubExtraPrivate : public QObject +{ + Q_OBJECT +public: + SubExtraPrivate(); + ~SubExtraPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub_p.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub_p.hpp new file mode 100644 index 0000000..7d5999c --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscoreSub_p.hpp @@ -0,0 +1,14 @@ +#ifndef OtherUnderscoreSub_P_HPP +#define OtherUnderscoreSub_P_HPP + +#include <QObject> + +class OtherUnderscoreSubPrivate : public QObject +{ + Q_OBJECT +public: + OtherUnderscoreSubPrivate(); + ~OtherUnderscoreSubPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OtherUnderscore_p.hpp b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore_p.hpp new file mode 100644 index 0000000..96906cf --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OtherUnderscore_p.hpp @@ -0,0 +1,14 @@ +#ifndef OtherUnderscore_P_HPP +#define OtherUnderscore_P_HPP + +#include <QObject> + +class OtherUnderscorePrivate : public QObject +{ + Q_OBJECT +public: + OtherUnderscorePrivate(); + ~OtherUnderscorePrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDot.cpp b/Tests/QtAutogen/MocInclude/Common/OwnDot.cpp new file mode 100644 index 0000000..1cce272 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OwnDot.cpp @@ -0,0 +1,39 @@ +#include "OwnDot.hpp" +#include "OwnDot_p.h" + +class OwnDotLocal : public QObject +{ + Q_OBJECT +public: + OwnDotLocal(); + ~OwnDotLocal(); +}; + +OwnDotLocal::OwnDotLocal() +{ +} + +OwnDotLocal::~OwnDotLocal() +{ +} + +OwnDotPrivate::OwnDotPrivate() +{ + OwnDotLocal localObj; +} + +OwnDotPrivate::~OwnDotPrivate() +{ +} + +OwnDot::OwnDot() + : d(new OwnDotPrivate) +{ +} + +OwnDot::~OwnDot() +{ + delete d; +} + +#include "OwnDot.moc" diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDot.hpp b/Tests/QtAutogen/MocInclude/Common/OwnDot.hpp new file mode 100644 index 0000000..6f49f12 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OwnDot.hpp @@ -0,0 +1,19 @@ +#ifndef OwnDot_HPP +#define OwnDot_HPP + +#include <QObject> + +// Object source comes with a .moc include +class OwnDotPrivate; +class OwnDot : public QObject +{ + Q_OBJECT +public: + OwnDot(); + ~OwnDot(); + +private: + OwnDotPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.cpp b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.cpp new file mode 100644 index 0000000..2a0b8ad --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.cpp @@ -0,0 +1,40 @@ +#include "OwnDotUnderscore.hpp" +#include "OwnDotUnderscore_p.h" + +class OwnDotUnderscoreLocal : public QObject +{ + Q_OBJECT +public: + OwnDotUnderscoreLocal(); + ~OwnDotUnderscoreLocal(); +}; + +OwnDotUnderscoreLocal::OwnDotUnderscoreLocal() +{ +} + +OwnDotUnderscoreLocal::~OwnDotUnderscoreLocal() +{ +} + +OwnDotUnderscorePrivate::OwnDotUnderscorePrivate() +{ + OwnDotUnderscoreLocal localObj; +} + +OwnDotUnderscorePrivate::~OwnDotUnderscorePrivate() +{ +} + +OwnDotUnderscore::OwnDotUnderscore() + : d(new OwnDotUnderscorePrivate) +{ +} + +OwnDotUnderscore::~OwnDotUnderscore() +{ + delete d; +} + +#include "OwnDotUnderscore.moc" +#include "moc_OwnDotUnderscore.cpp" diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.hpp b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.hpp new file mode 100644 index 0000000..478955c --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore.hpp @@ -0,0 +1,19 @@ +#ifndef LOwnDotUnderscore_HPP +#define LOwnDotUnderscore_HPP + +#include <QObject> + +// Object source comes with a .moc and a _moc include +class OwnDotUnderscorePrivate; +class OwnDotUnderscore : public QObject +{ + Q_OBJECT +public: + OwnDotUnderscore(); + ~OwnDotUnderscore(); + +private: + OwnDotUnderscorePrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore_p.h b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore_p.h new file mode 100644 index 0000000..6950b7f --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OwnDotUnderscore_p.h @@ -0,0 +1,14 @@ +#ifndef OwnDotUnderscore_P_HPP +#define OwnDotUnderscore_P_HPP + +#include <QObject> + +class OwnDotUnderscorePrivate : public QObject +{ + Q_OBJECT +public: + OwnDotUnderscorePrivate(); + ~OwnDotUnderscorePrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OwnDot_p.h b/Tests/QtAutogen/MocInclude/Common/OwnDot_p.h new file mode 100644 index 0000000..f3aff32 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OwnDot_p.h @@ -0,0 +1,14 @@ +#ifndef OwnDot_P_HPP +#define OwnDot_P_HPP + +#include <QObject> + +class OwnDotPrivate : public QObject +{ + Q_OBJECT +public: + OwnDotPrivate(); + ~OwnDotPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.cpp b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.cpp new file mode 100644 index 0000000..ebbcf45 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.cpp @@ -0,0 +1,22 @@ +#include "OwnUnderscore.hpp" +#include "OwnUnderscore_p.h" + +OwnUnderscorePrivate::OwnUnderscorePrivate() +{ +} + +OwnUnderscorePrivate::~OwnUnderscorePrivate() +{ +} + +OwnUnderscore::OwnUnderscore() + : d(new OwnUnderscorePrivate) +{ +} + +OwnUnderscore::~OwnUnderscore() +{ + delete d; +} + +#include "moc_OwnUnderscore.cpp" diff --git a/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.hpp b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.hpp new file mode 100644 index 0000000..e6a6a6e --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore.hpp @@ -0,0 +1,19 @@ +#ifndef OwnUnderscore_HPP +#define OwnUnderscore_HPP + +#include <QObject> + +// Object source comes with a _moc include +class OwnUnderscorePrivate; +class OwnUnderscore : public QObject +{ + Q_OBJECT +public: + OwnUnderscore(); + ~OwnUnderscore(); + +private: + OwnUnderscorePrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/OwnUnderscore_p.h b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore_p.h new file mode 100644 index 0000000..a3a6b00 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/OwnUnderscore_p.h @@ -0,0 +1,14 @@ +#ifndef OwnUnderscore_P_HPP +#define OwnUnderscore_P_HPP + +#include <QObject> + +class OwnUnderscorePrivate : public QObject +{ + Q_OBJECT +public: + OwnUnderscorePrivate(); + ~OwnUnderscorePrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/Common/common.cpp.in b/Tests/QtAutogen/MocInclude/Common/common.cpp.in new file mode 100644 index 0000000..b53e93d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/common.cpp.in @@ -0,0 +1,32 @@ +#include "DualSub/Second/Second.hpp" +#include "DualSubMocked.hpp" +#include "ExternDot.hpp" +#include "ExternDotGenerated.hpp" +#include "None.hpp" +#include "OtherUnderscore.hpp" +#include "OtherUnderscoreSub.hpp" +#include "OwnDot.hpp" +#include "OwnDotUnderscore.hpp" +#include "OwnUnderscore.hpp" +#include "InIncludes/SubOwnDot.hpp" + +bool @COMMON_FUNCTION_NAME@() +{ + None objNone; + OwnUnderscore objOwnUnderscore; + OwnDot objOwnDot; + OwnDotUnderscore objOwnDotUnderscore; + + OtherUnderscore objOtherUnderscore; + OtherUnderscoreSub objOtherUnderscoreSub; + + Second second; + DualSubMocked dualSubMocked; + + ExternDot objExternDot; + ExternDotGenerated objGeneratedExternDot; + + InIncludes::SubOwnDot subOwnDot; + + return true; +} diff --git a/Tests/QtAutogen/MocInclude/Common/moc_MixedCustom.cpp.in b/Tests/QtAutogen/MocInclude/Common/moc_MixedCustom.cpp.in new file mode 100644 index 0000000..6c44793 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Common/moc_MixedCustom.cpp.in @@ -0,0 +1,5 @@ + +void moc_MixedCustom(MixedCustom const & arg) +{ + (void)arg; +} diff --git a/Tests/QtAutogen/MocInclude/EObjA.cpp b/Tests/QtAutogen/MocInclude/EObjA.cpp deleted file mode 100644 index 7681c29..0000000 --- a/Tests/QtAutogen/MocInclude/EObjA.cpp +++ /dev/null @@ -1,44 +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() -{ - 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 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 <QObject> - -// 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 <QObject> - -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 d8bf284..0000000 --- a/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef EOBJAEXTRA_P_HPP -#define EOBJAEXTRA_P_HPP - -#include <QObject> - -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 9ef5624..0000000 --- a/Tests/QtAutogen/MocInclude/EObjA_p.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef EOBJA_P_HPP -#define EOBJA_P_HPP - -#include <QObject> - -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 3068c68..0000000 --- a/Tests/QtAutogen/MocInclude/EObjB.cpp +++ /dev/null @@ -1,45 +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() -{ - 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 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 <QObject> - -// 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 84b1ea2..0000000 --- a/Tests/QtAutogen/MocInclude/EObjB_p.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef EOBJB_P_HPP -#define EOBJB_P_HPP - -#include <QObject> - -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 <QObject> - -// 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 97113d6..0000000 --- a/Tests/QtAutogen/MocInclude/LObjA_p.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef LOBJA_P_HPP -#define LOBJA_P_HPP - -#include <QObject> - -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 <QObject> - -// 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 b88f40e..0000000 --- a/Tests/QtAutogen/MocInclude/LObjB_p.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef LOBJB_P_HPP -#define LOBJB_P_HPP - -#include <QObject> - -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 <QObject> - -// 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 d944bc6..0000000 --- a/Tests/QtAutogen/MocInclude/ObjA_p.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef OBJA_P_HPP -#define OBJA_P_HPP - -#include <QObject> - -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 <QObject> - -// 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 61ba604..0000000 --- a/Tests/QtAutogen/MocInclude/ObjB_p.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef OBJB_P_HPP -#define OBJB_P_HPP - -#include <QObject> - -class ObjBPrivate : public QObject -{ - Q_OBJECT -public: - ObjBPrivate(); - ~ObjBPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/MocInclude/Relaxed/CMakeLists.txt b/Tests/QtAutogen/MocInclude/Relaxed/CMakeLists.txt new file mode 100644 index 0000000..048b79c --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Relaxed/CMakeLists.txt @@ -0,0 +1,17 @@ +# Enable relaxed mode +set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) + +# Common test +set(COMMON_FUNCTION_NAME commonRelaxed) +configure_file( + "${COM_DIR}/common.cpp.in" + "${CMAKE_CURRENT_BINARY_DIR}/commonRelaxed.cpp") + +makeExecutable(libRelaxed) +target_sources(libRelaxed PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/commonRelaxed.cpp" + RObjA.cpp + RObjB.cpp + RObjC.cpp + relaxed.cpp + ) diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjA.cpp index 2e2cf6a..2e2cf6a 100644 --- a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp +++ b/Tests/QtAutogen/MocInclude/Relaxed/RObjA.cpp diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjA.hpp index 5974187..5974187 100644 --- a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp +++ b/Tests/QtAutogen/MocInclude/Relaxed/RObjA.hpp diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjB.cpp index c56d10f..c56d10f 100644 --- a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp +++ b/Tests/QtAutogen/MocInclude/Relaxed/RObjB.cpp diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjB.hpp index d6d0474..d6d0474 100644 --- a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp +++ b/Tests/QtAutogen/MocInclude/Relaxed/RObjB.hpp diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjBExtra.hpp index 5d6be75..5d6be75 100644 --- a/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp +++ b/Tests/QtAutogen/MocInclude/Relaxed/RObjBExtra.hpp diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjC.cpp index 4ba32f5..4ba32f5 100644 --- a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp +++ b/Tests/QtAutogen/MocInclude/Relaxed/RObjC.cpp diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp b/Tests/QtAutogen/MocInclude/Relaxed/RObjC.hpp index 5552ede..5552ede 100644 --- a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp +++ b/Tests/QtAutogen/MocInclude/Relaxed/RObjC.hpp diff --git a/Tests/QtAutogen/MocInclude/Relaxed/relaxed.cpp b/Tests/QtAutogen/MocInclude/Relaxed/relaxed.cpp new file mode 100644 index 0000000..5a511b6 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Relaxed/relaxed.cpp @@ -0,0 +1,21 @@ +// AUTOMOC relaxed mode objects +#include "RObjA.hpp" +#include "RObjB.hpp" +#include "RObjC.hpp" + +// Forward declaration +bool commonRelaxed(); + +int main(int argv, char** args) +{ + // Common tests + if (!commonRelaxed()) { + return -1; + } + + // Relaxed tests + RObjA rObjA; + RObjB rObjB; + RObjC rObjC; + return 0; +} 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/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 <QObject> - -// 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 <QObject> - -// 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 <QObject> - -// 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/Strict/CMakeLists.txt b/Tests/QtAutogen/MocInclude/Strict/CMakeLists.txt new file mode 100644 index 0000000..12c503f --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Strict/CMakeLists.txt @@ -0,0 +1,14 @@ +# Disable relaxed mode +set(CMAKE_AUTOMOC_RELAXED_MODE FALSE) + +# Common test +set(COMMON_FUNCTION_NAME commonStrict) +configure_file( + "${COM_DIR}/common.cpp.in" + "${CMAKE_CURRENT_BINARY_DIR}/commonStrict.cpp") + +makeExecutable(libStrict) +target_sources(libStrict PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/commonStrict.cpp" + strict.cpp + ) diff --git a/Tests/QtAutogen/MocInclude/Strict/strict.cpp b/Tests/QtAutogen/MocInclude/Strict/strict.cpp new file mode 100644 index 0000000..dd24bb0 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/Strict/strict.cpp @@ -0,0 +1,7 @@ +// Forward declaration +bool commonStrict(); + +int main(int argv, char** args) +{ + return commonStrict() ? 0 : -1; +} diff --git a/Tests/QtAutogen/MocInclude/main.cpp b/Tests/QtAutogen/MocInclude/main.cpp new file mode 100644 index 0000000..371c5fd --- /dev/null +++ b/Tests/QtAutogen/MocInclude/main.cpp @@ -0,0 +1,9 @@ + +// Forward declaration +bool libStrict(); +bool libRelaxed(); + +int main(int argv, char** args) +{ + return (libStrict() && libRelaxed()) ? 0 : -1; +} diff --git a/Tests/QtAutogen/MocInclude/shared.cmake b/Tests/QtAutogen/MocInclude/shared.cmake deleted file mode 100644 index 2ca2841..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 <QObject> - -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 3231fac..0000000 --- a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef EOBJBEXTRA_P_HPP -#define EOBJBEXTRA_P_HPP - -#include <QObject> - -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 <QObject> - -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 4a43755..0000000 --- a/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GOBJ_P_HPP -#define GOBJ_P_HPP - -#include <QObject> - -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 8b4da34..0000000 --- a/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(MocIncludeRelaxed) -include("../AutogenCoreTest.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 only 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/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 d0aaebf..0000000 --- a/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(MocIncludeStrict) -include("../AutogenCoreTest.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 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" diff --git a/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt new file mode 100644 index 0000000..1627b39 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt @@ -0,0 +1,80 @@ +cmake_minimum_required(VERSION 3.15) +project(MocIncludeSymlink) +include("../AutogenCoreTest.cmake") + +# +# Tests if MocInclude can be build when +# - The source directory is a symbolic link +# - The build directory is a symbolic link +# + +# -- Utility variables +set(CS_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(CB_DIR "${CMAKE_CURRENT_BINARY_DIR}") + +# Absolute MocInclude path +get_filename_component(MocIncludePath "../MocInclude" ABSOLUTE) +message("MocIncludePath: ${MocIncludePath}") + +# Use nested subdirectories to ensure relatives paths are correct as well +set(BUILD_DIR_NORMAL "${CB_DIR}/Build/Normal") +set(BUILD_DIR_LINKED "${CB_DIR}/Build/Linked") + +set(SL_SOURCE_DIR "${CB_DIR}/SL_Source") +set(SL_BUILD_DIR "${CB_DIR}/SL_Build") + +# -- Utility macros +function(makeSymLink origin link) + message("Creating symbolic link\n Link: ${link}\n To: ${origin}") + file(CREATE_LINK ${origin} ${link} RESULT res SYMBOLIC) + if(NOT (${res} STREQUAL "0")) + message("Symlink creation failed.\n Link: ${link}\n To: ${origin}\n Result: ${res}") + endif() +endfunction() + +# -- Make source directory symlink +makeSymLink(${MocIncludePath} ${SL_SOURCE_DIR} linkResult) +if(NOT EXISTS ${SL_SOURCE_DIR}) + message("Directory symlink can't be created. Skipping test.") + return() +endif() + +# -- Make normal build directory +file(REMOVE_RECURSE ${BUILD_DIR_NORMAL}) +file(MAKE_DIRECTORY ${BUILD_DIR_NORMAL}) + +# -- Make linked build directory and symlink +file(REMOVE_RECURSE ${BUILD_DIR_LINKED}) +file(MAKE_DIRECTORY ${BUILD_DIR_LINKED}) +makeSymLink(${BUILD_DIR_LINKED} ${SL_BUILD_DIR} linkResult) +if(NOT EXISTS ${SL_BUILD_DIR}) + message("Directory symlink can't be created. Skipping test.") + return() +endif() + + +# -- Building +macro(buildMocInclude sourceDir binaryDir) + message("Building MocInclude\n - source dir: ${sourceDir}\n - binary dir: ${binaryDir}\n") + try_compile(result + "${binaryDir}" + "${sourceDir}" + MocInclude + CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output + ) + if (result) + message(STATUS "--- Build success. ---") + else() + message(STATUS "\n### Building MocInclude failed. ###\n\n--- Output ---\n${output}") + message(FATAL_ERROR "--- Building MocInclude failed. End of output. ---") + endif() +endmacro() + +message("\nTry building with\n - symbolic link source dir\n - non symbolic build dir\n") +buildMocInclude(${SL_SOURCE_DIR} ${BUILD_DIR_NORMAL}) + +message("\nTry building with\n - symbolic link source dir\n - symbolic link build dir\n") +buildMocInclude(${SL_SOURCE_DIR} ${SL_BUILD_DIR}) diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake index 6771828..2b001d4 100644 --- a/Tests/QtAutogen/Tests.cmake +++ b/Tests/QtAutogen/Tests.cmake @@ -32,8 +32,8 @@ ADD_AUTOGEN_TEST(UicSkipSource) if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocCMP0071) - ADD_AUTOGEN_TEST(MocIncludeRelaxed mocIncludeRelaxed) - ADD_AUTOGEN_TEST(MocIncludeStrict mocIncludeStrict) + ADD_AUTOGEN_TEST(MocInclude) + ADD_AUTOGEN_TEST(MocIncludeSymlink) ADD_AUTOGEN_TEST(MocSkipSource) endif() |