Warning, /graphics/digikam/core/cmake/modules/FindVAAPI.cmake is written in an unsupported language. File is not indexed.
0001 # Finds the VAAPI library (https://en.wikipedia.org/wiki/Video_Acceleration_API) 0002 # 0003 # This will define the following variables: 0004 # 0005 # VAAPI_FOUND - system has VAAPI 0006 # VAAPI_INCLUDE_DIRS - the VAAPI include directory 0007 # VAAPI_LIBRARIES - the VAAPI libraries 0008 # VAAPI_DEFINITIONS - the VAAPI definitions 0009 # 0010 # SPDX-FileCopyrightText: 2016-2024 by Gilles Caulier, <caulier dot gilles at gmail dot com> 0011 # 0012 # SPDX-License-Identifier: BSD-3-Clause 0013 # 0014 0015 if(PKG_CONFIG_FOUND) 0016 pkg_check_modules(PC_VAAPI libva libva-drm libva-wayland libva-x11 QUIET) 0017 endif() 0018 0019 set(REQUIRED_VARS "VAAPI_libva_LIBRARY" "VAAPI_libva-drm_LIBRARY" "VAAPI_libva_INCLUDE_DIR" "VAAPI_libva-drm_INCLUDE_DIR") 0020 0021 find_path(VAAPI_libva_INCLUDE_DIR va/va.h 0022 PATHS ${PC_VAAPI_libva_INCLUDEDIR}) 0023 0024 find_library(VAAPI_libva_LIBRARY NAMES va 0025 PATHS ${PC_VAAPI_libva_LIBDIR}) 0026 0027 find_path(VAAPI_libva-drm_INCLUDE_DIR va/va_drm.h 0028 PATHS ${PC_VAAPI_libva-drm_INCLUDEDIR}) 0029 0030 find_library(VAAPI_libva-drm_LIBRARY NAMES va-drm 0031 PATHS ${PC_VAAPI_libva-drm_LIBDIR}) 0032 0033 if("wayland" IN_LIST CORE_PLATFORM_NAME_LC) 0034 0035 find_path(VAAPI_libva-wayland_INCLUDE_DIR va/va_wayland.h 0036 PATHS ${PC_VAAPI_libva-wayland_INCLUDEDIR}) 0037 find_library(VAAPI_libva-wayland_LIBRARY NAMES va-wayland 0038 PATHS ${PC_VAAPI_libva-wayland_LIBDIR}) 0039 list(APPEND REQUIRED_VARS "VAAPI_libva-wayland_INCLUDE_DIR" "VAAPI_libva-wayland_LIBRARY") 0040 0041 endif() 0042 0043 if("x11" IN_LIST CORE_PLATFORM_NAME_LC) 0044 0045 find_path(VAAPI_libva-x11_INCLUDE_DIR va/va_x11.h 0046 PATHS ${PC_VAAPI_libva-x11_INCLUDEDIR}) 0047 find_library(VAAPI_libva-x11_LIBRARY NAMES va-x11 0048 PATHS ${PC_VAAPI_libva-x11_LIBDIR}) 0049 list(APPEND REQUIRED_VARS "VAAPI_libva-x11_INCLUDE_DIR" "VAAPI_libva-x11_LIBRARY") 0050 0051 endif() 0052 0053 if(PC_VAAPI_libva_VERSION) 0054 0055 set(VAAPI_VERSION_STRING ${PC_VAAPI_libva_VERSION}) 0056 0057 elseif(VAAPI_INCLUDE_DIR AND EXISTS "${VAAPI_INCLUDE_DIR}/va/va_version.h") 0058 0059 file(STRINGS "${VAAPI_INCLUDE_DIR}/va/va_version.h" vaapi_version_str REGEX "^#define[\t ]+VA_VERSION_S[\t ]+\".*\".*") 0060 string(REGEX REPLACE "^#define[\t ]+VA_VERSION_S[\t ]+\"([^\"]+)\".*" "\\1" VAAPI_VERSION_STRING "${vaapi_version_str}") 0061 unset(vaapi_version_str) 0062 0063 endif() 0064 0065 if(NOT VAAPI_FIND_VERSION) 0066 0067 set(VAAPI_FIND_VERSION 0.39.0) 0068 0069 endif() 0070 0071 include(FindPackageHandleStandardArgs) 0072 0073 find_package_handle_standard_args(VAAPI 0074 REQUIRED_VARS ${REQUIRED_VARS} 0075 VERSION_VAR VAAPI_VERSION_STRING) 0076 0077 if(VAAPI_FOUND) 0078 0079 message(STATUS "VAAPI X11: ${VAAPI_libva-x11_INCLUDE_DIR} ${VAAPI_libva-x11_LIBRARY}") 0080 message(STATUS "VAAPI WAY: ${VAAPI_libva-wayland_INCLUDE_DIR} ${VAAPI_libva-wayland_LIBRARY}") 0081 message(STATUS "VAAPI DRM: ${VAAPI_libva-drm_INCLUDE_DIR} ${VAAPI_libva-drm_LIBRARY}") 0082 0083 if (NOT "${VAAPI_libva-x11_INCLUDE_DIR}" STREQUAL "" AND 0084 NOT "${VAAPI_libva-x11_LIBRARY}" STREQUAL "") 0085 set(VAAPI_X11_FOUND TRUE) 0086 endif() 0087 0088 if (NOT "${VAAPI_libva-wayland_INCLUDE_DIR}" STREQUAL "" AND 0089 NOT "${VAAPI_libva-wayland_LIBRARY}" STREQUAL "") 0090 set(VAAPI_WAYLAND_FOUND TRUE) 0091 endif() 0092 0093 if (NOT "${VAAPI_libva-drm_INCLUDE_DIR}" STREQUAL "" AND 0094 NOT "${VAAPI_libva-drm_LIBRARY}" STREQUAL "") 0095 set(VAAPI_DRM_FOUND TRUE) 0096 endif() 0097 0098 set(VAAPI_INCLUDE_DIRS ${VAAPI_INCLUDE_DIR} ${VAAPI_DRM_INCLUDE_DIR} ${VAAPI_WAYLAND_INCLUDE_DIR} ${VAAPI_X11_INCLUDE_DIR}) 0099 set(VAAPI_LIBRARIES ${VAAPI_libva_LIBRARY} ${VAAPI_libva-drm_LIBRARY} ${VAAPI_libva-wayland_LIBRARY} ${VAAPI_libva-x11_LIBRARY}) 0100 set(VAAPI_DEFINITIONS -DHAVE_LIBVA=1) 0101 0102 endif() 0103 0104 mark_as_advanced(VAAPI_libva_INCLUDE_DIR 0105 VAAPI_libva-drm_INCLUDE_DIR 0106 VAAPI_libva-wayland_INCLUDE_DIR 0107 VAAPI_libva-x11_INCLUDE_DIR 0108 VAAPI_libva_LIBRARY 0109 VAAPI_libva-drm_LIBRARY 0110 VAAPI_libva-wayland_LIBRARY 0111 VAAPI_libva-x11_LIBRARY)