-
Notifications
You must be signed in to change notification settings - Fork 189
134 lines (118 loc) · 4.7 KB
/
Copy pathbuild.yml
File metadata and controls
134 lines (118 loc) · 4.7 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
compiler: [msvc, gcc, clang]
qt_version: [qt5, qt6]
exclude:
- os: ubuntu-latest
compiler: msvc
- os: macos-latest
compiler: gcc
- os: macos-latest
compiler: msvc
- os: windows-latest
compiler: clang
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup CMake and Ninja
uses: lukka/get-cmake@latest
- if: matrix.compiler == 'msvc'
uses: ilammy/msvc-dev-cmd@v1
- name: Install Dependencies (Windows only)
if: runner.os == 'Windows'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install pkgconfiglite
- name: Install Qt (Mac/Linux only)
if: runner.os != 'Windows'
run: |
if [ '${{ runner.os }}' == 'macOS' ]; then
if [ '${{ matrix.qt_version }}' == 'qt6' ]; then
brew install qt6 pkg-config
brew link qt6 --force
echo "$(brew --prefix qt6)/bin" >> $GITHUB_PATH
else
brew install qt5 pkg-config
brew link qt5 --force
echo "$(brew --prefix qt5)/bin" >> $GITHUB_PATH
fi
elif [ '${{ runner.os }}' == 'Linux' ]; then
sudo apt-get update
if [ '${{ matrix.qt_version }}' == 'qt6' ]; then
sudo apt-get install -y qt6-base-dev qtchooser qmake6 qt6-base-dev-tools qt6-tools-dev pkg-config libsecret-1-dev
else
sudo apt-get install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qttools5-dev pkg-config libsecret-1-dev
fi
fi
- name: Set AQT Version and Arch (Windows only)
if: runner.os == 'Windows'
id: set_qt_arch
shell: pwsh
run: |
$qtVer = "${{ matrix.qt_version == 'qt5' && '5.15.2' || '6.5.3' }}"
$qtArch = "${{ matrix.compiler == 'msvc' && 'msvc2019_64' ||
matrix.qt_version == 'qt5' && matrix.compiler == 'gcc' && 'mingw81' ||
matrix.qt_version == 'qt6' && matrix.compiler == 'gcc' && 'mingw' }}"
echo "QT_VER=$qtVer" >> $env:GITHUB_OUTPUT
echo "QT_ARCH=$qtArch" >> $env:GITHUB_OUTPUT
- name: Install Qt (Windows only)
if: runner.os == 'Windows'
uses: jurplel/install-qt-action@v4
with:
version: ${{ steps.set_qt_arch.outputs.QT_VER }}
arch: win64_${{ steps.set_qt_arch.outputs.QT_ARCH }}
dir: 'C:\'
cache: true
tools: 'tools_mingw1310'
- name: Setup Build Directory
run: |
mkdir -p ${{ github.workspace }}/work/build/${{ github.event.repository.name }}
- name: Run CMake (Windows only)
if: runner.os == 'Windows'
shell: pwsh
run: |
if ( '${{ matrix.compiler }}' -eq 'msvc' ) {
$generator = "NMake Makefiles"
} else {
$generator = "MinGW Makefiles"
}
if ( '${{ matrix.compiler }}' -eq 'gcc' ) {
echo "C:/Qt/Tools/mingw1310_64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$env:PATH = "C:\Qt\Tools\mingw1310_64\bin;$env:PATH"
}
cd "${{ github.workspace }}/work/build/${{ github.event.repository.name }}"
cmake -G $generator "${{ github.workspace }}" `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" `
-DCMAKE_PREFIX_PATH=$env:QT_ROOT_DIR `
${{ matrix.qt_version == 'qt6' && '-DBUILD_WITH_QT6=true' || '' }}
- name: Run CMake (Mac/Linux Only)
if: runner.os != 'Windows'
run: |
cd ${{ github.workspace }}/work/build/${{ github.event.repository.name }}
cmake -G Ninja ${{ github.workspace }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
${{ matrix.qt_version == 'qt6' && '-DBUILD_WITH_QT6=true' || '' }}
- name: Build and Install
run: |
cd ${{ github.workspace }}/work/build/${{ github.event.repository.name }}
cmake --build .
cmake --install . --prefix "${{ github.workspace }}/install"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: build-artifact ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.qt_version }}
path: ${{ github.workspace }}/work/build/${{ github.event.repository.name }}