-
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.
Contains the following squashed commits from the old branch: Initial commit Fix link order Add option to link against system ffmpeg, disable precompiled binaries for mingw Update macOS files for XCode 12 Update ffmpeg to 5.1.2 Add mjpeg encoder (#7) Add mjpeg2jpeg bitstream filter Add macOS-arm64 builds Add macOS arm64 to CMakeLists Add arm64-osx-release to build.yml dummy commit to trigger workflow Properly split macOS builds in build.yml Try to fix actions uploads Rename the builds Fix build.yml Fix typo in build.yml Amend CMakeLists using the correct check ci: change upload path to directly upload libraries ci: build and use universal binary on macOS ci: set macOS deployment target to macOS 11.0 ci: build FFMPEG prebuilt for each OS/architecture Add linux arm64 prebuilt. Add both x86_64 and arm64 prebuilts for macOS. ci: create release for pre-built FFMPEG cmake: download and use only necessary prebuilt FFMPEG Add arm64 windows prebuilt Co-authored-by: Seungyun Lee <[email protected]> Co-authored-by: shinra-electric <[email protected]> Co-authored-by: SaturnSky <[email protected]>
- Loading branch information
0 parents
commit 552b08f
Showing
151 changed files
with
35,130 additions
and
0 deletions.
There are no files selected for viewing
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,106 @@ | ||
name: C/C++ CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
|
||
build: | ||
name: ${{ matrix.build }} ${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build: [linux, windows, macos] | ||
arch: [x64, arm64] | ||
include: | ||
- build: linux | ||
os: ubuntu-latest | ||
triplet: linux-release | ||
vcpkg-root: /usr/local/share/vcpkg | ||
extra-args: "" | ||
- build: windows | ||
os: windows-latest | ||
triplet: win-llvm-static-release | ||
vcpkg-root: C:\vcpkg | ||
extra-args: --overlay-triplets=./triplets | ||
- build: macos | ||
os: macos-latest | ||
triplet: osx-release | ||
vcpkg-root: /usr/local/share/vcpkg | ||
extra-args: "" | ||
- build: macos | ||
os: macos-latest | ||
arch: universal | ||
triplet: osx-release | ||
vcpkg-root: /usr/local/share/vcpkg | ||
extra-args: --overlay-triplets=./triplets | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up build environment (macos-latest) | ||
run: | | ||
brew install nasm | ||
if: matrix.os == 'macos-latest' | ||
|
||
- name: Set up build environment (ubuntu-latest) | ||
run: | | ||
sudo apt -y install nasm | ||
if: matrix.os == 'ubuntu-latest' | ||
|
||
- name: Set up build environment (arm64 ubuntu-latest) | ||
run: | | ||
sudo apt-get install -qy binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'arm64' | ||
|
||
- name: Patch vcpkg | ||
run: | | ||
(cd ${{ matrix.vcpkg-root }} && git fetch origin) | ||
(cd ${{ matrix.vcpkg-root }} && git reset --hard) | ||
(cd ${{ matrix.vcpkg-root }} && git checkout f6a5d4e8eb7476b8d7fc12a56dff300c1c986131) | ||
(cd ${{ matrix.vcpkg-root }} && git apply --ignore-space-change --ignore-whitespace --3way ${{ github.workspace }}/ffmpeg.patch) | ||
- name: Build ffmpeg | ||
run: | | ||
vcpkg ${{ matrix.extra-args }} install ffmpeg[avcodec,avfilter,avdevice,avformat,swresample,swscale]:${{ matrix.arch }}-${{ matrix.triplet }} | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: ffmpeg-${{ matrix.build }}-${{ matrix.arch }} | ||
path: ${{ matrix.vcpkg-root }}/packages/ffmpeg_${{ matrix.arch }}-${{ matrix.triplet }}/lib | ||
if: ${{ always() }} | ||
|
||
create-release: | ||
needs: [build] | ||
runs-on: "ubuntu-20.04" | ||
if: github.ref == 'refs/heads/master' | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
|
||
- name: Compute short git commit SHA | ||
run: | | ||
echo "COMMIT_SHORT_SHA=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV | ||
echo ${{ env.COMMIT_SHORT_SHA }} | ||
- name: Upload | ||
shell: bash | ||
run: | | ||
mkdir artifacts/ | ||
files=$(find . -name "ffmpeg-*") | ||
for f in $files; do | ||
echo "Compressing $f" | ||
(cd $(basename $f) && zip -r ../artifacts/$(basename $f).zip *) | ||
done | ||
ls -al artifacts/ | ||
wget -c https://github.com/tcnksm/ghr/releases/download/v0.14.0/ghr_v0.14.0_linux_amd64.tar.gz | ||
tar xfv ghr_v0.14.0_linux_amd64.tar.gz | ||
ghr_v0.14.0_linux_amd64/ghr -u Vita3K -r ffmpeg-core -n 'Automatic FFmpeg CI builds (${{ env.COMMIT_SHORT_SHA }})' -b "$(printf "Corresponding commit: ${{ github.sha }}")" ${{ env.COMMIT_SHORT_SHA }} artifacts/ | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,79 @@ | ||
if (NOT DEFINED FFMPEG_CORE_NAME) | ||
set(FFMPEG_CORE_NAME ffmpeg) | ||
endif() | ||
|
||
add_library(${FFMPEG_CORE_NAME} INTERFACE) | ||
|
||
target_include_directories(${FFMPEG_CORE_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") | ||
|
||
# Detect OS | ||
if (WIN32 AND NOT MINGW) | ||
set(FFMPEG_PREBUILTS_NAME "ffmpeg-windows") | ||
elseif (APPLE) | ||
set(FFMPEG_PREBUILTS_NAME "ffmpeg-macos") | ||
elseif (UNIX) | ||
set(FFMPEG_PREBUILTS_NAME "ffmpeg-linux") | ||
else () | ||
message(FATAL_ERROR "Unsupported OS.") | ||
endif () | ||
|
||
# Detect Architecture | ||
if(NOT DEFINED ARCHITECTURE) | ||
message(FATAL_ERROR "ARCHITECTURE variable is not set up") | ||
elseif (ARCHITECTURE STREQUAL "x86_64") | ||
set(FFMPEG_PREBUILTS_NAME "${FFMPEG_PREBUILTS_NAME}-x64.zip") | ||
elseif(ARCHITECTURE STREQUAL "arm64") | ||
set(FFMPEG_PREBUILTS_NAME "${FFMPEG_PREBUILTS_NAME}-arm64.zip") | ||
elseif(APPLE AND "x86_64" IN_LIST ARCHITECTURE AND "arm64" IN_LIST ARCHITECTURE) # macOS universal | ||
set(FFMPEG_PREBUILTS_NAME "${FFMPEG_PREBUILTS_NAME}-universal.zip") | ||
else () | ||
message(FATAL_ERROR "Unsupported architecture.") | ||
endif() | ||
|
||
# Compute current short git commit SHA | ||
execute_process( | ||
COMMAND git rev-parse --short HEAD | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE FFMPEG_GIT_SHA | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|
||
# Download prebuilt ffmpeg | ||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/external/ffmpeg.zip") | ||
message(STATUS "Downloading FFMPEG prebuilts...") | ||
file(DOWNLOAD https://github.com/Vita3K/ffmpeg-core/releases/download/${FFMPEG_GIT_SHA}/${FFMPEG_PREBUILTS_NAME} | ||
"${CMAKE_BINARY_DIR}/external/ffmpeg.zip" SHOW_PROGRESS | ||
STATUS FILE_STATUS) | ||
list(GET FILE_STATUS 0 STATUS_CODE) | ||
if (NOT STATUS_CODE EQUAL 0) | ||
file(REMOVE "${CMAKE_BINARY_DIR}/external/ffmpeg.zip") # CMake create 0 byte file even if URL is invalid. So need to delete it. | ||
message(FATAL_ERROR "No FFMPEG prebuilt found with corresponding commit SHA (${FFMPEG_GIT_SHA})") | ||
endif() | ||
endif() | ||
|
||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/external/ffmpeg/lib") | ||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/external/ffmpeg/lib") | ||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_BINARY_DIR}/external/ffmpeg.zip" | ||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/external/ffmpeg/lib") | ||
endif() | ||
|
||
set(LIB_PREFIX "lib") | ||
set(LIB_EXT "a") | ||
if (WIN32 AND NOT MINGW) | ||
set(LIB_PREFIX "") | ||
set(LIB_EXT "lib") | ||
target_link_libraries(${FFMPEG_CORE_NAME} INTERFACE | ||
"psapi;strmiids;uuid;oleaut32;shlwapi;ws2_32;ole32;user32;bcrypt") | ||
elseif (APPLE) | ||
target_link_libraries(${FFMPEG_CORE_NAME} INTERFACE | ||
"-framework CoreServices" "-framework CoreFoundation" "-framework AudioUnit" | ||
"-framework AudioToolbox" "-framework CoreAudio" "-framework CoreMedia" | ||
"-framework VideoToolbox" "-framework CoreVideo" "-framework Security") | ||
endif () | ||
|
||
target_link_libraries(${FFMPEG_CORE_NAME} INTERFACE | ||
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}avformat.${LIB_EXT}" | ||
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}avcodec.${LIB_EXT}" | ||
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}swscale.${LIB_EXT}" | ||
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}avutil.${LIB_EXT}" | ||
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}avfilter.${LIB_EXT}" | ||
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}swresample.${LIB_EXT}") |
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,5 @@ | ||
## FFmpeg builtins | ||
|
||
This repository contains the ffmpeg builtins for Vita3K and the CI to build them using vcpkg and github action. | ||
|
||
The Windows version is built using clang-cl, this is done so that inline assembly optimisations (which are not supported by MSVC) can be enabled. |
Oops, something went wrong.