-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(build): make this a fullblown cmake project
- Loading branch information
1 parent
0170afd
commit 0a88721
Showing
44 changed files
with
949 additions
and
972 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,330 @@ | ||
--- | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
types: [opened, synchronize, reopened] | ||
push: | ||
branches: [master] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: "${{ github.workflow }}-${{ github.ref }}" | ||
cancel-in-progress: true | ||
|
||
env: | ||
MACOSX_DEPLOYMENT_TARGET: 13.0 | ||
|
||
jobs: | ||
build: | ||
name: Build (${{ matrix.name }}) | ||
# https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu | ||
# https://trac.ffmpeg.org/wiki/CompilationGuide/macOS | ||
# https://trac.ffmpeg.org/wiki/CompilationGuide/MinGW | ||
strategy: | ||
fail-fast: false # false to test all, true to fail entire job if any fail | ||
matrix: | ||
include: | ||
- name: Linux-x86_64 # ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR} | ||
os: ubuntu-22.04 | ||
arch: x86_64 | ||
shell: bash | ||
- name: Linux-aarch64 | ||
os: ubuntu-22.04 | ||
arch: aarch64 | ||
shell: bash | ||
target: aarch64-linux-gnu | ||
- name: Linux-ppc64le | ||
os: ubuntu-22.04 | ||
arch: powerpc64le | ||
shell: bash | ||
target: powerpc64le-linux-gnu | ||
- name: Darwin-x86_64 | ||
os: macos-13 | ||
arch: x86_64 | ||
shell: bash | ||
- name: Darwin-arm64 | ||
os: macos-14 | ||
arch: aarch64 | ||
shell: bash | ||
target: arm64-apple-macosx | ||
- name: Windows-AMD64 | ||
os: windows-2022 | ||
arch: x86_64 | ||
shell: msys2 {0} | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: ${{ matrix.shell }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Dependencies Linux | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
echo "::group::dependencies prep" | ||
if [[ ${{ matrix.os }} == "ubuntu-18.04" ]]; then | ||
dist="bionic" | ||
elif [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then | ||
dist="focal" | ||
elif [[ ${{ matrix.os }} == "ubuntu-22.04" ]]; then | ||
dist="jammy" | ||
elif [[ ${{ matrix.os }} == "ubuntu-24.04" ]]; then | ||
dist="noble" | ||
fi | ||
package_arch="amd64" | ||
if [[ ${{ matrix.arch }} == "aarch64" ]]; then | ||
package_arch="arm64" | ||
elif [[ ${{ matrix.arch }} == "powerpc64le" ]]; then | ||
package_arch="ppc64el" | ||
fi | ||
mirror="http://ports.ubuntu.com/ubuntu-ports" | ||
extra_sources=$(cat <<- VAREOF | ||
deb [arch=$package_arch] $mirror $dist main restricted | ||
deb [arch=$package_arch] $mirror $dist-updates main restricted | ||
deb [arch=$package_arch] $mirror $dist universe | ||
deb [arch=$package_arch] $mirror $dist-updates universe | ||
deb [arch=$package_arch] $mirror $dist multiverse | ||
deb [arch=$package_arch] $mirror $dist-updates multiverse | ||
deb [arch=$package_arch] $mirror $dist-backports main restricted universe multiverse | ||
deb [arch=$package_arch] $mirror $dist-security main restricted | ||
deb [arch=$package_arch] $mirror $dist-security universe | ||
deb [arch=$package_arch] $mirror $dist-security multiverse | ||
VAREOF | ||
) | ||
echo "::endgroup::" | ||
echo "::group::linux dependencies" | ||
if [[ ${{ matrix.os }} == "ubuntu-20.04" ]]; then | ||
# activate mesa backport PPA to ensure ffmpeg builds with vaSyncBuffer() | ||
# (via libva 2.9.0 or later) | ||
sudo add-apt-repository ppa:kisak/turtle -y | ||
fi | ||
if [[ $package_arch != "amd64" ]]; then | ||
# fix original sources | ||
sudo sed -i -e "s#deb http#deb [arch=amd64] http#g" /etc/apt/sources.list | ||
sudo dpkg --add-architecture $package_arch | ||
echo "$extra_sources" | sudo tee -a /etc/apt/sources.list | ||
echo "----" | ||
sudo cat /etc/apt/sources.list | ||
fi | ||
sudo apt-get update -q && sudo apt-get -y install \ | ||
autoconf \ | ||
automake \ | ||
build-essential \ | ||
cmake \ | ||
git-core \ | ||
libass-dev \ | ||
libfreetype6-dev \ | ||
libgnutls28-dev \ | ||
libmp3lame-dev \ | ||
libnuma-dev \ | ||
libopus-dev \ | ||
libsdl2-dev \ | ||
libtool \ | ||
libvorbis-dev \ | ||
libxcb1-dev \ | ||
libxcb-shm0-dev \ | ||
libxcb-xfixes0-dev \ | ||
make \ | ||
meson \ | ||
nasm \ | ||
ninja-build \ | ||
pkg-config \ | ||
texinfo \ | ||
wget \ | ||
zlib1g-dev | ||
if [[ ${{ matrix.arch }} == "powerpc64le" ]]; then | ||
sudo apt-get -y install \ | ||
libva-dev:$package_arch \ | ||
libva2:$package_arch \ | ||
libva-drm2:$package_arch \ | ||
libdrm2:$package_arch \ | ||
libva-glx2:$package_arch \ | ||
libgl1:$package_arch \ | ||
libglx0:$package_arch \ | ||
libglx-mesa0:$package_arch \ | ||
libglapi-mesa:$package_arch \ | ||
libgl1-mesa-dri:$package_arch \ | ||
libdrm-amdgpu1:$package_arch \ | ||
libdrm-nouveau2:$package_arch \ | ||
libdrm-radeon1:$package_arch \ | ||
libwayland-client0:$package_arch \ | ||
libwayland-cursor0:$package_arch \ | ||
libwayland-dev:$package_arch \ | ||
libwayland-egl1:$package_arch \ | ||
libwayland-server0:$package_arch \ | ||
libva-wayland2:$package_arch \ | ||
libva-x11-2:$package_arch | ||
else | ||
sudo apt-get -y install \ | ||
libva-dev:$package_arch \ | ||
libva-glx2:$package_arch \ | ||
libgl1:$package_arch \ | ||
libglx0:$package_arch | ||
fi | ||
if [[ ${{ matrix.arch }} != "x86_64" ]]; then | ||
sudo apt-get -y install \ | ||
binutils-${{ matrix.target }} \ | ||
g++-${{ matrix.target }} \ | ||
gcc-${{ matrix.target }} | ||
fi | ||
echo "::endgroup::" | ||
- name: Setup Dependencies MacOS | ||
if: ${{ runner.os == 'macOS' }} | ||
run: | | ||
brew install \ | ||
automake \ | ||
fdk-aac \ | ||
git \ | ||
lame \ | ||
libass \ | ||
libtool \ | ||
libvorbis \ | ||
libvpx \ | ||
nasm \ | ||
ninja \ | ||
opus \ | ||
pkg-config \ | ||
sdl \ | ||
shtool \ | ||
texi2html \ | ||
theora \ | ||
wget \ | ||
xvid | ||
- name: Setup Dependencies Windows | ||
# if a dependency needs to be pinned, see https://github.com/LizardByte/build-deps/pull/186 | ||
if: ${{ runner.os == 'Windows' }} | ||
uses: msys2/setup-msys2@v2 | ||
with: | ||
msystem: ucrt64 | ||
update: true | ||
install: >- | ||
diffutils | ||
git | ||
make | ||
pkg-config | ||
mingw-w64-ucrt-x86_64-binutils | ||
mingw-w64-ucrt-x86_64-cmake | ||
mingw-w64-ucrt-x86_64-gcc | ||
mingw-w64-ucrt-x86_64-onevpl | ||
mingw-w64-ucrt-x86_64-nasm | ||
mingw-w64-ucrt-x86_64-ninja | ||
- name: Initialize Submodules | ||
# libx265 has issues when using the recursive method of the first checkout action | ||
# this is after `msys2/setup-msys2@v2` because `msys2` (default) shell is not available until then. | ||
run: | | ||
git submodule update --init --recursive | ||
- name: Setup ENV | ||
id: root | ||
run: | | ||
echo "ROOT_PATH=$PWD" >> $GITHUB_ENV | ||
- name: Setup cross compilation | ||
id: cross | ||
if: ${{ matrix.arch != 'x86_64' }} | ||
run: | | ||
TOOLCHAIN=${ROOT_PATH}/cmake/toolchains/${{ matrix.target }}.cmake | ||
echo "CMAKE_TOOLCHAIN_FILE=$TOOLCHAIN" >> $GITHUB_ENV | ||
if [[ ${{ runner.os }} == 'Linux' ]]; then | ||
echo "CCPREFIX=/usr/bin/${{ matrix.target }}-" >> $GITHUB_ENV | ||
fi | ||
- name: Configure | ||
run: | | ||
mkdir -p ./build/dist | ||
cmake \ | ||
-B build \ | ||
-S . \ | ||
-G "Ninja" \ | ||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} \ | ||
-DCMAKE_INSTALL_PREFIX="${ROOT_PATH}/build/dist" | ||
- name: Build | ||
run: | | ||
ninja -C build | ||
- name: Install | ||
run: | | ||
ninja -C build install | ||
- name: Debug build | ||
if: always() | ||
run: | | ||
ls -R ./build | ||
- name: Debug build/dist | ||
if: always() | ||
run: | | ||
ls -R ./build/dist | ||
- name: Cleanup | ||
run: | | ||
rm -f -r ./build/dist/share | ||
rm -f -r ./build/dist/lib/pkgconfig | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.name }} | ||
path: ./build/dist | ||
|
||
update_dist: | ||
# only the commit is conditional, so the rest of the job can be verified on PRs | ||
name: Update dist | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout dist | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: dist | ||
path: dist | ||
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal token | ||
fetch-depth: 0 # otherwise, will fail to push refs to dest repo | ||
|
||
- name: Cleanup | ||
run: | | ||
rm -f -r dist/ffmpeg/*/share | ||
rm -f -r dist/ffmpeg/*/lib/pkgconfig | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist/ffmpeg | ||
|
||
- name: Debug | ||
run: | | ||
ls -R dist/ffmpeg | ||
- name: Commit dist | ||
if: >- | ||
startsWith(github.repository, 'LizardByte/') && | ||
github.ref == 'refs/heads/master' && | ||
(github.event_name == 'push' || github.event_name == 'workflow_dispatch') | ||
uses: actions-js/[email protected] | ||
with: | ||
github_token: ${{ secrets.GH_BOT_TOKEN }} | ||
author_email: ${{ secrets.GH_BOT_EMAIL }} | ||
author_name: ${{ secrets.GH_BOT_NAME }} | ||
directory: dist | ||
branch: dist | ||
force: false | ||
message: "Commit ${{ github.sha }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Distribution / packaging | ||
build/ | ||
cmake-*/ | ||
|
||
# JetBrains project folder | ||
.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
[submodule "ffmpeg_sources/AMF"] | ||
path = ffmpeg_sources/AMF | ||
url = https://github.com/GPUOpen-LibrariesAndSDKs/AMF | ||
[submodule "third-party/FFmpeg/AMF"] | ||
path = third-party/FFmpeg/AMF | ||
url = https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git | ||
branch = master | ||
[submodule "ffmpeg_sources/x264"] | ||
path = ffmpeg_sources/x264 | ||
[submodule "third-party/FFmpeg/x264"] | ||
path = third-party/FFmpeg/x264 | ||
url = https://code.videolan.org/videolan/x264.git | ||
branch = stable | ||
[submodule "ffmpeg_sources/x265_git"] | ||
path = ffmpeg_sources/x265_git | ||
[submodule "third-party/FFmpeg/x265_git"] | ||
path = third-party/FFmpeg/x265_git | ||
url = https://bitbucket.org/multicoreware/x265_git.git | ||
branch = Release_3.5 | ||
[submodule "ffmpeg_sources/nv-codec-headers"] | ||
path = ffmpeg_sources/nv-codec-headers | ||
url = https://github.com/FFmpeg/nv-codec-headers | ||
[submodule "third-party/FFmpeg/nv-codec-headers"] | ||
path = third-party/FFmpeg/nv-codec-headers | ||
url = https://github.com/FFmpeg/nv-codec-headers.git | ||
branch = sdk/12.0 | ||
[submodule "ffmpeg_sources/ffmpeg"] | ||
path = ffmpeg_sources/ffmpeg | ||
url = https://github.com/FFmpeg/FFmpeg | ||
[submodule "third-party/FFmpeg/FFmpeg"] | ||
path = third-party/FFmpeg/FFmpeg | ||
url = https://github.com/FFmpeg/FFmpeg.git | ||
branch = release/7.1 | ||
[submodule "ffmpeg_sources/SVT-AV1"] | ||
path = ffmpeg_sources/SVT-AV1 | ||
[submodule "third-party/FFmpeg/SVT-AV1"] | ||
path = third-party/FFmpeg/SVT-AV1 | ||
url = https://gitlab.com/AOMediaCodec/SVT-AV1.git | ||
branch = v1.6.0 |
Oops, something went wrong.