Add libv4l2 as requirement for the v4l2 plugin.
In order to convert formats not natively supported by obs the v4l2 userspace library is required. This patch adds a cmake script to find the library.master
parent
94e2badb0e
commit
d6f65be966
|
@ -0,0 +1,34 @@
|
|||
# Once done these will be defined:
|
||||
#
|
||||
# LIBV4L2_FOUND
|
||||
# LIBV4L2_INCLUDE_DIRS
|
||||
# LIBV4L2_LIBRARIES
|
||||
#
|
||||
|
||||
if(LIBV4L2_INCLUDE_DIRS AND LIBV4L2_LIBRARIES)
|
||||
set(LIBV4L2_FOUND TRUE)
|
||||
else()
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_V4L2 QUIET v4l-utils)
|
||||
endif()
|
||||
|
||||
find_path(V4L2_INCLUDE_DIR
|
||||
NAMES libv4l2.h
|
||||
HINTS ${_V4L2_INCLUDE_DIRS} /usr/include /usr/local/include
|
||||
/opt/local/include)
|
||||
|
||||
find_library(V4L2_LIB
|
||||
NAMES v4l2
|
||||
HINTS ${_V4L2_LIBRARY_DIRS} /usr/lib /usr/local/lib
|
||||
/opt/local/lib)
|
||||
|
||||
set(LIBV4L2_INCLUDE_DIRS ${V4L2_INCLUDE_DIR}
|
||||
CACHE PATH "v4l2 include dir")
|
||||
set(LIBV4L2_LIBRARIES "${V4L2_LIB}"
|
||||
CACHE STRING "v4l2 libraries")
|
||||
|
||||
find_package_handle_standard_args(LibV4L2 DEFAULT_MSG V4L2_LIB
|
||||
V4L2_INCLUDE_DIR)
|
||||
mark_as_advanced(V4L2_INCLUDE_DIR V4L2_LIB)
|
||||
endif()
|
|
@ -1,5 +1,13 @@
|
|||
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs")
|
||||
|
||||
find_package(Libv4l2)
|
||||
if(NOT LIBV4L2_FOUND)
|
||||
message(STATUS "libv4l2 not found, disabling v4l2 plugin")
|
||||
return()
|
||||
endif()
|
||||
|
||||
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs")
|
||||
|
||||
set(linux-v4l2_SOURCES
|
||||
linux-v4l2.c
|
||||
v4l2-input.c
|
||||
|
@ -10,6 +18,7 @@ add_library(linux-v4l2 MODULE
|
|||
)
|
||||
target_link_libraries(linux-v4l2
|
||||
libobs
|
||||
${LIBV4L2_LIBRARIES}
|
||||
)
|
||||
|
||||
install_obs_plugin(linux-v4l2)
|
||||
|
|
Loading…
Reference in New Issue