generated from obsproject/obs-plugintemplate
-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
100 lines (74 loc) · 2.73 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
cmake_minimum_required(VERSION 3.10)
project(linux-kmsgrab VERSION 0.1.0)
# Replace `Your Name Here` with the name (yours or your organization's) you want
# to see as the author of the plugin (in the plugin's metadata itself and in the installers)
set(PLUGIN_AUTHOR "Ivan Avdeev")
# Replace `[email protected]` with the maintainer email address you want to put in Linux packages
set(LINUX_MAINTAINER_EMAIL "[email protected]")
if(NOT UNIX OR APPLE)
message(FATAL_ERROR "This plugin is Linux-only")
endif()
set(CMAKE_PREFIX_PATH "${QTDIR}")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
# In case you need C++
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(LibObs REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
# LOL TODO for this we need cmake >= 3.19 w/ cmake policy CMP0109 set to NEW
#find_program(POLKIT NAMES pkexec)
option(ENABLE_POLKIT "Use pkexec for elevated drmsend privileges" ON)
find_package(PkgConfig)
pkg_check_modules(DRM libdrm)
if(NOT DRM_FOUND)
message(FATAL_ERROR "libdrm(-dev) not found")
return()
endif()
include(GNUInstallDirs)
set(OBS_PLUGIN_DESTINATION "${CMAKE_INSTALL_LIBDIR}/obs-plugins")
configure_file(
src/plugin-macros.h.in
../src/plugin-macros.generated.h
)
configure_file(
ci/ci_includes.sh.in
../ci/ci_includes.generated.sh
)
set(PLUGIN_SOURCES
src/dmabuf.c
src/xcursor-xcb.c)
set(PLUGIN_HEADERS
src/plugin-macros.generated.h)
add_library(${CMAKE_PROJECT_NAME} MODULE ${PLUGIN_SOURCES} ${PLUGIN_HEADERS})
if (ENABLE_POLKIT)
message(STATUS "Using Polkit/pkexec for elevating drmsend privileges")
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE USE_PKEXEC)
else()
message(WARNING "Polkit support is disabled. You'll need to manually run `sudo setcap cap_sys_admin+ep \"${OBS_PLUGIN_DESTINATION}/obs-plugins/linux-kmsgrab-send\"` to allow it to grab framebuffers")
endif()
include_directories(
"${CMAKE_SOURCE_DIR}/src"
"${LIBOBS_INCLUDE_DIR}/../UI/obs-frontend-api"
${Qt5Core_INCLUDES}
${Qt5Widgets_INCLUDES}
)
target_link_libraries(${CMAKE_PROJECT_NAME}
libobs
xcb
xcb-xfixes
Qt5::Core
Qt5::Widgets
)
add_executable(linux-kmsgrab-send src/drmsend.c)
target_include_directories(linux-kmsgrab-send PRIVATE ${DRM_INCLUDE_DIRS})
target_link_libraries(linux-kmsgrab-send PRIVATE ${DRM_LIBRARIES})
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${CMAKE_PROJECT_NAME} obs-frontend-api)
file(GLOB locale_files data/locale/*.ini)
install(TARGETS ${CMAKE_PROJECT_NAME} linux-kmsgrab-send
LIBRARY DESTINATION "${OBS_PLUGIN_DESTINATION}"
RUNTIME DESTINATION "${OBS_PLUGIN_DESTINATION}")
install(FILES ${locale_files}
DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/obs/obs-plugins/${CMAKE_PROJECT_NAME}/locale")