mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 04:10:07 +00:00
CMakeLists: Use bundled FFmpeg as a fallback
Sets YUZU_USE_BUNDLED_FFMPEG as a CMake dependent option that is OFF on Linux and ON for WIN32 targets. If FFmpeg is not found when YUZU_USE_BUNDLED_FFMPEG is OFF, the bundled module/binaries are used instead. Reverts earlier changes to FindFFmpeg a bit, mostly to keep parity with it's Citra version a bit. Now _FFmpeg_ALL_COMPONENTS lists all components. We overwrite FFmpeg_LIBRARIES and FFmpeg_INCLUDE_DIR after using the module.
This commit is contained in:
parent
8b54e219c9
commit
527188391c
@ -18,7 +18,7 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "EN
|
|||||||
|
|
||||||
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
|
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
|
||||||
|
|
||||||
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled yuzu" ON)
|
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled yuzu" ON "WIN32" OFF)
|
||||||
|
|
||||||
option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
|
option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
|
||||||
|
|
||||||
@ -386,6 +386,32 @@ if (NOT LIBUSB_FOUND)
|
|||||||
set(LIBUSB_LIBRARIES usb)
|
set(LIBUSB_LIBRARIES usb)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# List of all FFmpeg components required
|
||||||
|
set(FFmpeg_COMPONENTS
|
||||||
|
avcodec
|
||||||
|
avutil
|
||||||
|
swscale)
|
||||||
|
|
||||||
|
if (NOT YUZU_USE_BUNDLED_FFMPEG)
|
||||||
|
# Use system installed FFmpeg
|
||||||
|
find_package(FFmpeg REQUIRED COMPONENTS ${FFmpeg_COMPONENTS})
|
||||||
|
|
||||||
|
if (FFmpeg_FOUND)
|
||||||
|
# Overwrite aggregate defines from FFmpeg module to avoid over-linking libraries.
|
||||||
|
# Prevents shipping too many libraries with the AppImage.
|
||||||
|
set(FFmpeg_LIBRARIES "")
|
||||||
|
set(FFmpeg_INCLUDE_DIR "")
|
||||||
|
|
||||||
|
foreach(COMPONENT ${FFmpeg_COMPONENTS})
|
||||||
|
set(FFmpeg_LIBRARIES ${FFmpeg_LIBRARIES} ${FFmpeg_LIBRARY_${COMPONENT}} CACHE PATH "Paths to FFmpeg libraries" FORCE)
|
||||||
|
set(FFmpeg_INCLUDE_DIR ${FFmpeg_INCLUDE_DIR} ${FFmpeg_INCLUDE_${COMPONENT}} CACHE PATH "Path to FFmpeg headers" FORCE)
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
message(WARNING "FFmpeg not found, falling back to externals")
|
||||||
|
set(YUZU_USE_BUNDLED_FFMPEG ON)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if (YUZU_USE_BUNDLED_FFMPEG)
|
if (YUZU_USE_BUNDLED_FFMPEG)
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
# Build FFmpeg from externals
|
# Build FFmpeg from externals
|
||||||
@ -407,11 +433,6 @@ if (YUZU_USE_BUNDLED_FFMPEG)
|
|||||||
set(FFmpeg_FOUND YES)
|
set(FFmpeg_FOUND YES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(FFmpeg_COMPONENTS
|
|
||||||
avcodec
|
|
||||||
avutil
|
|
||||||
swscale)
|
|
||||||
|
|
||||||
foreach(COMPONENT ${FFmpeg_COMPONENTS})
|
foreach(COMPONENT ${FFmpeg_COMPONENTS})
|
||||||
set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}")
|
set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}")
|
||||||
set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a")
|
set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a")
|
||||||
@ -496,15 +517,10 @@ if (YUZU_USE_BUNDLED_FFMPEG)
|
|||||||
${FFmpeg_LIBRARY_DIR}/avutil.lib
|
${FFmpeg_LIBRARY_DIR}/avutil.lib
|
||||||
CACHE PATH "Paths to FFmpeg libraries" FORCE)
|
CACHE PATH "Paths to FFmpeg libraries" FORCE)
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
# Use system installed FFmpeg
|
|
||||||
find_package(FFmpeg REQUIRED)
|
|
||||||
|
|
||||||
if (NOT FFmpeg_FOUND)
|
|
||||||
message(FATAL_ERROR "FFmpeg not found")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
unset(FFmpeg_COMPONENTS)
|
||||||
|
|
||||||
# Prefer the -pthread flag on Linux.
|
# Prefer the -pthread flag on Linux.
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
21
externals/find-modules/FindFFmpeg.cmake
vendored
21
externals/find-modules/FindFFmpeg.cmake
vendored
@ -22,19 +22,24 @@
|
|||||||
#
|
#
|
||||||
# <component> can be one of:
|
# <component> can be one of:
|
||||||
# avcodec
|
# avcodec
|
||||||
# avdevice # Disabled
|
# avdevice
|
||||||
# avfilter # Disabled
|
# avfilter
|
||||||
# avformat # Disabled
|
# avformat
|
||||||
# avutil
|
# avutil
|
||||||
# postproc # Disabled
|
# postproc
|
||||||
# swresample # Disabled
|
# swresample
|
||||||
# swscale
|
# swscale
|
||||||
#
|
#
|
||||||
|
|
||||||
set(_FFmpeg_ALL_COMPONENTS
|
set(_FFmpeg_ALL_COMPONENTS
|
||||||
avcodec
|
avcodec
|
||||||
avutil
|
avdevice
|
||||||
swscale
|
avfilter
|
||||||
|
avformat
|
||||||
|
avutil
|
||||||
|
postproc
|
||||||
|
swresample
|
||||||
|
swscale
|
||||||
)
|
)
|
||||||
|
|
||||||
set(_FFmpeg_DEPS_avcodec avutil)
|
set(_FFmpeg_DEPS_avcodec avutil)
|
||||||
|
Loading…
Reference in New Issue
Block a user