diff --git a/.github/workflows/msvc-qt.yml b/.github/workflows/msvc-qt.yml index 9323d22..f4aa03f 100644 --- a/.github/workflows/msvc-qt.yml +++ b/.github/workflows/msvc-qt.yml @@ -3,29 +3,58 @@ name: msvc-static on: [push, workflow_dispatch] jobs: - msvc_static_qt: - runs-on: windows-2022 + matrix_build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + msvc: [msvc2022, msvc2019] + arch: [win64, win32] + os: [windows-2019, windows-2022] + FEATURE_cxx20: [ON, OFF] + exclude: + - os: windows-2019 + FEATURE_cxx20: ON + - os: windows-2022 + FEATURE_cxx20: OFF + - os: windows-2019 + msvc: msvc2022 + - os: windows-2022 + msvc: msvc2019 steps: - - uses: actions/checkout@v4.2.1 - uses: actions/setup-python@v5.2.0 - with: - python-version: '3.10' - run: python --version - - name: Setup the compiler + - name: Setup the compiler target win64 + if: startsWith(matrix.arch, 'win64') uses: TheMrMilchmann/setup-msvc-dev@v3 with: arch: 'x64' + + - name: Setup the compiler target win32 + if: startsWith(matrix.arch, 'win32') + uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: 'x86' + - name: Install ninja-build tool uses: seanmiddleditch/gha-setup-ninja@v5 + - name: Cache huge Qt repo + id: cache-qt-repo + uses: actions/cache@v4 + with: + path: ${{ runner.workspace }}/qt-source + key: qt-source-6.8.0 + - name: Clone Qt repo and its submodules working-directory: ${{ runner.workspace }} + if: steps.cache-qt-repo.outputs.cache-hit != 'true' run: | # Clone Qt6 repo - git clone https://code.qt.io/qt/qt5.git -b v6.8.0 qt-source + git clone https://github.com/qt/qt5.git -b v6.8.0 --depth 1 qt-source cd qt-source - perl init-repository.pl + perl init-repository.pl --mirror https://github.com/qt/ - name: create build directory working-directory: ${{ runner.workspace }} @@ -35,15 +64,21 @@ jobs: working-directory: ${{ runner.workspace }}/qt-build run: > ..\qt-source\configure.bat -debug-and-release -static -static-runtime -no-pch -optimize-size -platform win32-msvc - -prefix "..\qt6-win64-vc2022-static" -confirm-license + -prefix "..\qt-release" -confirm-license -no-feature-accessibility -no-feature-valgrind - -no-feature-windeployqt -no-feature-appstore-compliant -no-feature-assistant -no-feature-example-hwr - -skip qtopcua,qtgrpc,qt3d - -- -DFEATURE_cxx20=ON + -no-feature-windeployqt + -no-feature-macdeployqt + -no-feature-androiddeployqt + -no-feature-designer + -no-feature-qdbus + -no-feature-qtdiag + -no-feature-qtplugininfo + -skip qtopcua,qtgrpc,qt3d,qtmqtt,qtcoap,qtqa,qtdbus,qtremoteobjects + -- -DFEATURE_cxx20=${{ matrix.FEATURE_cxx20 }} - name: build qt working-directory: ${{ runner.workspace }}/qt-build @@ -53,19 +88,19 @@ jobs: working-directory: ${{ runner.workspace }}/qt-build run: cmake --install . + # Create archive of the pre-built Qt binaries - name: Package binaries - # Create archive of the pre-built Qt binaries - run: 7z a qt6_680_win64_vc2022_static.zip ..\qt6-win64-vc2022-static + run: 7z a qt6_680_${{ matrix.arch }}-${{ matrix.msvc }}_static.zip ..\qt-release - name: Upload zip - uses: actions/upload-artifact@v4.4.2 + uses: actions/upload-artifact@v4.4.3 with: overwrite: true - name: qt6_680_win64_vc2022_static - path: qt6_680_win64_vc2022_static.zip + name: qt6_680_${{ matrix.arch }}-${{ matrix.msvc }}_static + path: qt6_680_${{ matrix.arch }}-${{ matrix.msvc }}_static.zip - name: Release uses: softprops/action-gh-release@v2.0.8 if: startsWith(github.ref, 'refs/tags/') with: - files: qt6_680_win64_vc2022_static.zip + files: qt6_680_${{ matrix.arch }}-${{ matrix.msvc }}_static.zip diff --git a/README.md b/README.md index bd15c17..994f5bf 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # static-build-qt6 -static-build-qt6-msvc-2022 + +a github action script to automatically build static qt library for use with msvc2022