Skip to content

Commit 869377e

Browse files
AniLeoMegamouse
authored andcommitted
cmake: Adapt upstream scripts for RPCS3
1 parent 2f01e8c commit 869377e

3 files changed

Lines changed: 34 additions & 20 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
build:
99
name: ${{ matrix.build }} ${{ matrix.arch }}
1010
runs-on: ${{ matrix.os }}
11+
continue-on-error: true
1112

1213
strategy:
1314
fail-fast: false
@@ -91,7 +92,7 @@ jobs:
9192
run: |
9293
(cd ${{ matrix.vcpkg-root }} && git fetch origin)
9394
(cd ${{ matrix.vcpkg-root }} && git reset --hard)
94-
(cd ${{ matrix.vcpkg-root }} && git checkout 34823ada10080ddca99b60e85f80f55e18a44eea)
95+
(cd ${{ matrix.vcpkg-root }} && git checkout tags/2025.12.12)
9596
(cd ${{ matrix.vcpkg-root }} && git apply --ignore-space-change --ignore-whitespace --3way ${{ github.workspace }}/ffmpeg.patch)
9697
9798
- name: Build ffmpeg
@@ -109,7 +110,7 @@ jobs:
109110
- uses: actions/upload-artifact@v4
110111
with:
111112
name: ffmpeg-${{ matrix.build }}-${{ matrix.arch }}
112-
path: ${{ matrix.vcpkg-root }}/packages/ffmpeg_${{ matrix.arch }}-${{ matrix.triplet }}/lib
113+
path: ${{ matrix.vcpkg-root }}/packages/ffmpeg_${{ matrix.arch }}-${{ matrix.triplet }}
113114
if: ${{ always() }}
114115

115116
create-release:
@@ -142,6 +143,6 @@ jobs:
142143
ls -al artifacts/
143144
wget -c https://github.com/tcnksm/ghr/releases/download/v0.14.0/ghr_v0.14.0_linux_amd64.tar.gz
144145
tar xfv ghr_v0.14.0_linux_amd64.tar.gz
145-
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/
146+
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/
146147
env:
147148
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CMakeLists.txt

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,23 @@ execute_process(
4242
OUTPUT_STRIP_TRAILING_WHITESPACE)
4343

4444
# Download prebuilt ffmpeg
45-
if(NOT EXISTS "${CMAKE_BINARY_DIR}/external/ffmpeg.zip")
46-
message(STATUS "Downloading FFMPEG prebuilts...")
47-
file(DOWNLOAD https://github.com/Vita3K/ffmpeg-core/releases/download/${FFMPEG_GIT_SHA}/${FFMPEG_PREBUILTS_NAME}
48-
"${CMAKE_BINARY_DIR}/external/ffmpeg.zip" SHOW_PROGRESS
45+
if(NOT EXISTS "${CMAKE_BINARY_DIR}/3rdparty/ffmpeg.zip")
46+
set(FFMPEG_URL "https://github.com/RPCS3/ffmpeg-core/releases/download/${FFMPEG_GIT_SHA}/${FFMPEG_PREBUILTS_NAME}")
47+
message(STATUS "Downloading FFMPEG prebuilts from: ${FFMPEG_URL}")
48+
49+
file(DOWNLOAD "${FFMPEG_URL}"
50+
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg.zip" SHOW_PROGRESS
4951
STATUS FILE_STATUS)
5052
list(GET FILE_STATUS 0 STATUS_CODE)
5153
if (NOT STATUS_CODE EQUAL 0)
52-
file(REMOVE "${CMAKE_BINARY_DIR}/external/ffmpeg.zip") # CMake create 0 byte file even if URL is invalid. So need to delete it.
53-
message(FATAL_ERROR "No FFMPEG prebuilt found with corresponding commit SHA (${FFMPEG_GIT_SHA})")
54+
file(REMOVE "${CMAKE_BINARY_DIR}/3rdparty/ffmpeg.zip") # CMake create 0 byte file even if URL is invalid. So need to delete it.
55+
message(FATAL_ERROR "Failed to download FFMPEG prebuilts from: ${FFMPEG_URL}")
5456
endif()
5557
endif()
5658

57-
if(NOT EXISTS "${CMAKE_BINARY_DIR}/external/ffmpeg/lib")
58-
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/external/ffmpeg/lib")
59-
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_BINARY_DIR}/external/ffmpeg.zip"
60-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/external/ffmpeg/lib")
59+
if(NOT EXISTS "${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib")
60+
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf "${CMAKE_BINARY_DIR}/3rdparty/ffmpeg.zip"
61+
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/ffmpeg")
6162
endif()
6263

6364
set(LIB_PREFIX "lib")
@@ -75,9 +76,9 @@ elseif (APPLE)
7576
endif ()
7677

7778
target_link_libraries(${FFMPEG_CORE_NAME} INTERFACE
78-
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}avformat.${LIB_EXT}"
79-
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}avcodec.${LIB_EXT}"
80-
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}swscale.${LIB_EXT}"
81-
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}avutil.${LIB_EXT}"
82-
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}avfilter.${LIB_EXT}"
83-
"${CMAKE_BINARY_DIR}/external/ffmpeg/lib/${LIB_PREFIX}swresample.${LIB_EXT}")
79+
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}avformat.${LIB_EXT}"
80+
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}avcodec.${LIB_EXT}"
81+
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}swscale.${LIB_EXT}"
82+
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}avutil.${LIB_EXT}"
83+
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}avfilter.${LIB_EXT}"
84+
"${CMAKE_BINARY_DIR}/3rdparty/ffmpeg/lib/${LIB_PREFIX}swresample.${LIB_EXT}")

Readme.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
## FFmpeg builtins
22

3-
This repository contains the ffmpeg builtins for Vita3K and the CI to build them using vcpkg and github action.
3+
This repository contains the ffmpeg builtins for RPCS3 and the CI to build them using vcpkg and github action.
44

55
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.
6+
7+
How to update:
8+
- checkout https://github.com/microsoft/vcpkg to any directory (you only need it to create a ffmpeg.patch)
9+
- reset the vcpkg branch/HEAD to the latest tag
10+
- replace vcpkg commit/tag in .github/workflows/build.yml with the latest tag
11+
- manually apply the changes found in the current ffmpeg.patch as well as any new changes to the vcpkg/ports/ffmpeg/portfile.cmake
12+
- create new patch
13+
git diff > ffmpeg.patch
14+
- replace our ffmpeg.patch with the new ffmpeg.patch
15+
- push the two files changes to master (ffmpeg.patch and build.yml)
16+
- wait for and download the new release in github actions
17+
- replace new lib and include contents in our submodule

0 commit comments

Comments
 (0)