-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (88 loc) · 4.26 KB
/
build-qt-windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Windows - Build static Qt 6.3.0 (With SSL)
on:
workflow_dispatch:
env:
qt_ver: 6.3.0
qt_dir: ${{ github.workspace }}/Qt
qt_download_dir: ${{ github.workspace }}/Qt/Download
qt_src_dir: ${{ github.workspace }}/Qt/Source
qt_build_dir: ${{ github.workspace }}/Qt/Build
qt_doc_build_dir: ${{ github.workspace }}/Qt/DocBuild
qt_install_dir: ${{ github.workspace }}/Qt/Install
jobs:
build-qt-source:
name: Build Qt
runs-on: windows-latest
env:
vc_vars: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat
qt_general_build_options: -platform win32-msvc -static -debug-and-release -opensource -confirm-license
qt_specific_build_options: -skip qtwebengine -nomake tests -nomake examples -schannel
steps:
- name: Set derived variables with shell because GitHub Actions env context sucks
run: |
$qt_ver_main=$($Env:qt_ver.split('.')[0] + '.' + $Env:qt_ver.split('.')[1])
$qt_arch_base_name='qt-everywhere-src-${{ env.qt_ver }}'
echo "qt_arch_base_name=$qt_arch_base_name" >> $Env:GITHUB_ENV
echo "qt_src_dest=${{ env.qt_download_dir }}/${qt_arch_base_name}.tar.xz" >> $Env:GITHUB_ENV
echo "qt_src_decomp_dest=${{ env.qt_download_dir }}/${qt_arch_base_name}.tar" >> $Env:GITHUB_ENV
echo "qt_src_url=https://download.qt.io/archive/qt/${qt_ver_main}/${{ env.qt_ver }}/single/${qt_arch_base_name}.tar.xz" >> $Env:GITHUB_ENV
echo "qt_src_cache_key=${{ runner.os }}-qt-${{ env.qt_ver }}-key" >> $Env:GITHUB_ENV
echo "qt_build_artifact_name=qt-build-${{ runner.os }}-${{ env.qt_ver }}-static-ssl-docs" >> $Env:GITHUB_ENV
- name: Download from Qt Archives
run: Invoke-WebRequest -Uri ${{ env.qt_src_url }} -Outfile ( New-Item -Path "${{ env.qt_src_dest }}" -Force )
- name: Decompress source archive
run: 7z x ${{ env.qt_src_dest }} -o${{ env.qt_download_dir }}
- name: Unpack source archive
run: 7z x ${{ env.qt_src_decomp_dest }} -o${{ env.qt_download_dir }}
- name: Move source files to main source directory
run: |
Rename-Item -Path '${{ env.qt_download_dir }}/${{ env.qt_arch_base_name }}' -NewName 'Source'
Move-Item -Path '${{ env.qt_download_dir }}/Source' -Destination '${{ env.qt_dir }}'
- name: Delete download leftovers
run: |
Remove-Item -Path '${{ env.qt_src_dest }}'
Remove-Item -Path '${{ env.qt_src_decomp_dest }}'
- name: Create build directory
run: New-Item -ItemType "directory" -Path "${{ env.qt_build_dir }}"
- name: Build/Install Qt
shell: cmd
working-directory: ${{ env.qt_build_dir }}
run: |
@echo off
echo Setting up VC++ environment...
CALL "%vc_vars%"
echo Adding build binary directory to path...
SET "PATH=%qt_build_dir%\qtbase\bin;%PATH%"
echo Configuring Qt...
CALL %qt_src_dir%\configure -prefix %qt_install_dir% %qt_general_build_options% %qt_specific_build_options%
echo Building Qt...
cmake --build . --parallel
echo Installing Qt...
ninja install
echo Build finished
- name: Build Qt Docs Separately (since only 'release' builds supported)
shell: cmd
working-directory: ${{ env.qt_doc_build_dir }}
env:
qt_doc_build_options: -platform win32-msvc -release -opensource -confirm-license -skip qtwebengine -nomake tests -nomake examples
run: |
@echo off
echo Setting up VC++ environment...
CALL "%vc_vars%"
echo Adding build binary directory to path...
SET "PATH=%qt_doc_build_dir%\qtbase\bin;%PATH%"
echo Configuring Qt for doc build...
CALL %qt_src_dir%\configure %qt_doc_build_options%
echo Building QDoc dependencies...
cmake --build . --target qtbase qtdeclarative qttools --parallel
echo Building Qt docs...
cmake --build . --target qx_docs
echo Build finished
- name: Copy docs into actual build
run: Copy-Item -Path "${{ env.qt_doc_build_dir }}/doc" -Destination "${{ env.qt_doc_install_dir }}/doc" -Recurse
- name: Upload Qt build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.qt_build_artifact_name }}
path: ${{ env.qt_install_dir }}
if-no-files-found: error