diff options
Diffstat (limited to '')
| -rw-r--r-- | CMakeLists.txt | 42 | ||||
| -rw-r--r-- | externals/find-modules/FindFFmpeg.cmake | 21 |
2 files changed, 42 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b25a21de..ac7c3ce90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -18,7 +18,7 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "EN | |||
| 18 | 18 | ||
| 19 | option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) | 19 | option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) |
| 20 | 20 | ||
| 21 | option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled yuzu" ON) | 21 | CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled yuzu" ON "WIN32" OFF) |
| 22 | 22 | ||
| 23 | option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF) | 23 | option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF) |
| 24 | 24 | ||
| @@ -386,6 +386,32 @@ if (NOT LIBUSB_FOUND) | |||
| 386 | set(LIBUSB_LIBRARIES usb) | 386 | set(LIBUSB_LIBRARIES usb) |
| 387 | endif() | 387 | endif() |
| 388 | 388 | ||
| 389 | # List of all FFmpeg components required | ||
| 390 | set(FFmpeg_COMPONENTS | ||
| 391 | avcodec | ||
| 392 | avutil | ||
| 393 | swscale) | ||
| 394 | |||
| 395 | if (NOT YUZU_USE_BUNDLED_FFMPEG) | ||
| 396 | # Use system installed FFmpeg | ||
| 397 | find_package(FFmpeg REQUIRED COMPONENTS ${FFmpeg_COMPONENTS}) | ||
| 398 | |||
| 399 | if (FFmpeg_FOUND) | ||
| 400 | # Overwrite aggregate defines from FFmpeg module to avoid over-linking libraries. | ||
| 401 | # Prevents shipping too many libraries with the AppImage. | ||
| 402 | set(FFmpeg_LIBRARIES "") | ||
| 403 | set(FFmpeg_INCLUDE_DIR "") | ||
| 404 | |||
| 405 | foreach(COMPONENT ${FFmpeg_COMPONENTS}) | ||
| 406 | set(FFmpeg_LIBRARIES ${FFmpeg_LIBRARIES} ${FFmpeg_LIBRARY_${COMPONENT}} CACHE PATH "Paths to FFmpeg libraries" FORCE) | ||
| 407 | set(FFmpeg_INCLUDE_DIR ${FFmpeg_INCLUDE_DIR} ${FFmpeg_INCLUDE_${COMPONENT}} CACHE PATH "Path to FFmpeg headers" FORCE) | ||
| 408 | endforeach() | ||
| 409 | else() | ||
| 410 | message(WARNING "FFmpeg not found, falling back to externals") | ||
| 411 | set(YUZU_USE_BUNDLED_FFMPEG ON) | ||
| 412 | endif() | ||
| 413 | endif() | ||
| 414 | |||
| 389 | if (YUZU_USE_BUNDLED_FFMPEG) | 415 | if (YUZU_USE_BUNDLED_FFMPEG) |
| 390 | if (NOT WIN32) | 416 | if (NOT WIN32) |
| 391 | # Build FFmpeg from externals | 417 | # Build FFmpeg from externals |
| @@ -407,11 +433,6 @@ if (YUZU_USE_BUNDLED_FFMPEG) | |||
| 407 | set(FFmpeg_FOUND YES) | 433 | set(FFmpeg_FOUND YES) |
| 408 | endif() | 434 | endif() |
| 409 | 435 | ||
| 410 | set(FFmpeg_COMPONENTS | ||
| 411 | avcodec | ||
| 412 | avutil | ||
| 413 | swscale) | ||
| 414 | |||
| 415 | foreach(COMPONENT ${FFmpeg_COMPONENTS}) | 436 | foreach(COMPONENT ${FFmpeg_COMPONENTS}) |
| 416 | set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}") | 437 | set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}") |
| 417 | set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a") | 438 | set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a") |
| @@ -496,15 +517,10 @@ if (YUZU_USE_BUNDLED_FFMPEG) | |||
| 496 | ${FFmpeg_LIBRARY_DIR}/avutil.lib | 517 | ${FFmpeg_LIBRARY_DIR}/avutil.lib |
| 497 | CACHE PATH "Paths to FFmpeg libraries" FORCE) | 518 | CACHE PATH "Paths to FFmpeg libraries" FORCE) |
| 498 | endif() | 519 | endif() |
| 499 | else() | ||
| 500 | # Use system installed FFmpeg | ||
| 501 | find_package(FFmpeg REQUIRED) | ||
| 502 | |||
| 503 | if (NOT FFmpeg_FOUND) | ||
| 504 | message(FATAL_ERROR "FFmpeg not found") | ||
| 505 | endif() | ||
| 506 | endif() | 520 | endif() |
| 507 | 521 | ||
| 522 | unset(FFmpeg_COMPONENTS) | ||
| 523 | |||
| 508 | # Prefer the -pthread flag on Linux. | 524 | # Prefer the -pthread flag on Linux. |
| 509 | set(THREADS_PREFER_PTHREAD_FLAG ON) | 525 | set(THREADS_PREFER_PTHREAD_FLAG ON) |
| 510 | find_package(Threads REQUIRED) | 526 | find_package(Threads REQUIRED) |
diff --git a/externals/find-modules/FindFFmpeg.cmake b/externals/find-modules/FindFFmpeg.cmake index 86a3f5a5a..61b6dc8d2 100644 --- a/externals/find-modules/FindFFmpeg.cmake +++ b/externals/find-modules/FindFFmpeg.cmake | |||
| @@ -22,19 +22,24 @@ | |||
| 22 | # | 22 | # |
| 23 | # <component> can be one of: | 23 | # <component> can be one of: |
| 24 | # avcodec | 24 | # avcodec |
| 25 | # avdevice # Disabled | 25 | # avdevice |
| 26 | # avfilter # Disabled | 26 | # avfilter |
| 27 | # avformat # Disabled | 27 | # avformat |
| 28 | # avutil | 28 | # avutil |
| 29 | # postproc # Disabled | 29 | # postproc |
| 30 | # swresample # Disabled | 30 | # swresample |
| 31 | # swscale | 31 | # swscale |
| 32 | # | 32 | # |
| 33 | 33 | ||
| 34 | set(_FFmpeg_ALL_COMPONENTS | 34 | set(_FFmpeg_ALL_COMPONENTS |
| 35 | avcodec | 35 | avcodec |
| 36 | avutil | 36 | avdevice |
| 37 | swscale | 37 | avfilter |
| 38 | avformat | ||
| 39 | avutil | ||
| 40 | postproc | ||
| 41 | swresample | ||
| 42 | swscale | ||
| 38 | ) | 43 | ) |
| 39 | 44 | ||
| 40 | set(_FFmpeg_DEPS_avcodec avutil) | 45 | set(_FFmpeg_DEPS_avcodec avutil) |