diff options
author | Artem Dyomin <artem.dyomin@qt.io> | 2023-08-30 11:53:30 +0200 |
---|---|---|
committer | Artem Dyomin <artem.dyomin@qt.io> | 2023-08-31 09:44:18 +0000 |
commit | ff2a0decb571e78d463d581eac5ab5d6f69ef381 (patch) | |
tree | 6f0459f3874c56cdf11e7ed0102f5c8d3bb60857 /cmake | |
parent | ce88211898a03cb3603505e7a2ede0dcdad81dee (diff) |
Implement dynamic resolve vaapi symbols
Let's get rid of the linking vaapi dependency, load and resolve
in runtime instead.
Pick-to: 6.5 6.6
Change-Id: Icbc72470c935c1ae711c5457c8e85e4f96977a3b
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindFFmpeg.cmake | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake index 8a1d8d713..fb92a9f08 100644 --- a/cmake/FindFFmpeg.cmake +++ b/cmake/FindFFmpeg.cmake @@ -174,6 +174,27 @@ set(FFMPEG_LIBRARIES "") set(FFMPEG_DEFINITIONS "") set(FFMPEG_LIBRARY_DIRS "") +# Apply dynamic symbols resolve for Linux build only. We might add Android and QNX as well. +set(ENABLE_DYNAMIC_RESOLVE_OPENSSL_SYMBOLS ${LINUX} CACHE INTERNAL "") +set(ENABLE_DYNAMIC_RESOLVE_VAAPI_SYMBOLS ${LINUX} CACHE INTERNAL "") + +function(__try_add_dynamic_resolve_dependency dep added) + set(added TRUE PARENT_SCOPE) + + if(ENABLE_DYNAMIC_RESOLVE_OPENSSL_SYMBOLS AND + (${dep} STREQUAL "ssl" OR ${dep} STREQUAL "crypto")) + set(DYNAMIC_RESOLVE_OPENSSL_SYMBOLS TRUE CACHE INTERNAL "") + elseif(ENABLE_DYNAMIC_RESOLVE_VAAPI_SYMBOLS AND ${dep} STREQUAL "va") + set(DYNAMIC_RESOLVE_VAAPI_SYMBOLS TRUE CACHE INTERNAL "") + elseif(ENABLE_DYNAMIC_RESOLVE_VAAPI_SYMBOLS AND ${dep} STREQUAL "va-drm") + set(DYNAMIC_RESOLVE_VA_DRM_SYMBOLS TRUE CACHE INTERNAL "") + elseif(ENABLE_DYNAMIC_RESOLVE_VAAPI_SYMBOLS AND ${dep} STREQUAL "va-x11") + set(DYNAMIC_RESOLVE_VA_X11_SYMBOLS TRUE CACHE INTERNAL "") + else() + set(added FALSE PARENT_SCOPE) + endif() +endfunction() + # Function parses package config file to find the static library dependencies # and adds them to the target library. function(__ffmpeg_internal_set_dependencies lib) @@ -196,11 +217,8 @@ function(__ffmpeg_internal_set_dependencies lib) foreach(dependency ${deps_no_suffix}) string(REGEX REPLACE ${prefix_l} "" dependency ${dependency}) if(NOT ${lib} STREQUAL ${dependency}) - # Apply dynamic symbols resolve for Linux build only. We might add Android and QNX as well. - if(LINUX AND (${dependency} STREQUAL "ssl" OR ${dependency} STREQUAL "crypto")) - # TODO: implement OpenSsl headers check (or reuse WrapOpenSSLHeaders_FOUND) - set(DYNAMIC_RESOLVE_OPENSSL_SYMBOLS TRUE CACHE INTERNAL "") - else() + __try_add_dynamic_resolve_dependency(${dependency} added) + if(NOT added) target_link_libraries(FFmpeg::${lib} INTERFACE ${dependency}) endif() endif() |