migrate to c++20 compiler #836
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build-release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| branches: | |
| - master | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: false | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-2022, macos-15-intel, macos-15, ubuntu-24.04, ubuntu-24.04-arm] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| create-symlink: ${{ runner.os != 'Windows' }} | |
| key: ${{ github.job }}-${{ matrix.os }} | |
| variant: ${{ matrix.compiler == 'msvc' && 'sccache' || 'ccache' }} | |
| - if: runner.os == 'Windows' || runner.os == 'macOS' | |
| uses: lukka/get-cmake@latest | |
| - if: runner.os == 'Windows' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| # Install Dependencies (Ubuntu) | |
| - if: runner.os == 'Linux' | |
| name: Install Packages for Ubuntu | |
| run: | | |
| sudo apt update -qq | |
| sudo apt install -y \ | |
| qt6-base-dev qt6-base-dev-tools libqt6opengl6-dev libqt6websockets6-dev \ | |
| qt6-multimedia-dev libqt6multimedia6 qt6-svg-dev \ | |
| libgl1-mesa-dev qtkeychain-qt6-dev build-essential cmake ninja-build mold git \ | |
| zlib1g-dev libssl-dev | |
| echo "QMAKESPEC=linux-g++" >> $GITHUB_ENV | |
| echo "CC=gcc-12" >> $GITHUB_ENV | |
| echo "CXX=g++-12" >> $GITHUB_ENV | |
| echo "MMAPPER_CMAKE_EXTRA=-DUSE_MOLD=true -DPACKAGE_TYPE=Deb" >> $GITHUB_ENV | |
| # Install Dependencies (Mac) | |
| - if: runner.os == 'macOS' | |
| name: Install Qt for Mac | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: 6.8.3 | |
| arch: clang_64 | |
| cache: true | |
| modules: 'qtwebsockets qtmultimedia' | |
| - if: runner.os == 'macOS' | |
| name: Install Packages for Mac | |
| run: | | |
| echo "MMAPPER_CMAKE_EXTRA=-DCMAKE_PREFIX_PATH=$QT_ROOT_DIR -DPACKAGE_TYPE=Dmg" >> $GITHUB_ENV | |
| # Install Dependencies (Windows) | |
| - if: runner.os == 'Windows' | |
| name: Install Qt for Windows | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: 6.8.3 | |
| dir: 'C:\' | |
| arch: win64_msvc2022_64 | |
| cache: true | |
| modules: 'qtwebsockets qtmultimedia' | |
| # Build | |
| - if: runner.os == 'Windows' | |
| name: Build MMapper for Windows | |
| shell: pwsh | |
| run: | | |
| mkdir ${{ github.workspace }}/artifact | |
| mkdir build | |
| cd build | |
| cmake --version | |
| $packageDir = ($env:GITHUB_WORKSPACE -replace '\\', '/') + "/artifact" | |
| $launcher = ${{ matrix.compiler == 'msvc' && 'sccache' || 'ccache' }} | |
| cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -G 'Ninja' -DCPACK_PACKAGE_DIRECTORY="$packageDir" -DCMAKE_PREFIX_PATH=$env:QT_ROOT_DIR -DWITH_WEBSOCKET=ON -DWITH_QTKEYCHAIN=ON -DPACKAGE_TYPE=Nsis -DCMAKE_C_COMPILER_LAUNCHER="$launcher" -DCMAKE_CXX_COMPILER_LAUNCHER="$launcher" -S .. || exit -1 | |
| cmake --build . --parallel | |
| - if: runner.os == 'Linux' || runner.os == 'macOS' | |
| name: Build MMapper for Linux and Mac | |
| run: | | |
| mkdir -p build ${{ github.workspace }}/artifact | |
| cd build | |
| cmake --version | |
| cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -G 'Ninja' -DCPACK_PACKAGE_DIRECTORY=${{ github.workspace }}/artifact $MMAPPER_CMAKE_EXTRA -DWITH_WEBSOCKET=ON -DWITH_QTKEYCHAIN=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -S .. || exit -1 | |
| cmake --build . --parallel | |
| # Package | |
| - name: Package MMapper | |
| run: cd build && cpack | |
| - if: runner.os == 'Linux' | |
| name: Get Linux package file base name | |
| id: get_linux_package_name | |
| run: | | |
| PACKAGE_FILE=$(ls ${{ github.workspace }}/artifact/*.deb) | |
| PACKAGE_BASENAME=$(basename "$PACKAGE_FILE" | sed 's/\./-/g') | |
| echo "PACKAGE_BASENAME=$PACKAGE_BASENAME" >> $GITHUB_OUTPUT | |
| - if: runner.os == 'macOS' | |
| name: Get Mac package file base name | |
| id: get_mac_package_name | |
| run: | | |
| PACKAGE_FILE=$(ls ${{ github.workspace }}/artifact/*.dmg) | |
| PACKAGE_BASENAME=$(basename "$PACKAGE_FILE" | sed 's/\./-/g') | |
| echo "PACKAGE_BASENAME=$PACKAGE_BASENAME" >> $GITHUB_OUTPUT | |
| - if: runner.os == 'Windows' | |
| name: Get Windows package file base name | |
| id: get_windows_package_name | |
| shell: pwsh | |
| run: | | |
| $packageFile = Get-ChildItem -Path "${{ github.workspace }}/artifact/*.exe" | Select-Object -First 1 | |
| $packageBasename = $packageFile.BaseName -replace '\.', '-' | |
| "PACKAGE_BASENAME=$packageBasename" >> $env:GITHUB_OUTPUT | |
| - if: runner.os == 'macOS' | |
| name: Upload Package for Mac | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: release-${{ steps.get_mac_package_name.outputs.PACKAGE_BASENAME }} | |
| path: ${{ github.workspace }}/artifact/*.dmg* | |
| - if: runner.os == 'Linux' | |
| name: Upload Package for Ubuntu | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: release-${{ steps.get_linux_package_name.outputs.PACKAGE_BASENAME }} | |
| path: ${{ github.workspace }}/artifact/*.deb* | |
| - if: runner.os == 'Windows' | |
| name: Upload Package for Windows | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: release-${{ steps.get_windows_package_name.outputs.PACKAGE_BASENAME }} | |
| path: ${{ github.workspace }}/artifact/*.exe* |