mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-11-10 20:51:06 +08:00
fix(linux): link matching bundled libva libraries (#5918)
This commit is contained in:
1 parent
5710474600
commit
81a677c1ee
4 files changed
+66
-23
No files matched your search
@@ -10,7 +10,12 @@ the build directory.
|
||||
|
||||
The project uses gtest as a test framework.
|
||||
|
||||
Add or update tests for new or modified methods and code. Target 100% coverage on changed code.
|
||||
Add or update regression tests for new or modified source-code methods and behavior.
|
||||
Target 100% coverage on changed source code.
|
||||
|
||||
The regression-test requirement does not apply to build-system files, such as CMake scripts and dependency configuration.
|
||||
Validate build-system changes with appropriate configuration, build, and lint checks.
|
||||
Do not add dedicated build-system regression-test projects or fixtures for these changes.
|
||||
|
||||
## Python tooling and formatting
|
||||
|
||||
|
||||
+47
-22
@@ -10,30 +10,48 @@
|
||||
# find_path() and find_library() calls
|
||||
# cmake-format: on
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_LIBVA libva)
|
||||
pkg_check_modules(_LIBVA_DRM libva-drm)
|
||||
if(EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libva.a")
|
||||
# The display context ABI is private to libva. Keep its core, DRM backend,
|
||||
# and headers from the same build as FFmpeg instead of mixing system libva.
|
||||
set(LIBVA_INCLUDE_DIR "${FFMPEG_PREPARED_BINARIES}/include")
|
||||
set(LIBVA_LIB "${FFMPEG_PREPARED_BINARIES}/lib/libva.a")
|
||||
set(LIBVA_DRM_LIB "${FFMPEG_PREPARED_BINARIES}/lib/libva-drm.a")
|
||||
foreach(required_file IN ITEMS
|
||||
"${LIBVA_INCLUDE_DIR}/va/va.h"
|
||||
"${LIBVA_INCLUDE_DIR}/va/va_drm.h"
|
||||
"${LIBVA_DRM_LIB}")
|
||||
if(NOT EXISTS "${required_file}")
|
||||
message(FATAL_ERROR "The bundled libva package is incomplete: missing ${required_file}")
|
||||
endif()
|
||||
endforeach()
|
||||
# libva-drm.pc does not declare the libdrm dependency of its static archive.
|
||||
find_package(LIBDRM REQUIRED)
|
||||
else()
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_LIBVA libva)
|
||||
pkg_check_modules(_LIBVA_DRM libva-drm)
|
||||
endif()
|
||||
|
||||
find_path(
|
||||
LIBVA_INCLUDE_DIR
|
||||
NAMES va/va.h va/va_drm.h
|
||||
HINTS ${_LIBVA_INCLUDE_DIRS}
|
||||
PATHS /usr/include /usr/local/include /opt/local/include)
|
||||
|
||||
find_library(
|
||||
LIBVA_LIB
|
||||
NAMES ${_LIBVA_LIBRARIES} libva
|
||||
HINTS ${_LIBVA_LIBRARY_DIRS}
|
||||
PATHS /usr/lib /usr/local/lib /opt/local/lib)
|
||||
|
||||
find_library(
|
||||
LIBVA_DRM_LIB
|
||||
NAMES ${_LIBVA_DRM_LIBRARIES} libva-drm
|
||||
HINTS ${_LIBVA_DRM_LIBRARY_DIRS}
|
||||
PATHS /usr/lib /usr/local/lib /opt/local/lib)
|
||||
endif()
|
||||
|
||||
find_path(
|
||||
LIBVA_INCLUDE_DIR
|
||||
NAMES va/va.h va/va_drm.h
|
||||
HINTS ${_LIBVA_INCLUDE_DIRS}
|
||||
PATHS /usr/include /usr/local/include /opt/local/include)
|
||||
|
||||
find_library(
|
||||
LIBVA_LIB
|
||||
NAMES ${_LIBVA_LIBRARIES} libva
|
||||
HINTS ${_LIBVA_LIBRARY_DIRS}
|
||||
PATHS /usr/lib /usr/local/lib /opt/local/lib)
|
||||
|
||||
find_library(
|
||||
LIBVA_DRM_LIB
|
||||
NAMES ${_LIBVA_DRM_LIBRARIES} libva-drm
|
||||
HINTS ${_LIBVA_DRM_LIBRARY_DIRS}
|
||||
PATHS /usr/lib /usr/local/lib /opt/local/lib)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Libva REQUIRED_VARS LIBVA_INCLUDE_DIR LIBVA_LIB LIBVA_DRM_LIB)
|
||||
mark_as_advanced(LIBVA_INCLUDE_DIR LIBVA_LIB LIBVA_DRM_LIB)
|
||||
@@ -65,6 +83,13 @@ if(LIBVA_FOUND)
|
||||
endif()
|
||||
|
||||
set_target_properties(Libva::drm PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBVA_INCLUDE_DIRS}")
|
||||
if(EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libva.a")
|
||||
set_target_properties(Libva::drm PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "Libva::va;${LIBDRM_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
if(EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libva.a")
|
||||
set(LIBVA_DRM_LIBRARIES Libva::drm)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
@@ -176,6 +176,15 @@ else()
|
||||
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_PLATFORM_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# Legacy library lists can also refer to libva backends by name. Resolve those
|
||||
# names to the matching archives whenever the FFmpeg package supplies libva.
|
||||
if(EXISTS "${FFMPEG_PREPARED_BINARIES}/lib/libva.a")
|
||||
foreach(library IN ITEMS va va-drm va-x11)
|
||||
list(TRANSFORM FFMPEG_LIBRARIES REPLACE
|
||||
"^${library}$" "${FFMPEG_PREPARED_BINARIES}/lib/lib${library}.a")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Shared packages supply the full static dependency list, including decoders.
|
||||
# Older packages retain the library list above.
|
||||
set(_sunshine_ffmpeg_pc "${FFMPEG_PREPARED_BINARIES}/lib/pkgconfig/libavcodec.pc")
|
||||
|
||||
@@ -22,6 +22,10 @@ Sunshine's build and packaging automation uses packaged static Boost libraries o
|
||||
Ubuntu 26.04 or newer, macOS with Homebrew, Windows with MSYS2, and FreeBSD. Older supported distributions continue
|
||||
to use the CPM fallback because their repositories do not meet the minimum Boost version.
|
||||
|
||||
When the prebuilt FFmpeg package supplies libva, Sunshine uses its bundled headers, core library, and DRM backend
|
||||
together. These components share a private display-context ABI and must come from the same libva build. The system
|
||||
still provides libdrm and the GPU's VA-API driver. FFmpeg packages without bundled libva use the system libva libraries.
|
||||
|
||||
#### Prebuilt Web UI
|
||||
|
||||
Sunshine releases publish the platform-independent Web UI as the `@lizardbyte/sunshine` package to npm and GitHub
|
||||
|
||||
Reference in new issue
Block a user