Skip to content

Commit 64794fd

Browse files
authored
Update to ffmpeg 8, build pipeline improvements (#138)
* Updated ffmpeg to 8.0.1 and adjusted build script * Removed all prebuilt ffmpeg files * Full maintenance pass on how ffmpeg gets build, restructure repo * Updated copyright and license download links
1 parent 0e895d5 commit 64794fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+483
-27637
lines changed

.github/workflows/build-plugin.yml

Lines changed: 141 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,71 @@ jobs:
2626
with:
2727
fetch-depth: 0
2828

29+
- name: create submodule status file
30+
run: git submodule status > submodule_status
31+
32+
- name: Restore ffmpeg cache
33+
id: cache-ffmpeg-restore
34+
uses: actions/cache/restore@v4
35+
env:
36+
cache-name: cache-ffmpeg-build-win32
37+
with:
38+
path: ${{github.workspace}}/ffmpeg/build/x86
39+
key: ${{env.cache-name}}-${{hashFiles('submodule_status', 'ffmpeg/build_ffmpeg.sh')}}
40+
41+
# 1. Setup MSVC environment variables (cl.exe, link.exe, etc.)
42+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
43+
name: Setup MSVC
44+
uses: ilammy/msvc-dev-cmd@v1
45+
with:
46+
arch: x86
47+
48+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
49+
name: Setup MSYS2
50+
uses: msys2/setup-msys2@v2
51+
id: setup-msys2
52+
with:
53+
msystem: MSYS
54+
install: >-
55+
make
56+
diffutils
57+
nasm
58+
pkg-config
59+
git
60+
path-type: inherit
61+
update: true
62+
63+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
64+
name: Checkout ffmpeg submodule
65+
run: git submodule update --init --recursive
66+
67+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
68+
name: Build ffmpeg
69+
shell: msys2 {0}
70+
run: |
71+
pushd ffmpeg
72+
./build_ffmpeg.sh x86
73+
popd
74+
75+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
76+
name: Save FFmpeg cache
77+
id: cache-ffmpeg-save
78+
uses: actions/cache/save@v4
79+
with:
80+
path: |
81+
${{github.workspace}}/ffmpeg/build/x86
82+
key: ${{ steps.cache-ffmpeg-restore.outputs.cache-primary-key }}
83+
2984
- name: Install Qt
30-
uses: jurplel/install-qt-action@v3
85+
uses: jurplel/install-qt-action@v4
3186
with:
32-
version: '5.15.2'
87+
version: '5.15.*'
3388
host: 'windows'
3489
target: 'desktop'
3590
arch: 'win32_msvc2019'
3691
install-deps: 'true'
3792
cache: 'true'
38-
cache-key-prefix: 'install-qt-action-x86'
93+
cache-key-prefix: 'install-qt-action-win32'
3994

4095
- name: Configure CMake
4196
run: >
@@ -65,17 +120,72 @@ jobs:
65120
- uses: actions/checkout@v4
66121
with:
67122
fetch-depth: 0
68-
123+
124+
- name: create submodule status file
125+
run: git submodule status > submodule_status
126+
127+
- name: Restore ffmpeg cache
128+
id: cache-ffmpeg-restore
129+
uses: actions/cache/restore@v4
130+
env:
131+
cache-name: cache-ffmpeg-build-win64
132+
with:
133+
path: ${{github.workspace}}/ffmpeg/build/x86_64
134+
key: ${{env.cache-name}}-${{hashFiles('submodule_status', 'ffmpeg/build_ffmpeg.sh')}}
135+
136+
# 1. Setup MSVC environment variables (cl.exe, link.exe, etc.)
137+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
138+
name: Setup MSVC
139+
uses: ilammy/msvc-dev-cmd@v1
140+
with:
141+
arch: x64
142+
143+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
144+
name: Setup MSYS2
145+
uses: msys2/setup-msys2@v2
146+
id: setup-msys2
147+
with:
148+
msystem: MSYS
149+
install: >-
150+
make
151+
diffutils
152+
nasm
153+
pkg-config
154+
git
155+
path-type: inherit
156+
update: true
157+
158+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
159+
name: Checkout ffmpeg submodule
160+
run: git submodule update --init --recursive
161+
162+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
163+
name: Build ffmpeg
164+
shell: msys2 {0}
165+
run: |
166+
pushd ffmpeg
167+
./build_ffmpeg.sh
168+
popd
169+
170+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
171+
name: Save FFmpeg cache
172+
id: cache-ffmpeg-save
173+
uses: actions/cache/save@v4
174+
with:
175+
path: |
176+
${{github.workspace}}/ffmpeg/build/x86_64
177+
key: ${{ steps.cache-ffmpeg-restore.outputs.cache-primary-key }}
178+
69179
- name: Install Qt
70-
uses: jurplel/install-qt-action@v3
180+
uses: jurplel/install-qt-action@v4
71181
with:
72-
version: '5.15.2'
182+
version: '5.15.*'
73183
host: 'windows'
74184
target: 'desktop'
75185
arch: 'win64_msvc2019_64'
76186
install-deps: 'true'
77187
cache: 'true'
78-
cache-key-prefix: 'install-qt-action'
188+
cache-key-prefix: 'install-qt-action-win64'
79189

80190
- name: Configure CMake
81191
run: >
@@ -113,29 +223,37 @@ jobs:
113223
run: git submodule status > submodule_status
114224

115225
- name: Restore ffmpeg cache
116-
id: cache-ffmpeg
117-
uses: actions/cache@v4
226+
id: cache-ffmpeg-restore
227+
uses: actions/cache/restore@v4
118228
env:
119-
cache-name: cache-ffmpeg-build
229+
cache-name: cache-ffmpeg-build-linux64
120230
with:
121-
path: ${{github.workspace}}/ffmpeg/lib_lin_x64
122-
key: ${{runner.os}}-build-${{env.cache-name}}-${{hashFiles('submodule_status', 'ffmpeg/build-scripts/**')}}
231+
path: ${{github.workspace}}/ffmpeg/build/x86_64
232+
key: ${{env.cache-name}}-${{hashFiles('submodule_status', 'ffmpeg/build_ffmpeg.sh')}}
123233

124-
- if: ${{ steps.cache-ffmpeg.outputs.cache-hit != 'true' }}
234+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
125235
name: Build ffmpeg
126236
run: |
127-
git submodule init
128-
git submodule update
237+
git submodule update --init --recursive
129238
sudo apt-get update
130-
sudo apt-get install -y yasm
131-
pushd ffmpeg/build-scripts
239+
sudo apt-get install -y nasm
240+
pushd ffmpeg
132241
./build_ffmpeg.sh
133242
popd
134243
244+
- if: ${{ steps.cache-ffmpeg-restore.outputs.cache-hit != 'true' }}
245+
name: Save FFmpeg cache
246+
id: cache-ffmpeg-save
247+
uses: actions/cache/save@v4
248+
with:
249+
path: |
250+
${{github.workspace}}/ffmpeg/build/x86_64
251+
key: ${{ steps.cache-ffmpeg-restore.outputs.cache-primary-key }}
252+
135253
- name: Install Qt
136-
uses: jurplel/install-qt-action@v3
254+
uses: jurplel/install-qt-action@v4
137255
with:
138-
version: '5.15.2'
256+
version: '5.15.*'
139257
host: 'linux'
140258
target: 'desktop'
141259
arch: 'gcc_64'
@@ -165,7 +283,7 @@ jobs:
165283

166284
#### PACKAGE JOB ####
167285
package:
168-
runs-on: windows-latest
286+
runs-on: ubuntu-latest
169287
needs:
170288
- build-win32
171289
- build-win64
@@ -195,7 +313,9 @@ jobs:
195313
path: ${{github.workspace}}/install
196314

197315
- name: package final plugin file
198-
run: cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DRPSB_PLUGINFILE_OUTPUT_DIR=${{github.workspace}}/release -P create-pluginfile.cmake
316+
run: |
317+
mkdir release
318+
cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install -DRPSB_PLUGINFILE_OUTPUT_DIR=${{github.workspace}}/release -P create-pluginfile.cmake
199319
200320
- name: Archive
201321
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ screenshots/
99
src/version/version.h
1010
deploy/package.ini
1111

12-
# we don't commit pre-compiled linux libraries since it's way easier to compile
13-
# ffmpeg on linux compared to windows
14-
ffmpeg/lib_lin*/
12+
ffmpeg/build/

CMakeLists.txt

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,43 @@
1-
cmake_minimum_required(VERSION 3.12.0)
1+
cmake_minimum_required(VERSION 3.19.0)
22

33
project(rp_soundboard)
44

5-
include(files.cmake)
6-
7-
# Get prebuilt ffmpeg folders for windows builds
8-
set(ffmpegIncHint "ffmpeg/include")
9-
105
# figure out platform defaults for certain things
6+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
7+
set(ffmpegIncHint "ffmpeg/build/x86_64/include")
8+
set(defFFmpegLibHint "ffmpeg/build/x86_64/lib")
9+
else()
10+
set(ffmpegIncHint "ffmpeg/build/x86/include")
11+
set(defFFmpegLibHint "ffmpeg/build/x86/lib")
12+
endif()
13+
1114
if (WIN32)
1215
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
13-
set(defFFmpegLibHint "ffmpeg/lib_win_x64")
1416
set(defLibSuffix "_win64.dll")
1517
else()
16-
set(defFFmpegLibHint "ffmpeg/lib_win_x86")
1718
set(defLibSuffix "_win32.dll")
1819
endif()
19-
set(defPluginDir "%appdata%/TS3Client/plugins")
20+
set(defPluginDir "%appdata%/TS3Client")
2021
elseif(APPLE) # untested thanks to MacOS being a pain in the ass to set up in VM
2122
# mac has no 32 bit variant
22-
set(defFFmpegLibHint "ffmpeg/lib_mac_x64")
2323
set(defLibSuffix "_mac.so")
24-
set(defPluginDir "~/.ts3client/plugins")
25-
else()
24+
set(defPluginDir "~/.ts3client")
25+
elseif(LINUX)
2626
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
27-
set(defFFmpegLibHint "ffmpeg/lib_lin_x64")
2827
set(defLibSuffix "_linux_amd64.so")
2928
else()
30-
set(defFFmpegLibHint "ffmpeg/lib_lin_x86")
3129
set(defLibSuffix "_linux_x86.so")
3230
endif()
33-
set(defPluginDir "~/.ts3client/plugins")
31+
set(defPluginDir "~/.ts3client")
32+
else()
33+
message(FATAL_ERROR "Unsupported platform")
3434
endif()
3535

36-
3736
set(ffmpegLibHint "${CMAKE_CURRENT_SOURCE_DIR}/${defFFmpegLibHint}" CACHE PATH "directory with static ffmpeg libs")
3837
set(libSuffix ${defLibSuffix} CACHE STRING "output library suffix")
3938

40-
4139
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
42-
set(CMAKE_INSTALL_PREFIX "${pluginDir}" CACHE PATH "..." FORCE)
40+
set(CMAKE_INSTALL_PREFIX "${defPluginDir}" CACHE PATH "Install dir, defaults to TS3 users folder" FORCE)
4341
endif()
4442

4543
find_path(ffmpegIncludeDir libavcodec/avcodec.h PATHS ${ffmpegIncHint} NO_DEFAULT_PATH)
@@ -50,6 +48,10 @@ find_library(swresample swresample PATHS ${ffmpegLibHint} NO_DEFAULT_PATH)
5048

5149
find_package(Qt5 COMPONENTS Core Widgets Gui Network REQUIRED)
5250

51+
# CPP standard
52+
set(CMAKE_CXX_STANDARD 17)
53+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
54+
5355
# Turn on Qt compilation toolchain things
5456
set(CMAKE_AUTOMOC ON)
5557
set(CMAKE_AUTOUIC ON)
@@ -62,23 +64,21 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
6264
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
6365

6466
# version advance script (generates version.h file)
67+
find_package(Python COMPONENTS Interpreter)
6568
add_custom_target(autogenFiles ALL
6669
BYPRODUCTS "src/version/version.h" "deploy/package.ini"
6770
COMMENT "running autogen file script"
68-
COMMAND python version.py
71+
COMMAND ${Python_EXECUTABLE} version.py
6972
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
7073
)
7174

7275
# suppress warning for disabled autogen on generated files
7376
set_property(SOURCE "src/version/version.h" PROPERTY SKIP_AUTOGEN ON)
7477

7578
# actual library definition
79+
include(files.cmake)
7680
add_library(rp_soundboard SHARED ${sources} "src/version/version.h")
7781
target_link_libraries(rp_soundboard Qt5::Core Qt5::Widgets Qt5::Gui Qt5::Network)
78-
if (WIN32)
79-
# only link this way on Windows. Linux requires VERY special linker commands, see below
80-
target_link_libraries(rp_soundboard ${avcodec} ${avformat} ${avutil} ${swresample})
81-
endif()
8282

8383
target_include_directories(rp_soundboard PUBLIC "pluginsdk/include" ${ffmpegIncludeDir})
8484
set_target_properties(rp_soundboard PROPERTIES
@@ -90,7 +90,8 @@ set_target_properties(rp_soundboard PROPERTIES
9090
# Special platform dependent compile options
9191
if (MSVC)
9292
target_sources(rp_soundboard PRIVATE "src/windows/resource.h" "src/windows/Resource.rc")
93-
target_link_libraries(rp_soundboard wsock32 ws2_32 secur32) # some windows stuff
93+
target_link_libraries(rp_soundboard ${avcodec} ${avformat} ${avutil} ${swresample})
94+
target_link_libraries(rp_soundboard wsock32 ws2_32 secur32 Crypt32 Ncrypt Bcrypt) # some windows stuff
9495
target_compile_options(rp_soundboard PRIVATE /MP) # multiprocessor compiling
9596
else()
9697
if(APPLE)
@@ -113,7 +114,7 @@ install(TARGETS rp_soundboard
113114
)
114115
install(DIRECTORY "deploy/" DESTINATION ".")
115116

116-
set(RPSB_MAKE_PLUGIN_FILE OFF CACHE BOOL "Create the ts3_plugin file using 7zip")
117+
set(RPSB_MAKE_PLUGIN_FILE OFF CACHE BOOL "Create the ts3_plugin file")
117118

118119
if (${RPSB_MAKE_PLUGIN_FILE})
119120
set(RPSB_PLUGINFILE_OUTPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/release" CACHE PATH "Output directory for the final plugin file")

create-pluginfile.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ execute_process(
66
)
77
string(STRIP "${gitVersionRaw}" gitVersion)
88

9-
message("Running 7zip to create final plugin package in ${RPSB_PLUGINFILE_OUTPUT_DIR}")
9+
set(outputFile "${RPSB_PLUGINFILE_OUTPUT_DIR}/rp_soundboard_${gitVersion}.ts3_plugin")
10+
11+
message("Creating final plugin package in ${RPSB_PLUGINFILE_OUTPUT_DIR}")
12+
1013
execute_process(
11-
COMMAND "C:/Program Files/7-Zip/7z.exe" a "${RPSB_PLUGINFILE_OUTPUT_DIR}/rp_soundboard_${gitVersion}.ts3_plugin" -tzip -mx=9 -mm=Deflate "*"
14+
COMMAND "${CMAKE_COMMAND}" -E tar "cfv" "${outputFile}" --format=zip .
1215
WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
1316
)

0 commit comments

Comments
 (0)