mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-11-27 16:20:11 +01:00
fixups
This commit is contained in:
parent
95433a24d4
commit
66444af17c
1 changed files with 102 additions and 99 deletions
201
externals/ffmpeg/CMakeLists.txt
vendored
201
externals/ffmpeg/CMakeLists.txt
vendored
|
|
@ -30,7 +30,6 @@ if (NOT YUZU_USE_BUNDLED_FFMPEG)
|
||||||
--extra-ldflags="--ld-path=${TOOLCHAIN}/bin/ld.lld"
|
--extra-ldflags="--ld-path=${TOOLCHAIN}/bin/ld.lld"
|
||||||
--extra-ldflags="-nostdlib"
|
--extra-ldflags="-nostdlib"
|
||||||
)
|
)
|
||||||
set(FFmpeg_IS_CROSS_COMPILING TRUE)
|
|
||||||
# User attempts to do a FFmpeg cross compilation because...
|
# User attempts to do a FFmpeg cross compilation because...
|
||||||
# Here we just quickly test against host/system processors not matching
|
# Here we just quickly test against host/system processors not matching
|
||||||
# TODO: Test for versions not matching as well?
|
# TODO: Test for versions not matching as well?
|
||||||
|
|
@ -47,111 +46,116 @@ if (NOT YUZU_USE_BUNDLED_FFMPEG)
|
||||||
--sysroot="${CMAKE_SYSROOT}"
|
--sysroot="${CMAKE_SYSROOT}"
|
||||||
--cross-prefix="${FFmpeg_CROSS_PREFIX}"
|
--cross-prefix="${FFmpeg_CROSS_PREFIX}"
|
||||||
)
|
)
|
||||||
set(FFmpeg_IS_CROSS_COMPILING TRUE)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (UNIX AND NOT ANDROID AND NOT DEFINED FFmpeg_IS_CROSS_COMPILING)
|
# Logic below looks for all hw accels related to X11 (vdpau and stuff)
|
||||||
find_package(PkgConfig REQUIRED)
|
# please note that this is NOT guaranteed to exist on some systems (for example
|
||||||
if (NOT ANDROID)
|
# headless cross compilations), or testing environments/CI
|
||||||
pkg_check_modules(LIBVA libva)
|
if (UNIX AND NOT ANDROID)
|
||||||
pkg_check_modules(CUDA cuda)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules(FFNVCODEC ffnvcodec)
|
if (PkgConfig_FOUND)
|
||||||
pkg_check_modules(VDPAU vdpau)
|
if (NOT ANDROID)
|
||||||
endif()
|
pkg_check_modules(LIBVA libva)
|
||||||
|
pkg_check_modules(CUDA cuda)
|
||||||
find_package(X11)
|
pkg_check_modules(FFNVCODEC ffnvcodec)
|
||||||
if(X11_FOUND)
|
pkg_check_modules(VDPAU vdpau)
|
||||||
if (NOT APPLE)
|
|
||||||
# In Solaris needs explicit linking for ffmpeg which links to /lib/amd64/libX11.so
|
|
||||||
if(PLATFORM_SUN)
|
|
||||||
find_library(LIBDRM_LIB libdrm PATHS /usr/lib/64 /usr/lib/amd64 /usr/lib)
|
|
||||||
if(LIBDRM_LIB)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
|
||||||
X11
|
|
||||||
"${LIBDRM_LIB}")
|
|
||||||
message(STATUS "Found libdrm at: ${LIBDRM_LIB}")
|
|
||||||
else()
|
|
||||||
message(WARNING "libdrm not found, disabling libdrm support")
|
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS
|
|
||||||
--disable-libdrm)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
pkg_check_modules(LIBDRM libdrm REQUIRED)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
|
||||||
${LIBDRM_LIBRARIES})
|
|
||||||
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS
|
|
||||||
${LIBDRM_INCLUDE_DIRS})
|
|
||||||
endif()
|
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS
|
|
||||||
--enable-libdrm)
|
|
||||||
endif()
|
endif()
|
||||||
if(LIBVA_FOUND)
|
find_package(X11)
|
||||||
pkg_check_modules(LIBVA-DRM libva-drm REQUIRED)
|
if(X11_FOUND)
|
||||||
pkg_check_modules(LIBVA-X11 libva-x11 REQUIRED)
|
if (NOT APPLE)
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
# In Solaris needs explicit linking for ffmpeg which links to /lib/amd64/libX11.so
|
||||||
${X11_LIBRARIES}
|
if(PLATFORM_SUN)
|
||||||
${LIBVA-DRM_LIBRARIES}
|
find_library(LIBDRM_LIB libdrm PATHS /usr/lib/64 /usr/lib/amd64 /usr/lib)
|
||||||
${LIBVA-X11_LIBRARIES}
|
if(LIBDRM_LIB)
|
||||||
${LIBVA_LIBRARIES})
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS
|
X11
|
||||||
--enable-hwaccel=h264_vaapi
|
"${LIBDRM_LIB}")
|
||||||
--enable-hwaccel=vp8_vaapi
|
message(STATUS "Found libdrm at: ${LIBDRM_LIB}")
|
||||||
--enable-hwaccel=vp9_vaapi)
|
else()
|
||||||
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS
|
message(WARNING "libdrm not found, disabling libdrm support")
|
||||||
${X11_INCLUDE_DIRS}
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
${LIBVA-DRM_INCLUDE_DIRS}
|
--disable-libdrm)
|
||||||
${LIBVA-X11_INCLUDE_DIRS}
|
endif()
|
||||||
${LIBVA_INCLUDE_DIRS}
|
else()
|
||||||
)
|
pkg_check_modules(LIBDRM libdrm REQUIRED)
|
||||||
message(STATUS "ffmpeg: va-api libraries version ${LIBVA_VERSION} found")
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
||||||
|
${LIBDRM_LIBRARIES})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS
|
||||||
|
${LIBDRM_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
|
--enable-libdrm)
|
||||||
|
endif()
|
||||||
|
if(LIBVA_FOUND)
|
||||||
|
pkg_check_modules(LIBVA-DRM libva-drm REQUIRED)
|
||||||
|
pkg_check_modules(LIBVA-X11 libva-x11 REQUIRED)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES
|
||||||
|
${X11_LIBRARIES}
|
||||||
|
${LIBVA-DRM_LIBRARIES}
|
||||||
|
${LIBVA-X11_LIBRARIES}
|
||||||
|
${LIBVA_LIBRARIES})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
|
--enable-hwaccel=h264_vaapi
|
||||||
|
--enable-hwaccel=vp8_vaapi
|
||||||
|
--enable-hwaccel=vp9_vaapi)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS
|
||||||
|
${X11_INCLUDE_DIRS}
|
||||||
|
${LIBVA-DRM_INCLUDE_DIRS}
|
||||||
|
${LIBVA-X11_INCLUDE_DIRS}
|
||||||
|
${LIBVA_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
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 Acceleration API (VA-API)...")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi)
|
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi)
|
||||||
message(WARNING "ffmpeg: libva-dev not found, disabling Video Acceleration API (VA-API)...")
|
message(WARNING "ffmpeg: X11 libraries not found, disabling VA-API...")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFNVCODEC_FOUND)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
|
--enable-cuvid
|
||||||
|
--enable-ffnvcodec
|
||||||
|
--enable-nvdec
|
||||||
|
--enable-hwaccel=h264_nvdec
|
||||||
|
--enable-hwaccel=vp8_nvdec
|
||||||
|
--enable-hwaccel=vp9_nvdec
|
||||||
|
)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${FFNVCODEC_LIBRARIES})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${FFNVCODEC_INCLUDE_DIRS})
|
||||||
|
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 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 version ${CUDA_VERSION} found, hard-linking will be performed")
|
||||||
|
endif(CUDA_FOUND)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (VDPAU_FOUND AND NOT APPLE)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_FLAGS
|
||||||
|
--enable-vdpau
|
||||||
|
--enable-hwaccel=h264_vdpau
|
||||||
|
--enable-hwaccel=vp9_vdpau
|
||||||
|
)
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${VDPAU_LIBRARIES})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${VDPAU_INCLUDE_DIRS})
|
||||||
|
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${VDPAU_LDFLAGS})
|
||||||
|
message(STATUS "ffmpeg: vdpau libraries version ${VDPAU_VERSION} found")
|
||||||
|
else()
|
||||||
|
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()
|
||||||
else()
|
else()
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vaapi)
|
message(WARNING "ffmpeg: PkgConfig not found -- assuming headless")
|
||||||
message(WARNING "ffmpeg: X11 libraries not found, disabling VA-API...")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (FFNVCODEC_FOUND)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS
|
|
||||||
--enable-cuvid
|
|
||||||
--enable-ffnvcodec
|
|
||||||
--enable-nvdec
|
|
||||||
--enable-hwaccel=h264_nvdec
|
|
||||||
--enable-hwaccel=vp8_nvdec
|
|
||||||
--enable-hwaccel=vp9_nvdec
|
|
||||||
)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${FFNVCODEC_LIBRARIES})
|
|
||||||
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${FFNVCODEC_INCLUDE_DIRS})
|
|
||||||
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 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 version ${CUDA_VERSION} found, hard-linking will be performed")
|
|
||||||
endif(CUDA_FOUND)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (VDPAU_FOUND AND NOT APPLE)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_FLAGS
|
|
||||||
--enable-vdpau
|
|
||||||
--enable-hwaccel=h264_vdpau
|
|
||||||
--enable-hwaccel=vp9_vdpau
|
|
||||||
)
|
|
||||||
list(APPEND FFmpeg_HWACCEL_LIBRARIES ${VDPAU_LIBRARIES})
|
|
||||||
list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${VDPAU_INCLUDE_DIRS})
|
|
||||||
list(APPEND FFmpeg_HWACCEL_LDFLAGS ${VDPAU_LDFLAGS})
|
|
||||||
message(STATUS "ffmpeg: vdpau libraries version ${VDPAU_VERSION} found")
|
|
||||||
else()
|
|
||||||
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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
@ -249,7 +253,6 @@ else()
|
||||||
--enable-pic
|
--enable-pic
|
||||||
--cc="${FFmpeg_CC}"
|
--cc="${FFmpeg_CC}"
|
||||||
--cxx="${FFmpeg_CXX}"
|
--cxx="${FFmpeg_CXX}"
|
||||||
${FFmpeg_CROSS_COMPILE_FLAG}
|
|
||||||
${FFmpeg_HWACCEL_FLAGS}
|
${FFmpeg_HWACCEL_FLAGS}
|
||||||
${FFmpeg_CROSS_COMPILE_FLAGS}
|
${FFmpeg_CROSS_COMPILE_FLAGS}
|
||||||
WORKING_DIRECTORY
|
WORKING_DIRECTORY
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue