diff options
| author | 2021-04-21 02:57:22 -0400 | |
|---|---|---|
| committer | 2021-04-21 02:57:22 -0400 | |
| commit | ea78f9a2ef89918e758c3a52eea5d581a944b42f (patch) | |
| tree | aad26a84417a587e8f51e0291abc93e3b5734127 | |
| parent | Merge pull request #6218 from lioncash/tcache (diff) | |
| download | yuzu-ea78f9a2ef89918e758c3a52eea5d581a944b42f.tar.gz yuzu-ea78f9a2ef89918e758c3a52eea5d581a944b42f.tar.xz yuzu-ea78f9a2ef89918e758c3a52eea5d581a944b42f.zip | |
cmake: Allow FFmpeg external usage and cleanup
Sets find_package(FFmpeg) to QUIET instead of REQUIRED. This allows
using the FFmpeg external in cases where there is no suitable installed
version of FFmpeg.
Also fixes a bug where multiple CMake configures causes FFmpeg_LIBRARIES
to concatenate on itself, producing cyclical dependencies. Unsets the
variable before building it in the foreach loop.
Fixes FFmpeg_INCLUDE_DIR not including the headers generated at run
time.
| -rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c1c3d560..2cddf2ad9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -19,7 +19,7 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "EN | |||
| 19 | 19 | ||
| 20 | option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) | 20 | option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) |
| 21 | 21 | ||
| 22 | CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled yuzu" ON "WIN32" OFF) | 22 | CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" ON "WIN32" OFF) |
| 23 | 23 | ||
| 24 | option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF) | 24 | option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF) |
| 25 | 25 | ||
| @@ -394,7 +394,7 @@ set(FFmpeg_COMPONENTS | |||
| 394 | 394 | ||
| 395 | if (NOT YUZU_USE_BUNDLED_FFMPEG) | 395 | if (NOT YUZU_USE_BUNDLED_FFMPEG) |
| 396 | # Use system installed FFmpeg | 396 | # Use system installed FFmpeg |
| 397 | find_package(FFmpeg REQUIRED COMPONENTS ${FFmpeg_COMPONENTS}) | 397 | find_package(FFmpeg QUIET COMPONENTS ${FFmpeg_COMPONENTS}) |
| 398 | 398 | ||
| 399 | if (FFmpeg_FOUND) | 399 | if (FFmpeg_FOUND) |
| 400 | # Overwrite aggregate defines from FFmpeg module to avoid over-linking libraries. | 400 | # Overwrite aggregate defines from FFmpeg module to avoid over-linking libraries. |
| @@ -433,6 +433,7 @@ if (YUZU_USE_BUNDLED_FFMPEG) | |||
| 433 | set(FFmpeg_FOUND YES) | 433 | set(FFmpeg_FOUND YES) |
| 434 | endif() | 434 | endif() |
| 435 | 435 | ||
| 436 | unset(FFmpeg_LIBRARIES CACHE) | ||
| 436 | foreach(COMPONENT ${FFmpeg_COMPONENTS}) | 437 | foreach(COMPONENT ${FFmpeg_COMPONENTS}) |
| 437 | set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}") | 438 | set(FFmpeg_${COMPONENT}_PREFIX "${FFmpeg_BUILD_DIR}/lib${COMPONENT}") |
| 438 | set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a") | 439 | set(FFmpeg_${COMPONENT}_LIB_NAME "lib${COMPONENT}.a") |
| @@ -445,7 +446,7 @@ if (YUZU_USE_BUNDLED_FFMPEG) | |||
| 445 | endforeach() | 446 | endforeach() |
| 446 | 447 | ||
| 447 | set(FFmpeg_INCLUDE_DIR | 448 | set(FFmpeg_INCLUDE_DIR |
| 448 | ${FFmpeg_PREFIX} | 449 | "${FFmpeg_PREFIX};${FFmpeg_BUILD_DIR}" |
| 449 | CACHE PATH "Path to FFmpeg headers" FORCE) | 450 | CACHE PATH "Path to FFmpeg headers" FORCE) |
| 450 | 451 | ||
| 451 | # `configure` parameters builds only exactly what yuzu needs from FFmpeg | 452 | # `configure` parameters builds only exactly what yuzu needs from FFmpeg |
| @@ -492,13 +493,11 @@ if (YUZU_USE_BUNDLED_FFMPEG) | |||
| 492 | 493 | ||
| 493 | # ALL makes this custom target build every time | 494 | # ALL makes this custom target build every time |
| 494 | # but it won't actually build if the DEPENDS parameter is up to date | 495 | # but it won't actually build if the DEPENDS parameter is up to date |
| 495 | add_custom_target(ffmpeg-build ALL DEPENDS ${FFmpeg_LIBRARIES}) | ||
| 496 | add_custom_target(ffmpeg-configure ALL DEPENDS ${FFmpeg_MAKEFILE}) | 496 | add_custom_target(ffmpeg-configure ALL DEPENDS ${FFmpeg_MAKEFILE}) |
| 497 | add_custom_target(ffmpeg-build ALL DEPENDS ${FFmpeg_LIBRARIES} ffmpeg-configure) | ||
| 497 | 498 | ||
| 498 | if (FFmpeg_FOUND) | 499 | if (FFmpeg_FOUND) |
| 499 | message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}") | 500 | message(STATUS "Found FFmpeg version ${FFmpeg_VERSION}") |
| 500 | |||
| 501 | add_dependencies(ffmpeg-build ffmpeg-configure) | ||
| 502 | else() | 501 | else() |
| 503 | message(FATAL_ERROR "FFmpeg not found") | 502 | message(FATAL_ERROR "FFmpeg not found") |
| 504 | endif() | 503 | endif() |