cmake: Adapt upstream scripts for RPCS3

This commit is contained in:
AniLeo
2024-09-02 22:52:21 +01:00
committed by Megamouse
parent 2f01e8c070
commit 46441df69a
3 changed files with 30 additions and 18 deletions

View File

@@ -8,6 +8,7 @@ jobs:
build:
name: ${{ matrix.build }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
@@ -91,7 +92,7 @@ jobs:
run: |
(cd ${{ matrix.vcpkg-root }} && git fetch origin)
(cd ${{ matrix.vcpkg-root }} && git reset --hard)
(cd ${{ matrix.vcpkg-root }} && git checkout 34823ada10080ddca99b60e85f80f55e18a44eea)
(cd ${{ matrix.vcpkg-root }} && git checkout tags/2025.12.12)
(cd ${{ matrix.vcpkg-root }} && git apply --ignore-space-change --ignore-whitespace --3way ${{ github.workspace }}/ffmpeg.patch)
- name: Build ffmpeg
@@ -109,7 +110,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: ffmpeg-${{ matrix.build }}-${{ matrix.arch }}
path: ${{ matrix.vcpkg-root }}/packages/ffmpeg_${{ matrix.arch }}-${{ matrix.triplet }}/lib
path: ${{ matrix.vcpkg-root }}/packages/ffmpeg_${{ matrix.arch }}-${{ matrix.triplet }}
if: ${{ always() }}
create-release:
@@ -142,6 +143,6 @@ jobs:
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/
ghr_v0.14.0_linux_amd64/ghr -u RPCS3 -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 }}

View File

@@ -42,22 +42,21 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Download prebuilt ffmpeg
if(NOT EXISTS "${CMAKE_BINARY_DIR}/external/ffmpeg.zip")
if(NOT EXISTS "${CMAKE_BINARY_DIR}/3rdparty/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
file(DOWNLOAD https://github.com/RPCS3/ffmpeg-core/releases/download/${FFMPEG_GIT_SHA}/${FFMPEG_PREBUILTS_NAME}
"${CMAKE_BINARY_DIR}/3rdparty/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.
file(REMOVE "${CMAKE_BINARY_DIR}/3rdparty/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")
if(NOT EXISTS "${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_BINARY_DIR}/3rdparty/ffmpeg.zip"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/ffmpeg")
endif()
set(LIB_PREFIX "lib")
@@ -75,9 +74,9 @@ elseif (APPLE)
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}")
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}avformat.${LIB_EXT}"
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}avcodec.${LIB_EXT}"
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}swscale.${LIB_EXT}"
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}avutil.${LIB_EXT}"
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}avfilter.${LIB_EXT}"
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}swresample.${LIB_EXT}")

View File

@@ -1,5 +1,17 @@
## FFmpeg builtins
This repository contains the ffmpeg builtins for Vita3K and the CI to build them using vcpkg and github action.
This repository contains the ffmpeg builtins for RPCS3 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.
How to update:
- checkout https://github.com/microsoft/vcpkg to any directory (you only need it to create a ffmpeg.patch)
- reset the vcpkg branch/HEAD to the latest tag
- replace vcpkg commit/tag in .github/workflows/build.yml with the latest tag
- manually apply the changes found in the current ffmpeg.patch as well as any new changes to the vcpkg/ports/ffmpeg/portfile.cmake
- create new patch
git diff > ffmpeg.patch
- replace our ffmpeg.patch with the new ffmpeg.patch
- push the two files changes to master (ffmpeg.patch and build.yml)
- wait for and download the new release in github actions
- replace new lib and include contents in our submodule