From ba6f4ea0f997a6f1a77295888cfec975a1a02944 Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 27 Nov 2020 16:52:16 +0100 Subject: qtx11extras: add CMake build system The coin subdir comes from qtsvg. The dependencies.yaml was inspired by the one in qttools. Change-Id: I3ba6f29641f5e27085920641693ab499184ed8fe Reviewed-by: Qt CI Bot Reviewed-by: David Faure --- .cmake.conf | 1 + .prev_CMakeLists.txt | 20 ++++++++++++++++++++ CMakeLists.txt | 29 +++++++++++++++++++++++++++++ coin/module_config.yaml | 32 ++++++++++++++++++++++++++++++++ dependencies.yaml | 2 +- src/.prev_CMakeLists.txt | 5 +++++ src/CMakeLists.txt | 10 ++++++++++ src/x11extras/CMakeLists.txt | 22 ++++++++++++++++++++++ src/x11extras/qx11info_x11.cpp | 5 +++-- tests/.prev_CMakeLists.txt | 7 +++++++ tests/CMakeLists.txt | 12 ++++++++++++ tests/auto/.prev_CMakeLists.txt | 6 ++++++ tests/auto/CMakeLists.txt | 6 ++++++ tests/auto/qx11info/.prev_CMakeLists.txt | 15 +++++++++++++++ tests/auto/qx11info/CMakeLists.txt | 15 +++++++++++++++ tests/auto/qx11info/tst_qx11info.cpp | 2 +- tests/manual/CMakeLists.txt | 3 +++ tests/manual/peeker/CMakeLists.txt | 17 +++++++++++++++++ 18 files changed, 205 insertions(+), 4 deletions(-) create mode 100644 .cmake.conf create mode 100644 .prev_CMakeLists.txt create mode 100644 CMakeLists.txt create mode 100644 coin/module_config.yaml create mode 100644 src/.prev_CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/x11extras/CMakeLists.txt create mode 100644 tests/.prev_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/qx11info/.prev_CMakeLists.txt create mode 100644 tests/auto/qx11info/CMakeLists.txt create mode 100644 tests/manual/CMakeLists.txt create mode 100644 tests/manual/peeker/CMakeLists.txt diff --git a/.cmake.conf b/.cmake.conf new file mode 100644 index 0000000..9305480 --- /dev/null +++ b/.cmake.conf @@ -0,0 +1 @@ +set(QT_REPO_MODULE_VERSION "6.0.0") diff --git a/.prev_CMakeLists.txt b/.prev_CMakeLists.txt new file mode 100644 index 0000000..895e01a --- /dev/null +++ b/.prev_CMakeLists.txt @@ -0,0 +1,20 @@ +# Generated from qtx11extras.pro. + +cmake_minimum_required(VERSION 3.15.0) + +include(.cmake.conf) +project(QtX11Extras + VERSION "${QT_REPO_MODULE_VERSION}" + DESCRIPTION "Qt X11Extras 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) + +if(NOT TARGET Qt::Gui) + message(NOTICE "Skipping the build as the condition \"TARGET Qt::Gui\" is not met.") + return() +endif() +qt_build_repo() diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ccb1f5e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,29 @@ +# Generated from qtx11extras.pro. + +cmake_minimum_required(VERSION 3.15.0) + +include(.cmake.conf) +project(QtX11Extras + VERSION "${QT_REPO_MODULE_VERSION}" + DESCRIPTION "Qt X11 Extras" # special case + HOMEPAGE_URL "https://qt.io/" + LANGUAGES CXX C +) + +# special case begin +# Make sure we only use latest private CMake API, aka no compatibility wrappers. +set(QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS TRUE) +# special case end + +# special case begin +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) +find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS Gui Widgets) + +if(NOT TARGET Qt::Gui) + message(NOTICE "Skipping the build as the condition \"TARGET Qt::Gui\" is not met.") + return() +endif() +# special case end + +qt_build_repo() + diff --git a/coin/module_config.yaml b/coin/module_config.yaml new file mode 100644 index 0000000..7e8d65e --- /dev/null +++ b/coin/module_config.yaml @@ -0,0 +1,32 @@ +version: 2 +accept_configuration: + condition: property + property: features + not_contains_value: Disable + +instructions: + Build: + - type: Group + instructions: + - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml" + enable_if: + condition: property + property: host.os + equals_value: Linux + + Test: + - type: Group + instructions: + - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml" + enable_if: + condition: and + conditions: + - condition: property + property: host.os + equals_value: Linux + - condition: property + property: host.os + equals_property: target.os + - condition: property + property: target.osVersion + not_equals_value: QEMU diff --git a/dependencies.yaml b/dependencies.yaml index d4a3528..0fda16c 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,4 +1,4 @@ dependencies: ../qtbase: - ref: 5d6705c567e73b943bc8f67eb049ce3fa2ba1b74 + ref: 130b2090147e0d28e35fd736fbefcd588c0014f6 required: true diff --git a/src/.prev_CMakeLists.txt b/src/.prev_CMakeLists.txt new file mode 100644 index 0000000..0229ac5 --- /dev/null +++ b/src/.prev_CMakeLists.txt @@ -0,0 +1,5 @@ +# Generated from src.pro. + +if(QT_FEATURE_xcb) + add_subdirectory(x11extras) +endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..881b22e --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from src.pro. + +if(QT_FEATURE_xcb) + # special case begin + if(NOT TARGET XCB::XCB) + qt_find_package(XCB REQUIRED PROVIDED_TARGETS XCB::XCB) + endif() + # special case end + add_subdirectory(x11extras) +endif() diff --git a/src/x11extras/CMakeLists.txt b/src/x11extras/CMakeLists.txt new file mode 100644 index 0000000..32d2445 --- /dev/null +++ b/src/x11extras/CMakeLists.txt @@ -0,0 +1,22 @@ +# Generated from x11extras.pro. + +##################################################################### +## X11Extras Module: +##################################################################### + +qt_internal_add_module(X11Extras + SOURCES + qx11info_x11.cpp qx11info_x11.h + DEFINES + QT_NO_USING_NAMESPACE + LIBRARIES + Qt::GuiPrivate + XCB::XCB_nolink + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui +) +qt_internal_add_docs(X11Extras + doc/qtx11extras.qdocconf +) + diff --git a/src/x11extras/qx11info_x11.cpp b/src/x11extras/qx11info_x11.cpp index ff972ac..7615657 100644 --- a/src/x11extras/qx11info_x11.cpp +++ b/src/x11extras/qx11info_x11.cpp @@ -49,7 +49,7 @@ #include #include -#include +#include #include #include #include @@ -62,7 +62,8 @@ static QScreen *findScreenForVirtualDesktop(int virtualDesktopNumber) { const auto screens = QGuiApplication::screens(); for (QScreen *screen : screens) { - if (QXcbScreenFunctions::virtualDesktopNumber(screen) == virtualDesktopNumber) + auto *qxcbScreen = dynamic_cast(screen); + if (qxcbScreen->virtualDesktopNumber() == virtualDesktopNumber) return screen; } return nullptr; diff --git a/tests/.prev_CMakeLists.txt b/tests/.prev_CMakeLists.txt new file mode 100644 index 0000000..2214137 --- /dev/null +++ b/tests/.prev_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/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..bad475b --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,12 @@ +# 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. + # special case begin + if(NOT TARGET XCB::XCB) + qt_find_package(XCB REQUIRED PROVIDED_TARGETS XCB::XCB) + endif() + # special case end +endif() +qt_build_tests() diff --git a/tests/auto/.prev_CMakeLists.txt b/tests/auto/.prev_CMakeLists.txt new file mode 100644 index 0000000..b694a81 --- /dev/null +++ b/tests/auto/.prev_CMakeLists.txt @@ -0,0 +1,6 @@ +# Generated from auto.pro. + +add_subdirectory(cmake) +if(TARGET Qt::Widgets) + add_subdirectory(qx11info) +endif() diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt new file mode 100644 index 0000000..e581e78 --- /dev/null +++ b/tests/auto/CMakeLists.txt @@ -0,0 +1,6 @@ +# Generated from auto.pro. + +# add_subdirectory(cmake) # special case remove +if(TARGET Qt::Widgets) + add_subdirectory(qx11info) +endif() diff --git a/tests/auto/qx11info/.prev_CMakeLists.txt b/tests/auto/qx11info/.prev_CMakeLists.txt new file mode 100644 index 0000000..0e60be4 --- /dev/null +++ b/tests/auto/qx11info/.prev_CMakeLists.txt @@ -0,0 +1,15 @@ +# Generated from qx11info.pro. + +##################################################################### +## tst_qx11info Test: +##################################################################### + +qt_internal_add_test(tst_qx11info + SOURCES + tst_qx11info.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::Widgets + Qt::X11Extras + XCB::XCB +) diff --git a/tests/auto/qx11info/CMakeLists.txt b/tests/auto/qx11info/CMakeLists.txt new file mode 100644 index 0000000..0e60be4 --- /dev/null +++ b/tests/auto/qx11info/CMakeLists.txt @@ -0,0 +1,15 @@ +# Generated from qx11info.pro. + +##################################################################### +## tst_qx11info Test: +##################################################################### + +qt_internal_add_test(tst_qx11info + SOURCES + tst_qx11info.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::Widgets + Qt::X11Extras + XCB::XCB +) diff --git a/tests/auto/qx11info/tst_qx11info.cpp b/tests/auto/qx11info/tst_qx11info.cpp index e997832..b4207c1 100644 --- a/tests/auto/qx11info/tst_qx11info.cpp +++ b/tests/auto/qx11info/tst_qx11info.cpp @@ -244,7 +244,7 @@ protected: return false; } - void exposeEvent(QExposeEvent *) + void exposeEvent(QExposeEvent *) override { if (m_ignoreSubsequentExpose) return; diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt new file mode 100644 index 0000000..98adde5 --- /dev/null +++ b/tests/manual/CMakeLists.txt @@ -0,0 +1,3 @@ +# Generated from manual.pro. + +add_subdirectory(peeker) diff --git a/tests/manual/peeker/CMakeLists.txt b/tests/manual/peeker/CMakeLists.txt new file mode 100644 index 0000000..555c636 --- /dev/null +++ b/tests/manual/peeker/CMakeLists.txt @@ -0,0 +1,17 @@ +# Generated from peeker.pro. + +##################################################################### +## peeker Binary: +##################################################################### + +qt_internal_add_manual_test(peeker + GUI + SOURCES + main.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::X11Extras +) + +#### Keys ignored in scope 1:.:.:peeker.pro:: +# TEMPLATE = "app" -- cgit v1.2.1