From a06962ef934762806649b3d84df1187df725438d Mon Sep 17 00:00:00 2001 From: dlyr Date: Mon, 8 Jul 2024 11:30:06 +0200 Subject: [PATCH] ci --- .github/workflows/push-master-ci.yml | 75 ++++++++++++++++++++++++++++ cmake/findQtPackage.cmake | 26 ++++++---- src/PowerSliderPlugin.cpp | 2 +- 3 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/push-master-ci.yml diff --git a/.github/workflows/push-master-ci.yml b/.github/workflows/push-master-ci.yml new file mode 100644 index 0000000..69bc6a3 --- /dev/null +++ b/.github/workflows/push-master-ci.yml @@ -0,0 +1,75 @@ +name: Master CI + +on: + push: + branches: + - master + + +defaults: + run: + shell: bash + +jobs: + main: + strategy: + fail-fast: false + matrix: + config: + - name: "Windows MSVC" + os: "windows-latest" + cc: "cl.exe" + cxx: "cl.exe" + icon: "Windows" + extra-flags: "" + - name: "Ubuntu gcc" + os: "ubuntu-latest" + cc: "gcc-10" + cxx: "g++-10" + icon: "Linux" + extra-flags: "-DCMAKE_CXX_FLAGS=-Wno-deprecated-declarations" + - name: "MacOS clang" + os: "macos-latest" + cc: "clang" + cxx: "clang++" + icon: "Apple" + extra-flags: "-DCMAKE_CXX_FLAGS=-Wno-deprecated-declarations" + build-type: + - "Release" + qtversion: + - name: "qt5" + value: "5.15.1" + - name: "qt6" + value: "6.2.0" + runs-on: ${{ matrix.os }} + steps: + - name: Install Ninja + shell: bash + run: ${{ runner.os == 'macOS' && 'brew install ninja' || runner.os == 'Windows' && 'choco install ninja' || 'sudo apt-get install ninja-build' }} + - name: Add msbuild to PATH + uses: seanmiddleditch/gha-setup-vsdevenv@master + if: runner.os == 'Windows' + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + cache: true + cache-key-prefix: install-qt-action-${{ matrix.config.name }}-${{ matrix.qtversion.value }} + version: ${{ matrix.qtversion.value }} + - name: Prepare directories + run: | + mkdir -p install/ + mkdir -p master/ + mkdir -p build/ + - name: Checkout remote head + uses: actions/checkout@master + with: + path: master + - name: Configure + run: | + cd master + cmake -B ../build -DCMAKE_INSTALL_PREFIX=../install -GNinja -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \ + -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ + -DCMAKE_EXECUTE_PROCESS_COMMAND_ECHO=STDOUT + - name: Build + run: | + cmake --build build --target install --config ${{ matrix.build-type }} diff --git a/cmake/findQtPackage.cmake b/cmake/findQtPackage.cmake index 17101cd..b76818f 100644 --- a/cmake/findQtPackage.cmake +++ b/cmake/findQtPackage.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.18) # Find Qt5 or Qt6 packages Parameters: COMPONENTS : optional # parameter listing the Qt packages (e.g. Core, Widgets REQUIRED: optional @@ -23,20 +23,24 @@ macro(find_qt_package) set(MY_OPTIONS_COMPONENTS "") endif() - if(NOT QT_DEFAULT_MAJOR_VERSION OR QT_DEFAULT_MAJOR_VERSION STREQUAL "6") + if(${MY_OPTIONS_REQUIRED}) + set(QT_SEARCH_MODE REQUIRED) + else() + set(QT_SEARCH_MODE QUIET) + endif() + + if(QT_DEFAULT_MAJOR_VERSION STREQUAL "6") + find_package(Qt6 COMPONENTS ${MY_OPTIONS_COMPONENTS} ${QT_SEARCH_MODE}) + elseif(QT_DEFAULT_MAJOR_VERSION STREQUAL "5") + find_package(Qt5 5.15 COMPONENTS ${MY_OPTIONS_COMPONENTS} ${QT_SEARCH_MODE}) + else() # QT_DEFAULT_MMAJOR_VERSION not set, first search 6, then 5. find_package( Qt6 COMPONENTS ${MY_OPTIONS_COMPONENTS} QUIET) - endif() - if(NOT Qt6_FOUND) - if(${MY_OPTIONS_REQUIRED}) - find_package( - Qt5 5.15 - COMPONENTS ${MY_OPTIONS_COMPONENTS} - REQUIRED) - else() - find_package(Qt5 5.15 COMPONENTS ${MY_OPTIONS_COMPONENTS}) + if(NOT Qt6_FOUND) + find_package(Qt5 5.15 COMPONENTS ${MY_OPTIONS_COMPONENTS} + ${QT_SEARCH_MODE}) endif() endif() endmacro() diff --git a/src/PowerSliderPlugin.cpp b/src/PowerSliderPlugin.cpp index fe61c78..398cd77 100644 --- a/src/PowerSliderPlugin.cpp +++ b/src/PowerSliderPlugin.cpp @@ -323,5 +323,5 @@ QString PowerSliderPlugin::domXml() const { } QString PowerSliderPlugin::includeFile() const { - return QLatin1String( "PowerSlider.hpp" ); + return QLatin1String( "PowerSlider/PowerSlider.hpp" ); }