From a5c3d04940f5d4f1ccc502195fc22c95faa240c3 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Sat, 3 Feb 2024 19:38:05 +0100 Subject: [PATCH 1/2] cmake: Only install legacy cmake package with Qt5 builds The Qt version auto-detect package wasn't easy to package. If you want to switch to Qt6, just use the QXmppQt6 package. --- CMakeLists.txt | 40 +++++++++---------- ...ig.cmake.in => QXmppLegacyConfig.cmake.in} | 18 ++------- ...n.cmake => QXmppLegacyConfigVersion.cmake} | 2 +- 3 files changed, 24 insertions(+), 36 deletions(-) rename cmake/{QXmppQtAutoConfig.cmake.in => QXmppLegacyConfig.cmake.in} (55%) rename cmake/{QXmppQtAutoConfigVersion.cmake => QXmppLegacyConfigVersion.cmake} (89%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 642c81a2b..ef46d3501 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,25 +113,6 @@ install( COMPONENT Devel ) -# QXmpp package with Qt version autodetect -configure_package_config_file( - cmake/QXmppQtAutoConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/QXmppConfig.cmake - INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/QXmpp" -) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/QXmppConfig.cmake - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/QXmpp" - COMPONENT Devel -) -install( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/QXmppQtAutoConfigVersion.cmake - RENAME QXmppConfigVersion.cmake - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/QXmpp" - COMPONENT Devel -) - # Generate QXmppQt5/6.pc configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qxmpp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${QXMPP_TARGET}.pc @ONLY) install( @@ -140,8 +121,27 @@ install( COMPONENT Devel ) -# "qxmpp.pc" for backwards-compatibility if(QT_VERSION_MAJOR EQUAL 5) + # "QXmpp" cmake package for backwards-compatibility + configure_package_config_file( + cmake/QXmppLegacyConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/QXmppConfig.cmake + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/QXmpp" + ) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/QXmppConfig.cmake + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/QXmpp" + COMPONENT Devel + ) + install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/QXmppLegacyConfigVersion.cmake + RENAME QXmppConfigVersion.cmake + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/QXmpp" + COMPONENT Devel + ) + + # "qxmpp.pc" for backwards-compatibility configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qxmpp_legacy.pc.in ${CMAKE_CURRENT_BINARY_DIR}/qxmpp.pc @ONLY) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/qxmpp.pc diff --git a/cmake/QXmppQtAutoConfig.cmake.in b/cmake/QXmppLegacyConfig.cmake.in similarity index 55% rename from cmake/QXmppQtAutoConfig.cmake.in rename to cmake/QXmppLegacyConfig.cmake.in index 58c99a965..772018b15 100644 --- a/cmake/QXmppQtAutoConfig.cmake.in +++ b/cmake/QXmppLegacyConfig.cmake.in @@ -4,18 +4,6 @@ @PACKAGE_INIT@ -# Detect Qt version -if(NOT DEFINED QT_VERSION_MAJOR) - if(TARGET Qt6::Core) - set(QT_VERSION_MAJOR 6) - elseif(TARGET Qt5::Core) - set(QT_VERSION_MAJOR 5) - else() - # default to Qt 6 - set(QT_VERSION_MAJOR 6) - endif() -endif() - set(_QXmpp_FIND_PARTS_REQUIRED) if(QXmpp_FIND_REQUIRED) set(_QXmpp_FIND_PARTS_REQUIRED REQUIRED) @@ -25,13 +13,13 @@ if(QXmpp_FIND_QUIETLY) set(_QXmpp_FIND_PARTS_QUIET QUIET) endif() -# Pass through arguments to QXmppQt5/6 +# Pass through arguments to QXmppQt5 include(CMakeFindDependencyMacro) -find_package(QXmppQt${QT_VERSION_MAJOR} +find_package(QXmppQt5 ${QXmpp_FIND_VERSION} ${_QXmpp_FIND_PARTS_REQUIRED} ${_QXmpp_FIND_PARTS_QUIET} COMPONENTS ${QXmpp_FIND_COMPONENTS} ) -set(QXmpp_FOUND ${QXmppQt${QT_VERSION_MAJOR}_FOUND}) +set(QXmpp_FOUND ${QXmppQt5_FOUND}) diff --git a/cmake/QXmppQtAutoConfigVersion.cmake b/cmake/QXmppLegacyConfigVersion.cmake similarity index 89% rename from cmake/QXmppQtAutoConfigVersion.cmake rename to cmake/QXmppLegacyConfigVersion.cmake index 5f2b3f10e..298f6b94e 100644 --- a/cmake/QXmppQtAutoConfigVersion.cmake +++ b/cmake/QXmppLegacyConfigVersion.cmake @@ -3,6 +3,6 @@ # SPDX-License-Identifier: CC0-1.0 set(PACKAGE_VERSION "") -# Allow all requested versions here, the actual check is going to be done in QXmppQt5/6. +# Allow all requested versions here, the actual check is going to be done in QXmppQt5. set(PACKAGE_VERSION_COMPATIBLE TRUE) From d62fec5bd01df5f517548d8884a632f50fed7071 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Sat, 3 Feb 2024 20:00:05 +0100 Subject: [PATCH 2/2] ci: Do not try to build with OMEMO on macOS Currently the builds are just failing. --- .github/workflows/push-docs.yml | 2 +- .github/workflows/tests.yml | 4 +- tests/travis/build-and-test | 6 +- tests/travis/install-build-depends | 68 ----------------------- tests/travis/install-build-depends-debian | 46 +++++++++++++++ tests/travis/install-build-depends-macos | 20 +++++++ 6 files changed, 73 insertions(+), 73 deletions(-) delete mode 100755 tests/travis/install-build-depends create mode 100755 tests/travis/install-build-depends-debian create mode 100755 tests/travis/install-build-depends-macos diff --git a/.github/workflows/push-docs.yml b/.github/workflows/push-docs.yml index 6f2d8c13f..ead16c5ba 100644 --- a/.github/workflows/push-docs.yml +++ b/.github/workflows/push-docs.yml @@ -21,7 +21,7 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v3 - name: Install extra packages - run: tests/travis/install-build-depends + run: tests/travis/install-build-depends-debian - name: Update XEP metadata run: doc/doap-rendering/update-xeplist.sh - name: Build documentation diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 76a333ff2..c1e05de9a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,7 @@ jobs: version: ${{ matrix.qt_version }} setup-python: true - name: Install extra packages - run: tests/travis/install-build-depends + run: tests/travis/install-build-depends-debian - name: Run tests run: tests/travis/build-and-test - uses: codecov/codecov-action@v1 @@ -64,7 +64,7 @@ jobs: version: ${{ matrix.qt_version }} setup-python: false - name: Install extra packages - run: tests/travis/install-build-depends + run: tests/travis/install-build-depends-macos - name: Disable OS X firewall run: | sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off diff --git a/tests/travis/build-and-test b/tests/travis/build-and-test index d7d4affd4..c815814fc 100755 --- a/tests/travis/build-and-test +++ b/tests/travis/build-and-test @@ -15,8 +15,10 @@ full*) CMAKE_ARGS="-DBUILD_DOCUMENTATION:BOOL=True -DBUILD_EXAMPLES:BOOL=True -DWITH_GSTREAMER:BOOL=True" case "$QT_VERSION" in 5.15* | 6*) - # Enable OMEMO - CMAKE_ARGS="$CMAKE_ARGS -DBUILD_OMEMO=ON" + if [ $HOST_SYSTEM = "Linux" ]; then + # Enable OMEMO + CMAKE_ARGS="$CMAKE_ARGS -DBUILD_OMEMO=ON" + fi ;; esac ;; diff --git a/tests/travis/install-build-depends b/tests/travis/install-build-depends deleted file mode 100755 index ca4d6adb0..000000000 --- a/tests/travis/install-build-depends +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# SPDX-FileCopyrightText: 2014 Boris Pek -# SPDX-FileCopyrightText: 2018 Jeremy Lainé -# -# SPDX-License-Identifier: CC0-1.0 - -set -e - -install_cmake() { - NAME=$1 - URL=$2 - OPTS=$3 - CURRENT_DIR=$(pwd) - - cd - git clone $URL $NAME - mkdir -p $NAME-build - cmake $NAME -B./$NAME-build/ -DCMAKE_BUILD_TYPE=Release $OPTS - cmake --build $NAME-build --parallel - sudo cmake --build $NAME-build --target install - - cd $CURRENT_DIR -} - -if [ "$(uname -s)" = "Darwin" ]; then - brew update - brew unlink python@3 - brew install python@3 || true - brew link --overwrite python@3 - - case "$CONFIG" in - full*) - brew install doxygen \ - gstreamer gst-plugins-base gst-plugins-good gst-plugins-ugly - ;; - esac -else - sudo apt-get update -qq - sudo apt-get install -qq clang cmake git - - case "$CONFIG" in - full*) - sudo apt-get install -qq \ - doxygen graphviz \ - libgstreamer1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly \ - libprotobuf-c-dev \ - libssl-dev - ;; - esac -fi - -case "$CONFIG" in -full*) - # Enable OMEMO for Qt > 5.15 (including Qt 6) - # Build and install qca and libomemo-c - case "$QT_VERSION" in - 5.15*) - install_cmake libomemo-c https://github.com/dino/libomemo-c "-DBUILD_SHARED_LIBS=ON" - install_cmake qca https://invent.kde.org/libraries/qca "-DBUILD_TESTS=OFF -DBUILD_TOOLS=OFF -DBUILD_WITH_QT6=OFF" - ;; - 6*) - install_cmake libomemo-c https://github.com/dino/libomemo-c "-DBUILD_SHARED_LIBS=ON" - install_cmake qca https://invent.kde.org/libraries/qca "-DBUILD_TESTS=OFF -DBUILD_TOOLS=OFF -DBUILD_WITH_QT6=ON" - ;; - esac - ;; -esac diff --git a/tests/travis/install-build-depends-debian b/tests/travis/install-build-depends-debian new file mode 100755 index 000000000..aefaa0538 --- /dev/null +++ b/tests/travis/install-build-depends-debian @@ -0,0 +1,46 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2014 Boris Pek +# SPDX-FileCopyrightText: 2018 Jeremy Lainé +# +# SPDX-License-Identifier: CC0-1.0 + +set -e + +install_cmake() { + NAME=$1 + URL=$2 + OPTS=$3 + CURRENT_DIR=$(pwd) + + cd + git clone $URL $NAME + mkdir -p $NAME-build + cmake $NAME -B./$NAME-build/ -DCMAKE_BUILD_TYPE=Release $OPTS + cmake --build $NAME-build --parallel + sudo cmake --build $NAME-build --target install + + cd $CURRENT_DIR +} + +sudo apt-get update -qq +sudo apt-get install -qq clang cmake git + +case "$CONFIG" in +full*) + sudo apt-get install -qq \ + doxygen graphviz \ + libgstreamer1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly \ + libprotobuf-c-dev \ + libssl-dev + + # Enable OMEMO for Qt > 5.15 (including Qt 6) + # Build and install qca and libomemo-c + case "$QT_VERSION" in + 5.15* | 6) + install_cmake libomemo-c https://github.com/dino/libomemo-c "-DBUILD_SHARED_LIBS=ON" + install_cmake qca https://invent.kde.org/libraries/qca "-DBUILD_TESTS=OFF -DBUILD_TOOLS=OFF -DBUILD_WITH_QT6=OFF" + ;; + esac + ;; +esac diff --git a/tests/travis/install-build-depends-macos b/tests/travis/install-build-depends-macos new file mode 100755 index 000000000..a41a74962 --- /dev/null +++ b/tests/travis/install-build-depends-macos @@ -0,0 +1,20 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2014 Boris Pek +# SPDX-FileCopyrightText: 2018 Jeremy Lainé +# +# SPDX-License-Identifier: CC0-1.0 + +set -e + +brew update +brew unlink python@3 +brew install python@3 || true +brew link --overwrite python@3 + +case "$CONFIG" in +full*) + brew install doxygen \ + gstreamer gst-plugins-base gst-plugins-good gst-plugins-ugly + ;; +esac