diff options
| author | crueter <crueter@eden-emu.dev> | 2025-09-23 19:38:11 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-09-23 19:38:11 +0200 |
| commit | 76a8a6e03926e7bcc6111f92b894fdae4d0a17ea (patch) | |
| tree | 9db20525e93f623d2741749757f88317fee9980d /externals | |
| parent | 49ddf95c709b9a322f4b2c1d0068c8365a558783 (diff) | |
[cmake] feat: FFmpeg CI, allow 16kb android builds, update translations for transifex (#2543)
Uses an FFmpeg CI for Android and Windows, also available for Linux. Saves compile time on Linux and is more consistent on Windows/Android.
Also, updates VVL and FFmpeg to allow for a fully 16kb-compliant Android build. Bonus: APK size is down 30%
Updated all localization files for Transifex while I was at it
TODO for future: Android 8.0 with vp9_vulkan et al.
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2543
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'externals')
| -rw-r--r-- | externals/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | externals/ffmpeg/CMakeLists.txt | 189 | ||||
| -rw-r--r-- | externals/ffmpeg/cpmfile.json | 12 |
3 files changed, 104 insertions, 107 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index ce1450e241..754ba61a0b 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -25,10 +25,6 @@ set(BUILD_SHARED_LIBS OFF) # Skip install rules for all externals set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON) -if (FORCE_DOWNLOAD_WIN_BUNDLES) - download_win_archives() -endif() - # Xbyak (also used by Dynarmic, so needs to be added first) if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) if (PLATFORM_SUN OR PLATFORM_OPENBSD) @@ -97,12 +93,16 @@ endif() AddJsonPackage(unordered-dense) # FFMpeg -if (YUZU_USE_BUNDLED_FFMPEG) +if (YUZU_USE_EXTERNAL_FFMPEG OR YUZU_USE_BUNDLED_FFMPEG) add_subdirectory(ffmpeg) + set(FFmpeg_PATH "${FFmpeg_PATH}" PARENT_SCOPE) set(FFmpeg_LDFLAGS "${FFmpeg_LDFLAGS}" PARENT_SCOPE) set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" PARENT_SCOPE) + set(FFmpeg_LIBRARY_DIR "${FFmpeg_LIBRARY_DIR}" PARENT_SCOPE) set(FFmpeg_INCLUDE_DIR "${FFmpeg_INCLUDE_DIR}" PARENT_SCOPE) + + message(STATUS "FFmpeg Libraries: ${FFmpeg_LIBRARIES}") endif() # TZDB (Time Zone Database) diff --git a/externals/ffmpeg/CMakeLists.txt b/externals/ffmpeg/CMakeLists.txt index c5a8b3555b..59397f6acb 100644 --- a/externals/ffmpeg/CMakeLists.txt +++ b/externals/ffmpeg/CMakeLists.txt @@ -6,51 +6,14 @@ include(CPMUtil) -if (NOT WIN32 AND NOT ANDROID) - # Build FFmpeg from externals - message(STATUS "Using FFmpeg from externals") - - if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)") - # FFmpeg has source that requires one of nasm or yasm to assemble it. - # REQUIRED throws an error if not found here during configuration rather than during compilation. - find_program(ASSEMBLER NAMES nasm yasm) - if ("${ASSEMBLER}" STREQUAL "ASSEMBLER-NOTFOUND") - message(FATAL_ERROR "One of either `nasm` or `yasm` not found but is required.") - endif() - endif() - - find_program(AUTOCONF autoconf) - if ("${AUTOCONF}" STREQUAL "AUTOCONF-NOTFOUND") - message(FATAL_ERROR "Required program `autoconf` not found.") - endif() - - AddJsonPackage(ffmpeg) - - set(FFmpeg_PREFIX ${ffmpeg_SOURCE_DIR}) - set(FFmpeg_BUILD_DIR ${ffmpeg_BINARY_DIR}) - set(FFmpeg_MAKEFILE ${FFmpeg_BUILD_DIR}/Makefile) - make_directory(${FFmpeg_BUILD_DIR}) - - # Read version string from external - file(READ ${FFmpeg_PREFIX}/RELEASE FFmpeg_VERSION) - set(FFmpeg_FOUND NO) - if (NOT FFmpeg_VERSION STREQUAL "") - set(FFmpeg_FOUND YES) - endif() +# TODO(crueter, MaranBr): Externals FFmpeg 8.0 - unset(FFmpeg_LIBRARIES CACHE) - - foreach(COMPONENT ${FFmpeg_COMPONENTS}) - set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}") - set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a") - set(FFmpeg_${COMPONENT}_LIBRARY "${FFmpeg_${COMPONENT}_PREFIX}/${FFmpeg_${COMPONENT}_LIB_NAME}") - - set(FFmpeg_LIBRARIES - ${FFmpeg_LIBRARIES} - ${FFmpeg_${COMPONENT}_LIBRARY} - CACHE PATH "Paths to FFmpeg libraries" FORCE) - endforeach() +set(FFmpeg_HWACCEL_LIBRARIES) +set(FFmpeg_HWACCEL_FLAGS) +set(FFmpeg_HWACCEL_INCLUDE_DIRS) +set(FFmpeg_HWACCEL_LDFLAGS) +if (UNIX AND NOT ANDROID) find_package(PkgConfig REQUIRED) if (NOT ANDROID) pkg_check_modules(LIBVA libva) @@ -59,11 +22,6 @@ if (NOT WIN32 AND NOT ANDROID) pkg_check_modules(VDPAU vdpau) endif() - set(FFmpeg_HWACCEL_LIBRARIES) - set(FFmpeg_HWACCEL_FLAGS) - set(FFmpeg_HWACCEL_INCLUDE_DIRS) - set(FFmpeg_HWACCEL_LDFLAGS) - if (NOT APPLE) # In Solaris needs explicit linking for ffmpeg which links to /lib/amd64/libX11.so if(PLATFORM_SUN) @@ -103,7 +61,7 @@ if (NOT WIN32 AND NOT ANDROID) message(STATUS "ffmpeg: va-api libraries version ${LIBVA_VERSION} found") else() list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi) - message(WARNING "ffmpeg: libva-dev not found, disabling Video Aceleraion API (VA-API)...") + message(WARNING "ffmpeg: libva-dev not found, disabling Video Acceleration API (VA-API)...") endif() if (FFNVCODEC_FOUND) @@ -120,14 +78,14 @@ if (NOT WIN32 AND NOT ANDROID) list(APPEND FFmpeg_HWACCEL_LDFLAGS ${FFNVCODEC_LDFLAGS}) message(STATUS "ffmpeg: ffnvcodec libraries version ${FFNVCODEC_VERSION} found") # ffnvenc could load CUDA libraries at the runtime using dlopen/dlsym or LoadLibrary/GetProcAddress - # here we handle the hard-linking senario where CUDA is linked during compilation + # here we handle the hard-linking scenario where CUDA is linked during compilation if (CUDA_FOUND) # This line causes build error if CUDA_INCLUDE_DIRS is anything but a single non-empty value #list(APPEND FFmpeg_HWACCEL_FLAGS --extra-cflags=-I${CUDA_INCLUDE_DIRS}) list(APPEND FFmpeg_HWACCEL_LIBRARIES ${CUDA_LIBRARIES}) list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS}) list(APPEND FFmpeg_HWACCEL_LDFLAGS ${CUDA_LDFLAGS}) - message(STATUS "ffmpeg: CUDA libraries found, hard-linking will be performed") + message(STATUS "ffmpeg: CUDA libraries version ${CUDA_VERSION} found, hard-linking will be performed") endif(CUDA_FOUND) endif() @@ -145,6 +103,84 @@ if (NOT WIN32 AND NOT ANDROID) list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vdpau) message(WARNING "ffmpeg: libvdpau-dev not found, disabling Video Decode and Presentation API for Unix (VDPAU)...") endif() +endif() + +if (YUZU_USE_BUNDLED_FFMPEG) + # MSVC conflicts with ksuser otherwise + # Android needs some deps to be compiled with PIC (TODO) + # TODO(crueter) fix + if (MSVC OR ANDROID) + set(BUILD_SHARED_LIBS ON) + else() + set(BUILD_SHARED_LIBS OFF) + endif() + + AddJsonPackage(ffmpeg-ci) + + set(FFmpeg_INCLUDE_DIR + "${FFmpeg_SOURCE_DIR}/include;${FFmpeg_HWACCEL_INCLUDE_DIRS}" + PARENT_SCOPE + ) + + set(FFmpeg_PATH + "${FFmpeg_SOURCE_DIR}" + PARENT_SCOPE + ) + + set(FFmpeg_LIBRARY_DIR + "${FFmpeg_SOURCE_DIR}/bin" + PARENT_SCOPE + ) + + set(FFmpeg_LIBRARIES + FFmpeg::FFmpeg + ${FFmpeg_HWACCEL_LIBRARIES} + PARENT_SCOPE + ) +else() + # Build FFmpeg from externals + message(STATUS "Using FFmpeg from externals") + + if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)") + # FFmpeg has source that requires one of nasm or yasm to assemble it. + # REQUIRED throws an error if not found here during configuration rather than during compilation. + find_program(ASSEMBLER NAMES nasm yasm) + if ("${ASSEMBLER}" STREQUAL "ASSEMBLER-NOTFOUND") + message(FATAL_ERROR "One of either `nasm` or `yasm` not found but is required.") + endif() + endif() + + find_program(AUTOCONF autoconf) + if ("${AUTOCONF}" STREQUAL "AUTOCONF-NOTFOUND") + message(FATAL_ERROR "Required program `autoconf` not found.") + endif() + + AddJsonPackage(ffmpeg) + + set(FFmpeg_PREFIX ${ffmpeg_SOURCE_DIR}) + set(FFmpeg_BUILD_DIR ${ffmpeg_BINARY_DIR}) + set(FFmpeg_MAKEFILE ${FFmpeg_BUILD_DIR}/Makefile) + make_directory(${FFmpeg_BUILD_DIR}) + + # Read version string from external + file(READ ${FFmpeg_PREFIX}/RELEASE FFmpeg_VERSION) + set(FFmpeg_FOUND NO) + if (NOT FFmpeg_VERSION STREQUAL "") + set(FFmpeg_FOUND YES) + endif() + + unset(FFmpeg_LIBRARIES CACHE) + + foreach(COMPONENT ${FFmpeg_COMPONENTS}) + set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}") + set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a") + set(FFmpeg_${COMPONENT}_LIBRARY "${FFmpeg_${COMPONENT}_PREFIX}/${FFmpeg_${COMPONENT}_LIB_NAME}") + + set(FFmpeg_LIBRARIES + ${FFmpeg_LIBRARIES} + ${FFmpeg_${COMPONENT}_LIBRARY} + CACHE PATH "Paths to FFmpeg libraries" FORCE) + endforeach() find_program(BASH_PROGRAM bash REQUIRED) @@ -245,57 +281,6 @@ if (NOT WIN32 AND NOT ANDROID) else() message(FATAL_ERROR "FFmpeg not found") endif() -elseif(ANDROID) - # Use yuzu FFmpeg binaries - if (ARCHITECTURE_arm64) - set(FFmpeg_EXT_NAME "ffmpeg-android-7.1.1-aarch64") - elseif (ARCHITECTURE_x86_64) - set(FFmpeg_EXT_NAME "ffmpeg-android-v5.1.LTS-x86_64") - else() - message(FATAL_ERROR "Unsupported architecture for Android FFmpeg") - endif() - - download_bundled_external("ffmpeg/" ${FFmpeg_EXT_NAME} "ffmpeg-bundled" FFmpeg_PATH 7.1.1) - set(FFmpeg_FOUND YES) - set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE) - set(FFmpeg_LIBRARY_DIR "${FFmpeg_PATH}/lib" CACHE PATH "Path to FFmpeg library directory" FORCE) - set(FFmpeg_LDFLAGS "" CACHE STRING "FFmpeg linker flags" FORCE) - set(FFmpeg_LIBRARIES - ${FFmpeg_LIBRARY_DIR}/libavcodec.so - ${FFmpeg_LIBRARY_DIR}/libavdevice.so - ${FFmpeg_LIBRARY_DIR}/libavfilter.so - ${FFmpeg_LIBRARY_DIR}/libavformat.so - ${FFmpeg_LIBRARY_DIR}/libavutil.so - ${FFmpeg_LIBRARY_DIR}/libswresample.so - ${FFmpeg_LIBRARY_DIR}/libswscale.so - ${FFmpeg_LIBRARY_DIR}/libvpx.a - ${FFmpeg_LIBRARY_DIR}/libx264.a - CACHE PATH "Paths to FFmpeg libraries" FORCE) - # exported variables - set(FFmpeg_PATH "${FFmpeg_PATH}" PARENT_SCOPE) - set(FFmpeg_LDFLAGS "${FFmpeg_LDFLAGS}" PARENT_SCOPE) - set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" PARENT_SCOPE) - set(FFmpeg_INCLUDE_DIR "${FFmpeg_INCLUDE_DIR}" PARENT_SCOPE) -elseif(WIN32) - # Use yuzu FFmpeg binaries - set(FFmpeg_EXT_NAME "ffmpeg-7.1.1") - - download_bundled_external("ffmpeg/" ${FFmpeg_EXT_NAME} "ffmpeg-bundled" FFmpeg_PATH 7.1.1) - set(FFmpeg_FOUND YES) - set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE) - set(FFmpeg_LIBRARY_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg library directory" FORCE) - set(FFmpeg_LDFLAGS "" CACHE STRING "FFmpeg linker flags" FORCE) - set(FFmpeg_LIBRARIES - ${FFmpeg_LIBRARY_DIR}/swscale.lib - ${FFmpeg_LIBRARY_DIR}/avcodec.lib - ${FFmpeg_LIBRARY_DIR}/avfilter.lib - ${FFmpeg_LIBRARY_DIR}/avutil.lib - CACHE PATH "Paths to FFmpeg libraries" FORCE) - # exported variables - set(FFmpeg_PATH "${FFmpeg_PATH}" PARENT_SCOPE) - set(FFmpeg_LDFLAGS "${FFmpeg_LDFLAGS}" PARENT_SCOPE) - set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" PARENT_SCOPE) - set(FFmpeg_INCLUDE_DIR "${FFmpeg_INCLUDE_DIR}" PARENT_SCOPE) endif() unset(FFmpeg_COMPONENTS) diff --git a/externals/ffmpeg/cpmfile.json b/externals/ffmpeg/cpmfile.json index dd9179703e..9b9efaadde 100644 --- a/externals/ffmpeg/cpmfile.json +++ b/externals/ffmpeg/cpmfile.json @@ -4,5 +4,17 @@ "sha": "c2184b65d2", "hash": "2a89d664119debbb3c006ab1c48d5d7f26e889f4a65ad2e25c8b0503308295123d5a9c5c78bf683aef5ff09acef8c3fc2837f22d3e8c611528b933bf03bcdd97", "bundled": true + }, + "ffmpeg-ci": { + "ci": true, + "package": "FFmpeg", + "name": "ffmpeg", + "repo": "crueter-ci/FFmpeg", + "version": "8.0", + "min_version": "4.1", + "disabled_platforms": [ + "freebsd", + "solaris" + ] } } |
