0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
obs-studio/cmake/Modules/FindLibpci.cmake
Carlo Castoldi 4623a6b4bc obs-ffmpeg: Set DRI devices and their name persistently
retrieving the DRI devices from /dev/dri/by-path/ instead of
/dev/dri/renderDXXX. This enable us to use lspci to get the device
name as well.
2021-12-12 11:12:36 +11:00

50 lines
1.5 KiB
CMake

# * Try to find Libpci
# Once done this will define
#
# LIBPCI_FOUND - system has Libpci
# LIBPCI_INCLUDE_DIRS - the Libpci include directory
# LIBPCI_LIBRARIES - the libraries needed to use Libpci
# LIBPCI_DEFINITIONS - Compiler switches required for using Libpci
# Use pkg-config to get the directories and then use these values in the
# find_path() and find_library() calls
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(_LIBPCI libpci)
endif()
find_path(
LIBPCI_INCLUDE_DIR
NAMES pci.h
HINTS ${_LIBPCI_INCLUDE_DIRS}
PATHS /usr/include /usr/local/include /opt/local/include
PATH_SUFFIXES pci/)
find_library(
LIBPCI_LIB
NAMES ${_LIBPCI_LIBRARIES} libpci
HINTS ${_LIBPCI_LIBRARY_DIRS}
PATHS /usr/lib /usr/local/lib /opt/local/lib)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libpci REQUIRED_VARS LIBPCI_LIB LIBPCI_INCLUDE_DIR)
mark_as_advanced(LIBPCI_INCLUDE_DIR LIBPCI_LIB)
if(LIBPCI_FOUND)
set(LIBPCI_INCLUDE_DIRS ${LIBPCI_INCLUDE_DIR})
set(LIBPCI_LIBRARIES ${LIBPCI_LIB})
if(NOT TARGET LIBPCI::LIBPCI)
if(IS_ABSOLUTE "${LIBPCI_LIBRARIES}")
add_library(LIBPCI::LIBPCI UNKNOWN IMPORTED)
set_target_properties(LIBPCI::LIBPCI PROPERTIES IMPORTED_LOCATION
"${LIBPCI_LIBRARIES}")
else()
add_library(LIBPCI::LIBPCI INTERFACE IMPORTED)
set_target_properties(LIBPCI::LIBPCI PROPERTIES IMPORTED_LIBNAME
"${LIBPCI_LIBRARIES}")
endif()
endif()
endif()