From 7ac10b268c86de90efaa7a4b418cb69259c71fb4 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Fri, 3 Apr 2020 14:18:37 +0200 Subject: [PATCH] Port Qt5Compat to cmake Task-number: QTBUG-80312 Change-Id: I8958d0f91a4129ab23bc8294e58fa862fcdd49ac Reviewed-by: Qt CI Bot Reviewed-by: Alexandru Croitor --- .prev_CMakeLists.txt | 15 ++++++++++++++ CMakeLists.txt | 17 ++++++++++++++++ coin/module_config.yaml | 12 +++++++++++ src/CMakeLists.txt | 3 +++ src/core5/CMakeLists.txt | 20 +++++++++++++++++++ src/core5/core5.pro | 1 + src/core5/doc/src/qtcore5-index.qdoc | 2 +- src/core5/doc/src/qtcore5.qdoc | 2 +- src/core5/qcore5global.h | 8 ++++---- src/core5/qlinkedlist.h | 2 +- tests/CMakeLists.txt | 7 +++++++ tests/auto/.prev_CMakeLists.txt | 4 ++++ tests/auto/CMakeLists.txt | 6 ++++++ tests/auto/cmake/cmake.pro | 2 +- tests/auto/core5/CMakeLists.txt | 3 +++ .../core5/qlinkedlist/.prev_CMakeLists.txt | 17 ++++++++++++++++ tests/auto/core5/qlinkedlist/CMakeLists.txt | 17 ++++++++++++++++ tests/auto/core5/qlinkedlist/qlinkedlist.pro | 2 +- 18 files changed, 131 insertions(+), 9 deletions(-) create mode 100644 .prev_CMakeLists.txt create mode 100644 CMakeLists.txt create mode 100644 coin/module_config.yaml create mode 100644 src/CMakeLists.txt create mode 100644 src/core5/CMakeLists.txt create mode 100644 tests/CMakeLists.txt create mode 100644 tests/auto/.prev_CMakeLists.txt create mode 100644 tests/auto/CMakeLists.txt create mode 100644 tests/auto/core5/CMakeLists.txt create mode 100644 tests/auto/core5/qlinkedlist/.prev_CMakeLists.txt create mode 100644 tests/auto/core5/qlinkedlist/CMakeLists.txt diff --git a/.prev_CMakeLists.txt b/.prev_CMakeLists.txt new file mode 100644 index 0000000..7b78020 --- /dev/null +++ b/.prev_CMakeLists.txt @@ -0,0 +1,15 @@ +# Generated from qt5compat.pro. + +cmake_minimum_required(VERSION 3.15.0) + +project(5compat_FIXME + VERSION 6.0.0 + DESCRIPTION "Qt 5compat_FIXME Libraries" + HOMEPAGE_URL "https://qt.io/" + LANGUAGES CXX C +) + +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core SET_ME_TO_SOMETHING_USEFUL) +find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS SET_ME_TO_SOMETHING_USEFUL) + +qt_build_repo() diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d902e49 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,17 @@ +# Generated from qt5compat.pro. + +cmake_minimum_required(VERSION 3.15.0) + +project(Qt5Compat # special case + VERSION 6.0.0 + DESCRIPTION "Qt 5 Compatibility Libraries" # special case + HOMEPAGE_URL "https://qt.io/" + LANGUAGES CXX C +) + +# special case begin +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) +# find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS SET_ME_TO_SOMETHING_USEFUL) +# special case end + +qt_build_repo() diff --git a/coin/module_config.yaml b/coin/module_config.yaml new file mode 100644 index 0000000..7f31a55 --- /dev/null +++ b/coin/module_config.yaml @@ -0,0 +1,12 @@ +version: 2 +accept_configuration: + condition: property + property: features + not_contains_value: Disable + +instructions: + Build: + - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml" + + Test: + - !include "{{qt/qtbase}}/coin_module_test_template_v2.yaml" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..57b2eb9 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,3 @@ +# Generated from src.pro. + +add_subdirectory(core5) diff --git a/src/core5/CMakeLists.txt b/src/core5/CMakeLists.txt new file mode 100644 index 0000000..7240551 --- /dev/null +++ b/src/core5/CMakeLists.txt @@ -0,0 +1,20 @@ +# Generated from core5.pro. + +##################################################################### +## Core5Compat Module: +##################################################################### + +qt_add_module(Core5Compat + SOURCES + qcore5global.h + qlinkedlist.cpp qlinkedlist.h + PUBLIC_LIBRARIES + Qt::Core +) + +#### Keys ignored in scope 1:.:.:core5.pro:: +# MODULE = "core5compat" +qt_add_docs(Core5Compat + doc/qtcore5.qdocconf +) + diff --git a/src/core5/core5.pro b/src/core5/core5.pro index d2012a7..73e0224 100644 --- a/src/core5/core5.pro +++ b/src/core5/core5.pro @@ -1,5 +1,6 @@ TARGET = QtCore5Compat QT = core +MODULE = core5compat QMAKE_DOCS = $$PWD/doc/qtcore5.qdocconf diff --git a/src/core5/doc/src/qtcore5-index.qdoc b/src/core5/doc/src/qtcore5-index.qdoc index e788c09..c7b9bd6 100644 --- a/src/core5/doc/src/qtcore5-index.qdoc +++ b/src/core5/doc/src/qtcore5-index.qdoc @@ -63,7 +63,7 @@ To link against the module, add this line to your \l qmake \c .pro file: \code - QT += core5 + QT += core5compat \endcode \section1 Related Information diff --git a/src/core5/doc/src/qtcore5.qdoc b/src/core5/doc/src/qtcore5.qdoc index 9617a77..26a2e0c 100644 --- a/src/core5/doc/src/qtcore5.qdoc +++ b/src/core5/doc/src/qtcore5.qdoc @@ -29,7 +29,7 @@ \module QtCore5Compat \title Qt 5 Core Compatibility C++ Classes \ingroup modules - \qtvariable core5 + \qtvariable core5compat \brief Contains the Qt 5 Core APIs removed from Qt 6. diff --git a/src/core5/qcore5global.h b/src/core5/qcore5global.h index 902e165..84d7c80 100644 --- a/src/core5/qcore5global.h +++ b/src/core5/qcore5global.h @@ -45,13 +45,13 @@ QT_BEGIN_NAMESPACE #ifndef QT_STATIC -# if defined(QT_BUILD_CORE5_LIB) -# define Q_CORE5_EXPORT Q_DECL_EXPORT +# if defined(QT_BUILD_CORE5COMPAT_LIB) +# define Q_CORE5COMPAT_EXPORT Q_DECL_EXPORT # else -# define Q_CORE5_EXPORT Q_DECL_IMPORT +# define Q_CORE5COMPAT_EXPORT Q_DECL_IMPORT # endif #else -# define Q_CORE5_EXPORT +# define Q_CORE5COMPAT_EXPORT #endif QT_END_NAMESPACE diff --git a/src/core5/qlinkedlist.h b/src/core5/qlinkedlist.h index 19971b7..c6e93e7 100644 --- a/src/core5/qlinkedlist.h +++ b/src/core5/qlinkedlist.h @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE namespace Qt5 { -struct Q_CORE5_EXPORT QLinkedListData +struct Q_CORE5COMPAT_EXPORT QLinkedListData { QLinkedListData *n, *p; QtPrivate::RefCount ref; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..2214137 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,7 @@ +# Generated from tests.pro. + +if(QT_BUILD_STANDALONE_TESTS) + # Add qt_find_package calls for extra dependencies that need to be found when building + # the standalone tests here. +endif() +qt_build_tests() diff --git a/tests/auto/.prev_CMakeLists.txt b/tests/auto/.prev_CMakeLists.txt new file mode 100644 index 0000000..8862da7 --- /dev/null +++ b/tests/auto/.prev_CMakeLists.txt @@ -0,0 +1,4 @@ +# Generated from auto.pro. + +add_subdirectory(cmake) +add_subdirectory(core5) diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt new file mode 100644 index 0000000..7c62312 --- /dev/null +++ b/tests/auto/CMakeLists.txt @@ -0,0 +1,6 @@ +# Generated from auto.pro. + +# special case begin +# add_subdirectory(cmake) +# special case end +add_subdirectory(core5) diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro index 468189f..96c4779 100644 --- a/tests/auto/cmake/cmake.pro +++ b/tests/auto/cmake/cmake.pro @@ -1,6 +1,6 @@ # Cause make to do nothing. TEMPLATE = subdirs -CMAKE_QT_MODULES_UNDER_TEST = core5 +CMAKE_QT_MODULES_UNDER_TEST = core5compat CONFIG += ctest_testcase diff --git a/tests/auto/core5/CMakeLists.txt b/tests/auto/core5/CMakeLists.txt new file mode 100644 index 0000000..f3dfc39 --- /dev/null +++ b/tests/auto/core5/CMakeLists.txt @@ -0,0 +1,3 @@ +# Generated from core5.pro. + +add_subdirectory(qlinkedlist) diff --git a/tests/auto/core5/qlinkedlist/.prev_CMakeLists.txt b/tests/auto/core5/qlinkedlist/.prev_CMakeLists.txt new file mode 100644 index 0000000..5a8f2e8 --- /dev/null +++ b/tests/auto/core5/qlinkedlist/.prev_CMakeLists.txt @@ -0,0 +1,17 @@ +# Generated from qlinkedlist.pro. + +##################################################################### +## tst_qlinkedlist Test: +##################################################################### + +qt_add_test(tst_qlinkedlist + SOURCES + tst_qlinkedlist.cpp + DEFINES + -QT_NO_JAVA_STYLE_ITERATORS + PUBLIC_LIBRARIES + core5 +) + +## Scopes: +##################################################################### diff --git a/tests/auto/core5/qlinkedlist/CMakeLists.txt b/tests/auto/core5/qlinkedlist/CMakeLists.txt new file mode 100644 index 0000000..d9a5483 --- /dev/null +++ b/tests/auto/core5/qlinkedlist/CMakeLists.txt @@ -0,0 +1,17 @@ +# Generated from qlinkedlist.pro. + +##################################################################### +## tst_qlinkedlist Test: +##################################################################### + +qt_add_test(tst_qlinkedlist + SOURCES + tst_qlinkedlist.cpp + # DEFINES # special case remove + # -QT_NO_JAVA_STYLE_ITERATORS # special case remove until fixed + PUBLIC_LIBRARIES + Qt::Core5Compat +) + +## Scopes: +##################################################################### diff --git a/tests/auto/core5/qlinkedlist/qlinkedlist.pro b/tests/auto/core5/qlinkedlist/qlinkedlist.pro index 4b57033..9e37e62 100644 --- a/tests/auto/core5/qlinkedlist/qlinkedlist.pro +++ b/tests/auto/core5/qlinkedlist/qlinkedlist.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qlinkedlist -QT = core5 core testlib +QT = core5compat core testlib DEFINES -= QT_NO_JAVA_STYLE_ITERATORS qtConfig(c++14): CONFIG += c++14 qtConfig(c++1z): CONFIG += c++1z