summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authoryzct12345 <87620833+yzct12345@users.noreply.github.com>2021-08-04 05:43:11 +0200
committerGitHub <noreply@github.com>2021-08-04 05:43:11 +0200
commit2868d4ba84f43c9bf3c7b6997ddcafb6e65c4a02 (patch)
tree7cb19f8de5b5b37db87fa331d9b3c951ce372b4b /CMakeLists.txt
parentMerge pull request #6805 from lat9nq/fix-user-profiles (diff)
downloadyuzu-2868d4ba84f43c9bf3c7b6997ddcafb6e65c4a02.tar
yuzu-2868d4ba84f43c9bf3c7b6997ddcafb6e65c4a02.tar.gz
yuzu-2868d4ba84f43c9bf3c7b6997ddcafb6e65c4a02.tar.bz2
yuzu-2868d4ba84f43c9bf3c7b6997ddcafb6e65c4a02.tar.lz
yuzu-2868d4ba84f43c9bf3c7b6997ddcafb6e65c4a02.tar.xz
yuzu-2868d4ba84f43c9bf3c7b6997ddcafb6e65c4a02.tar.zst
yuzu-2868d4ba84f43c9bf3c7b6997ddcafb6e65c4a02.zip
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt39
1 files changed, 35 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 92c9929cf..de2413843 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -583,8 +583,32 @@ if (YUZU_USE_BUNDLED_FFMPEG)
"${FFmpeg_PREFIX};${FFmpeg_BUILD_DIR}"
CACHE PATH "Path to FFmpeg headers" FORCE)
+ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+ Include(FindPkgConfig REQUIRED)
+ pkg_check_modules(LIBVA libva)
+ endif()
+ if(LIBVA_FOUND)
+ pkg_check_modules(LIBDRM libdrm REQUIRED)
+ find_package(X11 REQUIRED)
+ pkg_check_modules(LIBVA-DRM libva-drm REQUIRED)
+ pkg_check_modules(LIBVA-X11 libva-x11 REQUIRED)
+ set(FFmpeg_LIBVA_LIBRARIES
+ ${LIBDRM_LIBRARIES}
+ ${X11_LIBRARIES}
+ ${LIBVA-DRM_LIBRARIES}
+ ${LIBVA-X11_LIBRARIES}
+ ${LIBVA_LIBRARIES})
+ set(FFmpeg_HWACCEL_FLAGS
+ --enable-hwaccel=h264_vaapi
+ --enable-hwaccel=vp9_vaapi
+ --enable-libdrm)
+ message(STATUS "VA-API found")
+ else()
+ set(FFmpeg_HWACCEL_FLAGS --disable-vaapi)
+ endif()
+
# `configure` parameters builds only exactly what yuzu needs from FFmpeg
- # `--disable-{vaapi,vdpau}` is needed to avoid linking issues
+ # `--disable-vdpau` is needed to avoid linking issues
add_custom_command(
OUTPUT
${FFmpeg_MAKEFILE}
@@ -600,15 +624,16 @@ if (YUZU_USE_BUNDLED_FFMPEG)
--disable-network
--disable-postproc
--disable-swresample
- --disable-vaapi
--disable-vdpau
--enable-decoder=h264
--enable-decoder=vp9
--cc="${CMAKE_C_COMPILER}"
--cxx="${CMAKE_CXX_COMPILER}"
+ ${FFmpeg_HWACCEL_FLAGS}
WORKING_DIRECTORY
${FFmpeg_BUILD_DIR}
)
+ unset(FFmpeg_HWACCEL_FLAGS)
# Workaround for Ubuntu 18.04's older version of make not being able to call make as a child
# with context of the jobserver. Also helps ninja users.
@@ -618,9 +643,10 @@ if (YUZU_USE_BUNDLED_FFMPEG)
OUTPUT_VARIABLE
SYSTEM_THREADS)
+ set(FFmpeg_BUILD_LIBRARIES ${FFmpeg_LIBRARIES})
add_custom_command(
OUTPUT
- ${FFmpeg_LIBRARIES}
+ ${FFmpeg_BUILD_LIBRARIES}
COMMAND
make -j${SYSTEM_THREADS}
WORKING_DIRECTORY
@@ -630,7 +656,12 @@ if (YUZU_USE_BUNDLED_FFMPEG)
# ALL makes this custom target build every time
# but it won't actually build if the DEPENDS parameter is up to date
add_custom_target(ffmpeg-configure ALL DEPENDS ${FFmpeg_MAKEFILE})
- add_custom_target(ffmpeg-build ALL DEPENDS ${FFmpeg_LIBRARIES} ffmpeg-configure)
+ add_custom_target(ffmpeg-build ALL DEPENDS ${FFmpeg_BUILD_LIBRARIES} ffmpeg-configure)
+ link_libraries(${FFmpeg_LIBVA_LIBRARIES})
+ set(FFmpeg_LIBRARIES ${FFmpeg_LIBVA_LIBRARIES} ${FFmpeg_BUILD_LIBRARIES}
+ CACHE PATH "Paths to FFmpeg libraries" FORCE)
+ unset(FFmpeg_BUILD_LIBRARIES)
+ unset(FFmpeg_LIBVA_LIBRARIES)
if (FFmpeg_FOUND)
message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}")