Skip to content

build qt with vs2026 #108

build qt with vs2026

build qt with vs2026 #108

Workflow file for this run

name: msvc-static
on: [push, workflow_dispatch]
jobs:
matrix_build:
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
arch: [win64]
buildtype: [debug-and-release, release]
qtversion: [6.10.1]
steps:
- name: setup release or debug build arguments
id: cfgvar
shell: bash
run: |
if [[ "${{matrix.buildtype}}" = "debug-and-release" ]] ; then
echo "buildarg=-debug-and-release" >> "$GITHUB_OUTPUT"
echo zip_file_name=qt${{matrix.qtversion}}_${{ matrix.arch }}-msvc2026_dll-${{ matrix.buildtype }}.zip >> "$GITHUB_OUTPUT"
else
echo "buildarg=-static -static-runtime -release -no-pch -optimize-size" >> "$GITHUB_OUTPUT"
echo zip_file_name=qt${{matrix.qtversion}}_${{ matrix.arch }}-msvc2026_static-release.zip >> "$GITHUB_OUTPUT"
fi
if [[ "${{matrix.arch}}" = "win32" ]] ; then
echo "clarch=amd64_x86" >> "$GITHUB_OUTPUT"
else
echo "clarch=x64" >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- run: python --version
- name: Install Visual Studio 2026 Build Tools
shell: pwsh
run: |
Write-Host "Installing VS 2026 Build Tools..."
choco install visualstudio2026buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --includeRecommended --quiet" -y --ignore-package-exit-codes=3010
Write-Host "VS 2026 Build Tools installation completed"
- name: Setup the compiler
uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: ${{steps.cfgvar.outputs.clarch}}
- name: Cache huge Qt repo
id: cache-qt-repo
uses: actions/cache@v4
with:
path: ${{ runner.workspace }}/qt-source
key: qt-source-${{matrix.qtversion}}
- name: Clone Qt repo and its submodules
if: steps.cache-qt-repo.outputs.cache-hit != 'true'
working-directory: ${{ runner.workspace }}
run: |
# Clone Qt6 repo
git clone git://code.qt.io/qt/qt5.git -b ${{matrix.qtversion}} --depth 1 qt-source
cd qt-source
git apply ${{ github.workspace }}/0001-shadow-clone-for-submodules.patch
perl init-repository.pl --shallow
- name: create build directory
working-directory: ${{ runner.workspace }}
run: mkdir qt-build
- name: configure Qt for static build
working-directory: ${{ runner.workspace }}/qt-build
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\Common7\Tools\VsDevCmd.bat" -arch=amd64
..\qt-source\configure.bat ${{ steps.cfgvar.outputs.buildarg }} -platform win32-msvc -prefix "..\qt-release" -confirm-license -no-feature-accessibility -no-feature-valgrind -no-feature-appstore-compliant -no-feature-assistant -no-feature-example-hwr -no-feature-windeployqt -no-feature-macdeployqt -no-feature-androiddeployqt -no-feature-qdbus -no-feature-qtdiag -no-feature-qtplugininfo -skip qtquick3dphysics,qtgraphs,qtquick3d,qtopcua,qtgrpc,qt3d,qtcanvas3d,qtdatavis3d,qtgamepad,qtcharts,qtconnectivity,qtmqtt,qtcoap,qtqa,qtdbus,qtremoteobjects,qtpim,qtspeech,qtfeedback,qtactiveqt,qtserialbus,tests -- -DFEATURE_cxx20=ON
- name: build qt
working-directory: ${{ runner.workspace }}/qt-build
run: cmake --build . --parallel 4
- name: install release qt to temp dir
working-directory: ${{ runner.workspace }}/qt-build
if: startsWith(matrix.buildtype, 'release')
run: ninja install
- name: install debug and release qt to temp dir
working-directory: ${{ runner.workspace }}/qt-build
if: startsWith(matrix.buildtype, 'debug-and-release')
run: |
ninja install:Debug
ninja install:Release
# Create archive of the pre-built Qt binaries
- name: Package binaries
working-directory: ${{ runner.workspace }}/qt-release
run: 7z a ${{ github.workspace }}\\${{ steps.cfgvar.outputs.zip_file_name }} .
- name: Release
uses: softprops/action-gh-release@v2.4.2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ steps.cfgvar.outputs.zip_file_name }}
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
overwrite: true
name: ${{ steps.cfgvar.outputs.zip_file_name }}
path: ${{ runner.workspace }}/qt-release