diff options
Diffstat (limited to '')
| -rw-r--r-- | CMakeLists.txt | 80 | ||||
| -rw-r--r-- | src/video_core/CMakeLists.txt | 1 |
2 files changed, 74 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c98c17607..fa8c852ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -544,6 +544,9 @@ endif() | |||
| 544 | 544 | ||
| 545 | if (YUZU_USE_BUNDLED_FFMPEG) | 545 | if (YUZU_USE_BUNDLED_FFMPEG) |
| 546 | if (NOT WIN32) | 546 | if (NOT WIN32) |
| 547 | # TODO(lat9nq): Move this to externals/ffmpeg/CMakeLists.txt (and move externals/ffmpeg to | ||
| 548 | # externals/ffmpeg/ffmpeg) | ||
| 549 | |||
| 547 | # Build FFmpeg from externals | 550 | # Build FFmpeg from externals |
| 548 | message(STATUS "Using FFmpeg from externals") | 551 | message(STATUS "Using FFmpeg from externals") |
| 549 | 552 | ||
| @@ -583,16 +586,23 @@ if (YUZU_USE_BUNDLED_FFMPEG) | |||
| 583 | CACHE PATH "Paths to FFmpeg libraries" FORCE) | 586 | CACHE PATH "Paths to FFmpeg libraries" FORCE) |
| 584 | endforeach() | 587 | endforeach() |
| 585 | 588 | ||
| 586 | set(FFmpeg_INCLUDE_DIR | 589 | Include(FindPkgConfig REQUIRED) |
| 587 | "${FFmpeg_PREFIX};${FFmpeg_BUILD_DIR}" | 590 | pkg_check_modules(LIBVA libva) |
| 588 | CACHE PATH "Path to FFmpeg headers" FORCE) | 591 | pkg_check_modules(CUDA cuda) |
| 592 | pkg_check_modules(FFNVCODEC ffnvcodec) | ||
| 593 | pkg_check_modules(VDPAU vdpau) | ||
| 594 | |||
| 595 | set(FFmpeg_HWACCEL_LIBRARIES) | ||
| 596 | set(FFmpeg_HWACCEL_FLAGS) | ||
| 597 | set(FFmpeg_HWACCEL_INCLUDE_DIRS) | ||
| 598 | set(FFmpeg_HWACCEL_LDFLAGS) | ||
| 589 | 599 | ||
| 590 | if(LIBVA_FOUND) | 600 | if(LIBVA_FOUND) |
| 591 | pkg_check_modules(LIBDRM libdrm REQUIRED) | 601 | pkg_check_modules(LIBDRM libdrm REQUIRED) |
| 592 | find_package(X11 REQUIRED) | 602 | find_package(X11 REQUIRED) |
| 593 | pkg_check_modules(LIBVA-DRM libva-drm REQUIRED) | 603 | pkg_check_modules(LIBVA-DRM libva-drm REQUIRED) |
| 594 | pkg_check_modules(LIBVA-X11 libva-x11 REQUIRED) | 604 | pkg_check_modules(LIBVA-X11 libva-x11 REQUIRED) |
| 595 | set(FFmpeg_LIBVA_LIBRARIES | 605 | list(APPEND FFmpeg_HWACCEL_LIBRARIES |
| 596 | ${LIBDRM_LIBRARIES} | 606 | ${LIBDRM_LIBRARIES} |
| 597 | ${X11_LIBRARIES} | 607 | ${X11_LIBRARIES} |
| 598 | ${LIBVA-DRM_LIBRARIES} | 608 | ${LIBVA-DRM_LIBRARIES} |
| @@ -602,11 +612,56 @@ if (YUZU_USE_BUNDLED_FFMPEG) | |||
| 602 | --enable-hwaccel=h264_vaapi | 612 | --enable-hwaccel=h264_vaapi |
| 603 | --enable-hwaccel=vp9_vaapi | 613 | --enable-hwaccel=vp9_vaapi |
| 604 | --enable-libdrm) | 614 | --enable-libdrm) |
| 615 | list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS | ||
| 616 | ${LIBDRM_INCLUDE_DIRS} | ||
| 617 | ${X11_INCLUDE_DIRS} | ||
| 618 | ${LIBVA-DRM_INCLUDE_DIRS} | ||
| 619 | ${LIBVA-X11_INCLUDE_DIRS} | ||
| 620 | ${LIBVA_INCLUDE_DIRS} | ||
| 621 | ) | ||
| 605 | message(STATUS "VA-API found") | 622 | message(STATUS "VA-API found") |
| 606 | else() | 623 | else() |
| 607 | set(FFmpeg_HWACCEL_FLAGS --disable-vaapi) | 624 | set(FFmpeg_HWACCEL_FLAGS --disable-vaapi) |
| 608 | endif() | 625 | endif() |
| 609 | 626 | ||
| 627 | if (FFNVCODEC_FOUND AND CUDA_FOUND) | ||
| 628 | list(APPEND FFmpeg_HWACCEL_FLAGS | ||
| 629 | --enable-cuvid | ||
| 630 | --enable-ffnvcodec | ||
| 631 | --enable-nvdec | ||
| 632 | --enable-hwaccel=h264_nvdec | ||
| 633 | --enable-hwaccel=vp9_nvdec | ||
| 634 | --extra-cflags=-I${CUDA_INCLUDE_DIRS} | ||
| 635 | ) | ||
| 636 | list(APPEND FFmpeg_HWACCEL_LIBRARIES | ||
| 637 | ${FFNVCODEC_LIBRARIES} | ||
| 638 | ${CUDA_LIBRARIES} | ||
| 639 | ) | ||
| 640 | list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS | ||
| 641 | ${FFNVCODEC_INCLUDE_DIRS} | ||
| 642 | ${CUDA_INCLUDE_DIRS} | ||
| 643 | ) | ||
| 644 | list(APPEND FFmpeg_HWACCEL_LDFLAGS | ||
| 645 | ${FFNVCODEC_LDFLAGS} | ||
| 646 | ${CUDA_LDFLAGS} | ||
| 647 | ) | ||
| 648 | message(STATUS "ffnvcodec libraries version ${FFNVCODEC_VERSION} found") | ||
| 649 | endif() | ||
| 650 | |||
| 651 | if (VDPAU_FOUND) | ||
| 652 | list(APPEND FFmpeg_HWACCEL_FLAGS | ||
| 653 | --enable-vdpau | ||
| 654 | --enable-hwaccel=h264_vdpau | ||
| 655 | --enable-hwaccel=vp9_vdpau | ||
| 656 | ) | ||
| 657 | list(APPEND FFmpeg_HWACCEL_LIBRARIES ${VDPAU_LIBRARIES}) | ||
| 658 | list(APPEND FFmpeg_HWACCEL_INCLUDE_DIRS ${VDPAU_INCLUDE_DIRS}) | ||
| 659 | list(APPEND FFmpeg_HWACCEL_LDFLAGS ${VDPAU_LDFLAGS}) | ||
| 660 | message(STATUS "vdpau libraries version ${VDPAU_VERSION} found") | ||
| 661 | else() | ||
| 662 | list(APPEND FFmpeg_HWACCEL_FLAGS --disable-vdpau) | ||
| 663 | endif() | ||
| 664 | |||
| 610 | # `configure` parameters builds only exactly what yuzu needs from FFmpeg | 665 | # `configure` parameters builds only exactly what yuzu needs from FFmpeg |
| 611 | # `--disable-vdpau` is needed to avoid linking issues | 666 | # `--disable-vdpau` is needed to avoid linking issues |
| 612 | add_custom_command( | 667 | add_custom_command( |
| @@ -624,7 +679,6 @@ if (YUZU_USE_BUNDLED_FFMPEG) | |||
| 624 | --disable-network | 679 | --disable-network |
| 625 | --disable-postproc | 680 | --disable-postproc |
| 626 | --disable-swresample | 681 | --disable-swresample |
| 627 | --disable-vdpau | ||
| 628 | --enable-decoder=h264 | 682 | --enable-decoder=h264 |
| 629 | --enable-decoder=vp9 | 683 | --enable-decoder=vp9 |
| 630 | --cc="${CMAKE_C_COMPILER}" | 684 | --cc="${CMAKE_C_COMPILER}" |
| @@ -653,15 +707,26 @@ if (YUZU_USE_BUNDLED_FFMPEG) | |||
| 653 | ${FFmpeg_BUILD_DIR} | 707 | ${FFmpeg_BUILD_DIR} |
| 654 | ) | 708 | ) |
| 655 | 709 | ||
| 710 | set(FFmpeg_INCLUDE_DIR | ||
| 711 | "${FFmpeg_PREFIX};${FFmpeg_BUILD_DIR};${FFmpeg_HWACCEL_INCLUDE_DIRS}" | ||
| 712 | CACHE PATH "Path to FFmpeg headers" FORCE) | ||
| 713 | |||
| 714 | set(FFmpeg_LDFLAGS | ||
| 715 | "${FFmpeg_HWACCEL_LDFLAGS}" | ||
| 716 | CACHE STRING "FFmpeg linker flags" FORCE) | ||
| 717 | |||
| 656 | # ALL makes this custom target build every time | 718 | # ALL makes this custom target build every time |
| 657 | # but it won't actually build if the DEPENDS parameter is up to date | 719 | # but it won't actually build if the DEPENDS parameter is up to date |
| 658 | add_custom_target(ffmpeg-configure ALL DEPENDS ${FFmpeg_MAKEFILE}) | 720 | add_custom_target(ffmpeg-configure ALL DEPENDS ${FFmpeg_MAKEFILE}) |
| 659 | add_custom_target(ffmpeg-build ALL DEPENDS ${FFmpeg_BUILD_LIBRARIES} ffmpeg-configure) | 721 | add_custom_target(ffmpeg-build ALL DEPENDS ${FFmpeg_BUILD_LIBRARIES} ffmpeg-configure) |
| 660 | link_libraries(${FFmpeg_LIBVA_LIBRARIES}) | 722 | link_libraries(${FFmpeg_LIBVA_LIBRARIES}) |
| 661 | set(FFmpeg_LIBRARIES ${FFmpeg_LIBVA_LIBRARIES} ${FFmpeg_BUILD_LIBRARIES} | 723 | set(FFmpeg_LIBRARIES ${FFmpeg_BUILD_LIBRARIES} ${FFmpeg_HWACCEL_LIBRARIES} |
| 662 | CACHE PATH "Paths to FFmpeg libraries" FORCE) | 724 | CACHE PATH "Paths to FFmpeg libraries" FORCE) |
| 663 | unset(FFmpeg_BUILD_LIBRARIES) | 725 | unset(FFmpeg_BUILD_LIBRARIES) |
| 664 | unset(FFmpeg_LIBVA_LIBRARIES) | 726 | unset(FFmpeg_HWACCEL_FLAGS) |
| 727 | unset(FFmpeg_HWACCEL_INCLUDE_DIRS) | ||
| 728 | unset(FFmpeg_HWACCEL_LDFLAGS) | ||
| 729 | unset(FFmpeg_HWACCEL_LIBRARIES) | ||
| 665 | 730 | ||
| 666 | if (FFmpeg_FOUND) | 731 | if (FFmpeg_FOUND) |
| 667 | message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}") | 732 | message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}") |
| @@ -676,6 +741,7 @@ if (YUZU_USE_BUNDLED_FFMPEG) | |||
| 676 | set(FFmpeg_FOUND YES) | 741 | set(FFmpeg_FOUND YES) |
| 677 | set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE) | 742 | set(FFmpeg_INCLUDE_DIR "${FFmpeg_PATH}/include" CACHE PATH "Path to FFmpeg headers" FORCE) |
| 678 | set(FFmpeg_LIBRARY_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg library directory" FORCE) | 743 | set(FFmpeg_LIBRARY_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg library directory" FORCE) |
| 744 | set(FFmpeg_LDFLAGS "" CACHE STRING "FFmpeg linker flags" FORCE) | ||
| 679 | set(FFmpeg_DLL_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg dll's" FORCE) | 745 | set(FFmpeg_DLL_DIR "${FFmpeg_PATH}/bin" CACHE PATH "Path to FFmpeg dll's" FORCE) |
| 680 | set(FFmpeg_LIBRARIES | 746 | set(FFmpeg_LIBRARIES |
| 681 | ${FFmpeg_LIBRARY_DIR}/swscale.lib | 747 | ${FFmpeg_LIBRARY_DIR}/swscale.lib |
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 2f6cdd216..269db21a5 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -231,6 +231,7 @@ endif() | |||
| 231 | 231 | ||
| 232 | target_include_directories(video_core PRIVATE ${FFmpeg_INCLUDE_DIR}) | 232 | target_include_directories(video_core PRIVATE ${FFmpeg_INCLUDE_DIR}) |
| 233 | target_link_libraries(video_core PRIVATE ${FFmpeg_LIBRARIES}) | 233 | target_link_libraries(video_core PRIVATE ${FFmpeg_LIBRARIES}) |
| 234 | target_link_options(video_core PRIVATE ${FFmpeg_LDFLAGS}) | ||
| 234 | 235 | ||
| 235 | add_dependencies(video_core host_shaders) | 236 | add_dependencies(video_core host_shaders) |
| 236 | target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE}) | 237 | target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE}) |