From 6ce6fd426ee7649a40c2f253dbc5f814650f0992 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 20:22:27 +0100 Subject: Autogen: Tests: Separate StaticLibraryCycle test --- Tests/QtAutogen/CMakeLists.txt | 4 ---- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt | 20 ++++++++++++++++++++ Tests/QtAutogen/StaticLibraryCycle/a.cpp | 12 ++++++++++++ Tests/QtAutogen/StaticLibraryCycle/a.h | 15 +++++++++++++++ Tests/QtAutogen/StaticLibraryCycle/b.cpp | 7 +++++++ Tests/QtAutogen/StaticLibraryCycle/b.h | 13 +++++++++++++ Tests/QtAutogen/StaticLibraryCycle/c.cpp | 7 +++++++ Tests/QtAutogen/StaticLibraryCycle/c.h | 13 +++++++++++++ Tests/QtAutogen/StaticLibraryCycle/main.cpp | 8 ++++++++ Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt | 17 ----------------- Tests/QtAutogen/staticLibraryCycle/a.cpp | 7 ------- Tests/QtAutogen/staticLibraryCycle/a.h | 13 ------------- Tests/QtAutogen/staticLibraryCycle/b.cpp | 7 ------- Tests/QtAutogen/staticLibraryCycle/b.h | 13 ------------- Tests/QtAutogen/staticLibraryCycle/c.cpp | 7 ------- Tests/QtAutogen/staticLibraryCycle/c.h | 13 ------------- Tests/QtAutogen/staticLibraryCycle/main.cpp | 8 -------- 18 files changed, 96 insertions(+), 89 deletions(-) create mode 100644 Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt create mode 100644 Tests/QtAutogen/StaticLibraryCycle/a.cpp create mode 100644 Tests/QtAutogen/StaticLibraryCycle/a.h create mode 100644 Tests/QtAutogen/StaticLibraryCycle/b.cpp create mode 100644 Tests/QtAutogen/StaticLibraryCycle/b.h create mode 100644 Tests/QtAutogen/StaticLibraryCycle/c.cpp create mode 100644 Tests/QtAutogen/StaticLibraryCycle/c.h create mode 100644 Tests/QtAutogen/StaticLibraryCycle/main.cpp delete mode 100644 Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt delete mode 100644 Tests/QtAutogen/staticLibraryCycle/a.cpp delete mode 100644 Tests/QtAutogen/staticLibraryCycle/a.h delete mode 100644 Tests/QtAutogen/staticLibraryCycle/b.cpp delete mode 100644 Tests/QtAutogen/staticLibraryCycle/b.h delete mode 100644 Tests/QtAutogen/staticLibraryCycle/c.cpp delete mode 100644 Tests/QtAutogen/staticLibraryCycle/c.h delete mode 100644 Tests/QtAutogen/staticLibraryCycle/main.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 47164d2..833f64e 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,9 +60,5 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Tests static library cycles -add_subdirectory(staticLibraryCycle) - -# -- Test # Complex test case add_subdirectory(complex) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 7f72386..29bc4af 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -29,3 +29,4 @@ if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) ADD_AUTOGEN_TEST(MacOsFW) endif() ADD_AUTOGEN_TEST(SameName sameName) +ADD_AUTOGEN_TEST(StaticLibraryCycle slc) diff --git a/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt b/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt new file mode 100644 index 0000000..0c2f987 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.10) +project(StaticLibraryCycle) +include("../AutogenTest.cmake") + +# Test AUTOMOC on cyclic static libraries + +set(CMAKE_AUTOMOC ON) + +# Cyclic static libraries +add_library(slc_a STATIC a.cpp) +target_link_libraries(slc_a ${QT_LIBRARIES} slc_b) + +add_library(slc_b STATIC b.cpp) +target_link_libraries(slc_b ${QT_LIBRARIES} slc_c) + +add_library(slc_c STATIC c.cpp) +target_link_libraries(slc_c ${QT_LIBRARIES} slc_a) + +add_executable(slc main.cpp) +target_link_libraries(slc ${QT_LIBRARIES} slc_a) diff --git a/Tests/QtAutogen/StaticLibraryCycle/a.cpp b/Tests/QtAutogen/StaticLibraryCycle/a.cpp new file mode 100644 index 0000000..faa52e6 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/a.cpp @@ -0,0 +1,12 @@ +#include "a.h" +#include "b.h" + +bool A::recursed = false; + +A::A() +{ + if (!A::recursed) { + A::recursed = true; + B b; + } +} diff --git a/Tests/QtAutogen/StaticLibraryCycle/a.h b/Tests/QtAutogen/StaticLibraryCycle/a.h new file mode 100644 index 0000000..f24398e --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/a.h @@ -0,0 +1,15 @@ +#ifndef CLASSA_HPP +#define CLASSA_HPP + +#include + +class A : public QObject +{ + Q_OBJECT + static bool recursed; + +public: + A(); +}; + +#endif diff --git a/Tests/QtAutogen/StaticLibraryCycle/b.cpp b/Tests/QtAutogen/StaticLibraryCycle/b.cpp new file mode 100644 index 0000000..a807d89 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/b.cpp @@ -0,0 +1,7 @@ +#include "b.h" +#include "c.h" + +B::B() +{ + C c; +} diff --git a/Tests/QtAutogen/StaticLibraryCycle/b.h b/Tests/QtAutogen/StaticLibraryCycle/b.h new file mode 100644 index 0000000..ededbd8 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/b.h @@ -0,0 +1,13 @@ +#ifndef CLASSB_HPP +#define CLASSB_HPP + +#include + +class B : public QObject +{ + Q_OBJECT +public: + B(); +}; + +#endif diff --git a/Tests/QtAutogen/StaticLibraryCycle/c.cpp b/Tests/QtAutogen/StaticLibraryCycle/c.cpp new file mode 100644 index 0000000..7d427c2 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/c.cpp @@ -0,0 +1,7 @@ +#include "c.h" +#include "a.h" + +C::C() +{ + A a; +} diff --git a/Tests/QtAutogen/StaticLibraryCycle/c.h b/Tests/QtAutogen/StaticLibraryCycle/c.h new file mode 100644 index 0000000..20f3725 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/c.h @@ -0,0 +1,13 @@ +#ifndef CLASSC_HPP +#define CLASSC_HPP + +#include + +class C : public QObject +{ + Q_OBJECT +public: + C(); +}; + +#endif diff --git a/Tests/QtAutogen/StaticLibraryCycle/main.cpp b/Tests/QtAutogen/StaticLibraryCycle/main.cpp new file mode 100644 index 0000000..f5b7fd2 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/main.cpp @@ -0,0 +1,8 @@ +#include "a.h" + +int main(int argv, char** args) +{ + // Object instances + A a; + return 0; +} diff --git a/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt b/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt deleted file mode 100644 index 144a435..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Test AUTOMOC and AUTORCC on source files with the same name -# but in different subdirectories - -set(CMAKE_AUTOMOC ON) - -# Cyclic static libraries -add_library(slc_a STATIC a.cpp) -target_link_libraries(slc_a ${QT_LIBRARIES} slc_b) - -add_library(slc_b STATIC b.cpp) -target_link_libraries(slc_b ${QT_LIBRARIES} slc_c) - -add_library(slc_c STATIC c.cpp) -target_link_libraries(slc_c ${QT_LIBRARIES} slc_a) - -add_executable(slc main.cpp) -target_link_libraries(slc ${QT_LIBRARIES} slc_a) diff --git a/Tests/QtAutogen/staticLibraryCycle/a.cpp b/Tests/QtAutogen/staticLibraryCycle/a.cpp deleted file mode 100644 index 97cc66e..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/a.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "a.h" -#include "b.h" - -A::A() -{ - B b; -} diff --git a/Tests/QtAutogen/staticLibraryCycle/a.h b/Tests/QtAutogen/staticLibraryCycle/a.h deleted file mode 100644 index 7176170..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/a.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef CLASSA_HPP -#define CLASSA_HPP - -#include - -class A : public QObject -{ - Q_OBJECT -public: - A(); -}; - -#endif diff --git a/Tests/QtAutogen/staticLibraryCycle/b.cpp b/Tests/QtAutogen/staticLibraryCycle/b.cpp deleted file mode 100644 index a807d89..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/b.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "b.h" -#include "c.h" - -B::B() -{ - C c; -} diff --git a/Tests/QtAutogen/staticLibraryCycle/b.h b/Tests/QtAutogen/staticLibraryCycle/b.h deleted file mode 100644 index ededbd8..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/b.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef CLASSB_HPP -#define CLASSB_HPP - -#include - -class B : public QObject -{ - Q_OBJECT -public: - B(); -}; - -#endif diff --git a/Tests/QtAutogen/staticLibraryCycle/c.cpp b/Tests/QtAutogen/staticLibraryCycle/c.cpp deleted file mode 100644 index 7d427c2..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/c.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "c.h" -#include "a.h" - -C::C() -{ - A a; -} diff --git a/Tests/QtAutogen/staticLibraryCycle/c.h b/Tests/QtAutogen/staticLibraryCycle/c.h deleted file mode 100644 index 20f3725..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/c.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef CLASSC_HPP -#define CLASSC_HPP - -#include - -class C : public QObject -{ - Q_OBJECT -public: - C(); -}; - -#endif diff --git a/Tests/QtAutogen/staticLibraryCycle/main.cpp b/Tests/QtAutogen/staticLibraryCycle/main.cpp deleted file mode 100644 index f5b7fd2..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/main.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "a.h" - -int main(int argv, char** args) -{ - // Object instances - A a; - return 0; -} -- cgit v0.12