-
Notifications
You must be signed in to change notification settings - Fork 3k
459 lines (439 loc) · 18.7 KB
/
main.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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2019-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
name: Build
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- '*'
concurrency:
group: build-${{ github.ref_name }}
cancel-in-progress: true
env:
CACHE_VERSION: "2022-12-02"
jobs:
windows:
strategy:
fail-fast: false
matrix:
runner: [ "windows-2022" ]
name: [ "Windows" ]
compiler: [ "MSVC", "Clang" ]
qt: [ 6 ]
include:
- compiler: "MSVC"
CMAKE_SYSTEM_VERSION: "10.0.20348.0"
CMAKE_GENERATOR: "Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM: "x64"
- compiler: "Clang"
CMAKE_SYSTEM_VERSION: "10.0.20348.0"
CMAKE_GENERATOR: "Visual Studio 17 2022"
CMAKE_GENERATOR_TOOLSET: "ClangCL"
CMAKE_GENERATOR_PLATFORM: "x64"
runs-on: "${{ matrix.runner }}"
name: "${{ matrix.name }} (${{ matrix.compiler }})"
env:
CMAKE_GENERATOR: "${{ matrix.CMAKE_GENERATOR }}"
CMAKE_GENERATOR_PLATFORM: "${{ matrix.CMAKE_GENERATOR_PLATFORM }}"
CMAKE_GENERATOR_TOOLSET: "${{ matrix.CMAKE_GENERATOR_TOOLSET }}"
CMAKE_SYSTEM_VERSION: "${{ matrix.CMAKE_SYSTEM_VERSION }}"
steps:
- name: "Clone"
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: "Gather Information"
id: info
shell: bash
run: |
# Define buildspec file
buildspec="${{ github.workspace }}/third-party/obs-studio/buildspec.json"
# Prebuilt Dependencies Version
IFS=$'\n' buildspecdata=($(node tools/buildspec.js "${buildspec}" "prebuilt" "windows-x64"))
echo "obs_deps_version=${buildspecdata[0]}" >> "$GITHUB_ENV"
echo "obs_deps_hash=${buildspecdata[1]}" >> "$GITHUB_ENV"
echo "obs_deps_url=${buildspecdata[2]}" >> "$GITHUB_ENV"
# Qt Version
IFS=$'\n' buildspecdata=($(node tools/buildspec.js "${buildspec}" "qt${{ matrix.qt }}" "windows-x64"))
echo "qt_version=${buildspecdata[0]}" >> "$GITHUB_ENV"
echo "qt_hash=${buildspecdata[1]}" >> "$GITHUB_ENV"
echo "qt_url=${buildspecdata[2]}" >> "$GITHUB_ENV"
# libOBS Version
echo "obs_version=$(cd "${{ github.workspace }}/third-party/obs-studio" && git describe --tags --long)" >> "$GITHUB_ENV"
- name: "Dependency: Qt (Cache)"
id: qt-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/qt"
key: "qt${{ env.qt_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: Qt"
id: qt
if: ${{ steps.qt-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
curl --retry 5 --retry-delay 30 -jLo /tmp/qt.zip "${{ env.qt_url }}"
if [[ ! -f "${{ github.workspace }}/build/qt" ]]; then mkdir -p "${{ github.workspace }}/build/qt"; fi
7z x -y -o"${{ github.workspace }}/build/qt" -- "/tmp/qt.zip"
- name: "Dependency: Prebuilt OBS Studio Dependencies (Cache)"
id: obsdeps-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/obsdeps"
key: "obsdeps${{ env.obs_deps_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: Prebuilt OBS Studio Dependencies"
id: obsdeps
if: ${{ steps.obsdeps-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
curl --retry 5 --retry-delay 30 -jLo /tmp/obsdeps.zip "${{ env.obs_deps_url }}"
if [[ ! -f "${{ github.workspace }}/build/obsdeps" ]]; then mkdir -p "${{ github.workspace }}/build/obsdeps"; fi
7z x -y -o"${{ github.workspace }}/build/obsdeps" -- "/tmp/obsdeps.zip"
- name: "Dependency: OBS Libraries (Cache)"
id: obs-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/obs"
key: "obs${{ env.obs_version }}-${{ matrix.runner }}_${{ matrix.compiler }}-obsdeps${{ env.obs_deps_hash }}-qt${{ env.qt_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: OBS Libraries"
id: obs
if: ${{ steps.obs-cache.outputs.cache-hit != 'true' }}
env:
# obs-studio does not support ClangCL
CMAKE_GENERATOR_TOOLSET: ""
shell: bash
run: |
# Apply patches to obs-studio
pushd "${{ github.workspace }}/third-party/obs-studio" > /dev/null
for f in ../../patches/obs-studio/*.patch; do
echo "Applying patch '${f}''..."
[ -e "$f" ] || continue
git apply "$f"
done
popd > /dev/null
# Build obs-studio
cmake \
-S "${{ github.workspace }}/third-party/obs-studio" \
-B "${{ github.workspace }}/build/obs" \
-DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/obs/install" \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/build/obsdeps;${{ github.workspace }}/build/qt" \
-DENABLE_PLUGINS=OFF \
-DENABLE_UI=OFF \
-DENABLE_SCRIPTING=OFF
cmake \
--build "${{ github.workspace }}/build/obs" \
--config RelWithDebInfo \
--target obs-frontend-api
cmake \
--install "${{ github.workspace }}/build/obs" \
--config RelWithDebInfo \
--component obs_libraries
- name: "Configure"
continue-on-error: true
shell: bash
run: |
cmake \
-S "${{ github.workspace }}" \
-B "${{ github.workspace }}/build/ci" \
-DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-Dlibobs_DIR="${{ github.workspace }}/build/obs/install" \
-DQt${{ matrix.qt }}_DIR="${{ github.workspace }}/build/qt" \
-DFFmpeg_DIR="${{ github.workspace }}/build/obsdeps" \
-DCURL_DIR="${{ github.workspace }}/build/obsdeps"
- name: "Build: Debug"
continue-on-error: true
shell: bash
env:
CMAKE_BUILD_TYPE: "Debug"
run: |
cmake --build "build/ci" --config ${{ env.CMAKE_BUILD_TYPE }} --target StreamFX
- name: "Build: Release"
shell: bash
env:
CMAKE_BUILD_TYPE: "RelWithDebInfo"
run: |
cmake --build "build/ci" --config ${{ env.CMAKE_BUILD_TYPE }} --target StreamFX
macos:
strategy:
fail-fast: false
matrix:
runner: [ "macos-12" ]
compiler: [ "Clang" ]
qt: [ 6 ]
include:
- compiler: "Clang"
name: "MacOS"
CMAKE_GENERATOR: "Xcode"
CMAKE_OSX_DEPLOYMENT_TARGET: "10.15"
CMAKE_OSX_ARCHITECTURES: "x86_64;arm64"
runs-on: "${{ matrix.runner }}"
name: "${{ matrix.name }} (${{ matrix.compiler }})"
env:
CMAKE_GENERATOR: "${{ matrix.CMAKE_GENERATOR }}"
CMAKE_GENERATOR_PLATFORM: "${{ matrix.CMAKE_GENERATOR_PLATFORM }}"
CMAKE_GENERATOR_TOOLSET: "${{ matrix.CMAKE_GENERATOR_TOOLSET }}"
CMAKE_SYSTEM_VERSION: "${{ matrix.CMAKE_SYSTEM_VERSION }}"
CMAKE_OSX_DEPLOYMENT_TARGET: "${{ matrix.CMAKE_OSX_DEPLOYMENT_TARGET }}"
CMAKE_OSX_ARCHITECTURES: "${{ matrix.CMAKE_OSX_ARCHITECTURES }}"
steps:
- name: "Clone"
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: "Gather Information"
id: info
shell: bash
run: |
# Define buildspec file
buildspec="${{ github.workspace }}/third-party/obs-studio/buildspec.json"
# Prebuilt Dependencies Version
IFS=$'\n' buildspecdata=($(node tools/buildspec.js "${buildspec}" "prebuilt" "macos-universal"))
echo "obs_deps_version=${buildspecdata[0]}" >> "$GITHUB_ENV"
echo "obs_deps_hash=${buildspecdata[1]}" >> "$GITHUB_ENV"
echo "obs_deps_url=${buildspecdata[2]}" >> "$GITHUB_ENV"
# Qt Version
IFS=$'\n' buildspecdata=($(node tools/buildspec.js "${buildspec}" "qt${{ matrix.qt }}" "macos-universal"))
echo "qt_version=${buildspecdata[0]}" >> "$GITHUB_ENV"
echo "qt_hash=${buildspecdata[1]}" >> "$GITHUB_ENV"
echo "qt_url=${buildspecdata[2]}" >> "$GITHUB_ENV"
# libOBS Version
echo "obs_version=$(cd "${{ github.workspace }}/third-party/obs-studio" && git describe --tags --long)" >> "$GITHUB_ENV"
- name: "Dependency: Qt (Cache)"
id: qt-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/qt"
key: "qt${{ env.qt_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: Qt"
id: qt
if: ${{ steps.qt-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
curl --retry 5 --retry-delay 30 -jLo /tmp/qt.tar.xz "${{ env.qt_url }}"
if [[ ! -f "${{ github.workspace }}/build/qt" ]]; then mkdir -p "${{ github.workspace }}/build/qt"; fi
tar -xvf "/tmp/qt.tar.xz" -C "${{ github.workspace }}/build/qt"
- name: "Dependency: Prebuilt OBS Studio Dependencies (Cache)"
id: obsdeps-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/obsdeps"
key: "obsdeps${{ env.obs_deps_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: Prebuilt OBS Studio Dependencies"
id: obsdeps
if: ${{ steps.obsdeps-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
curl --retry 5 --retry-delay 30 -jLo /tmp/obsdeps.tar.xz "${{ env.obs_deps_url }}"
if [[ ! -f "${{ github.workspace }}/build/obsdeps" ]]; then mkdir -p "${{ github.workspace }}/build/obsdeps"; fi
tar -xvf "/tmp/obsdeps.tar.xz" -C "${{ github.workspace }}/build/obsdeps"
- name: "Dependency: OBS Libraries (Cache)"
id: obs-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/obs"
key: "obs${{ env.obs_version }}-${{ matrix.runner }}_${{ matrix.compiler }}--obsdeps${{ env.obs_deps_hash }}-qt${{ env.qt_hash }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: OBS Libraries"
id: obs
if: ${{ steps.obs-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
# Apply patches to obs-studio
pushd "${{ github.workspace }}/third-party/obs-studio" > /dev/null
for f in ../../patches/obs-studio/*.patch; do
echo "Applying patch '${f}''..."
[ -e "$f" ] || continue
git apply "$f"
done
popd > /dev/null
# Build obs-studio
cmake \
-S "${{ github.workspace }}/third-party/obs-studio" \
-B "${{ github.workspace }}/build/obs" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/obs/install" \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/build/obsdeps;${{ github.workspace }}/build/qt" \
-DENABLE_PLUGINS=OFF \
-DENABLE_UI=OFF \
-DENABLE_SCRIPTING=OFF
cmake \
--build "${{ github.workspace }}/build/obs" \
--config RelWithDebInfo \
--target obs-frontend-api
cmake \
--install "${{ github.workspace }}/build/obs" \
--config RelWithDebInfo \
--component obs_libraries
- name: "Configure"
continue-on-error: true
shell: bash
run: |
cmake \
-S "${{ github.workspace }}" \
-B "${{ github.workspace }}/build/ci" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-Dlibobs_DIR="${{ github.workspace }}/build/obs/install" \
-DQt${{ matrix.qt }}_DIR="${{ github.workspace }}/build/qt" \
-DFFmpeg_DIR="${{ github.workspace }}/build/obsdeps" \
-DCURL_DIR="${{ github.workspace }}/build/obsdeps"
- name: "Build: Debug"
continue-on-error: true
shell: bash
run: |
cmake --build "build/ci" --config Debug --target StreamFX
- name: "Build: Release"
shell: bash
env:
CMAKE_BUILD_TYPE: "RelWithDebInfo"
run: |
cmake --build "build/ci" --config RelWithDebInfo --target StreamFX
ubuntu:
strategy:
fail-fast: false
matrix:
runner: [ "ubuntu-22.04" ]
compiler: [ "GCC-12", "Clang-16" ]
qt: [ 6 ]
CMAKE_GENERATOR: [ "Ninja Multi-Config" ]
include:
- runner: "ubuntu-22.04"
name: "Ubuntu 22.04"
runs-on: "${{ matrix.runner }}"
name: "${{ matrix.name }} (${{ matrix.compiler }}, Qt${{ matrix.qt }})"
env:
CMAKE_GENERATOR: "${{ matrix.CMAKE_GENERATOR }}"
CMAKE_GENERATOR_PLATFORM: "${{ matrix.CMAKE_GENERATOR_PLATFORM }}"
CMAKE_GENERATOR_TOOLSET: "${{ matrix.CMAKE_GENERATOR_TOOLSET }}"
CMAKE_SYSTEM_VERSION: "${{ matrix.CMAKE_SYSTEM_VERSION }}"
steps:
- name: "Clone"
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: "Install Build Tools"
shell: bash
run: |
echo "Installing essential tools..."
sudo apt-get -qq update
sudo apt-get install build-essential checkinstall pkg-config cmake ninja-build git
# Install the appropriate compiler
IFS=$'-' compiler=($(echo "${{ matrix.compiler }}")) # ToDo: Can this be done without invoking a sub-shell?
echo "Installing '${compiler[0]}' version ${compiler[1]}..."
if [[ "${compiler[0]}" == "GCC" ]]; then
sudo apt-get install binutils gcc-${compiler[1]} g++-${compiler[1]}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${compiler[1]} 800 --slave /usr/bin/g++ g++ /usr/bin/g++-${compiler[1]}
echo "CMAKE_C_COMPILER=gcc-${compiler[1]}" >> "$GITHUB_ENV"
echo "CMAKE_CXX_COMPILER=g++-${compiler[1]}" >> "$GITHUB_ENV"
echo "CMAKE_LINKER=gold" >> "$GITHUB_ENV"
elif [[ "${compiler[0]}" == "Clang" ]]; then
curl -jLo /tmp/llvm.sh "https://apt.llvm.org/llvm.sh"
chmod +x /tmp/llvm.sh
sudo /tmp/llvm.sh ${compiler[1]} all
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${compiler[1]} 800
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-${compiler[1]} 800
echo "CMAKE_C_COMPILER=clang-${compiler[1]}" >> "$GITHUB_ENV"
echo "CMAKE_CXX_COMPILER=clang++-${compiler[1]}" >> "$GITHUB_ENV"
echo "CMAKE_LINKER=ld.lld-${compiler[1]}" >> "$GITHUB_ENV"
else
echo "Unknown Compiler"
exit 1
fi
- name: "Dependency: Qt"
id: qt
shell: bash
run: |
sudo apt-get -y install -V \
qt6-base-dev qt6-base-private-dev libqt6svg6-dev libgles2-mesa-dev libegl1-mesa-dev libgl1-mesa-dev
- name: "Dependency: Prebuilt OBS Studio Dependencies"
id: obsdeps
shell: bash
run: |
sudo apt-get -y install -V \
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev \
libcurl4-openssl-dev
- name: "Dependency: OBS Libraries (Cache)"
id: obs-cache
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/build/obs"
key: "obs${{ env.obs_version }}-${{ matrix.runner }}_${{ matrix.compiler }}--${{ matrix.runner }}-${{ matrix.compiler }}-${{ env.CACHE_VERSION }}"
- name: "Dependency: OBS Libraries"
id: obs
if: ${{ steps.obs-cache.outputs.cache-hit != 'true' }}
shell: bash
run: |
# Apply patches to obs-studio
pushd "${{ github.workspace }}/third-party/obs-studio" > /dev/null
for f in ../../patches/obs-studio/*.patch; do
echo "Applying patch '${f}''..."
[ -e "$f" ] || continue
git apply "$f"
done
popd > /dev/null
# Extra requirements by libobs on Linux.
sudo apt-get install \
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev \
libx264-dev libcurl4-openssl-dev libmbedtls-dev libgl1-mesa-dev libjansson-dev libluajit-5.1-dev python3-dev \
libx11-dev libxcb-randr0-dev libxcb-shm0-dev libxcb-xinerama0-dev libxcomposite-dev libxinerama-dev \
libxcb1-dev libx11-xcb-dev libxcb-xfixes0-dev swig libcmocka-dev libxss-dev libglvnd-dev libgles2-mesa \
libgles2-mesa-dev libwayland-dev \
libasound2-dev libfdk-aac-dev libfontconfig-dev libfreetype6-dev libjack-jackd2-dev libpulse-dev \
libsndio-dev libspeexdsp-dev libudev-dev libv4l-dev libva-dev libvlc-dev libdrm-dev
# Build obs-studio
cmake \
-S "${{ github.workspace }}/third-party/obs-studio" \
-B "${{ github.workspace }}/build/obs" \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_C_COMPILER="${{ env.CMAKE_C_COMPILER }}" \
-DCMAKE_CXX_COMPILER="${{ env.CMAKE_CXX_COMPILER }}" \
-DCMAKE_C_FLAGS="${{ env.CMAKE_C_FLAGS }}" \
-DCMAKE_CXX_FLAGS="${{ env.CMAKE_CXX_FLAGS }}" \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/obs/install" \
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/build/obsdeps;${{ github.workspace }}/build/qt" \
-DENABLE_PLUGINS=OFF \
-DENABLE_UI=OFF \
-DENABLE_SCRIPTING=OFF
cmake \
--build "${{ github.workspace }}/build/obs" \
--config Release \
--target obs-frontend-api
cmake \
--install "${{ github.workspace }}/build/obs" \
--config Release \
--component obs_libraries
- name: "Configure"
continue-on-error: true
shell: bash
run: |
cmake \
-S "${{ github.workspace }}" \
-B "${{ github.workspace }}/build/ci" \
-DCMAKE_C_COMPILER="${{ env.CMAKE_C_COMPILER }}" \
-DCMAKE_CXX_COMPILER="${{ env.CMAKE_CXX_COMPILER }}" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/build/ci/install" \
-DPACKAGE_NAME="streamfx-${{ env.PACKAGE_NAME }}" \
-DPACKAGE_PREFIX="${{ github.workspace }}/build/package" \
-Dlibobs_DIR="${{ github.workspace }}/build/obs/install"
- name: "Build: Debug"
continue-on-error: true
shell: bash
run: |
cmake --build "build/ci" --config Debug --target StreamFX
- name: "Build: Release"
shell: bash
run: |
cmake --build "build/ci" --config RelWithDebInfo --target StreamFX