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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
| | From 6c28002ae4326db71980a3bfdf214d5df53d5b62 Mon Sep 17 00:00:00 2001
From: Hilton Chain <hako@ultrarare.space>
Date: Fri, 9 Sep 2022 22:28:23 +0800
Subject: [PATCH] Allow disabling X11 desktop capturing independently.
Squashed commit of the following:
commit 253b09a07520a3cecb3b88b2b7e8889ab3d9158d
Author: Hilton Chain <hako@ultrarare.space>
Date: Fri Sep 9 22:13:15 2022 +0800
Adapt the patch with cmake_dependent_option.
commit f6631bb43f353c9eafe1b1aba093e116518aa12a
Author: Esteve Varela Colominas <esteve.varela@gmail.com>
Date: Sun, 27 Jun 2021 23:57:04 +0200
Add -DTG_OWT_USE_X11
Allows disabling X11 desktop capturing independently of pipewire support, for
the few people that run wayland without any X11 support whatsoever.
This setup is untested, but supported by the GNI build system, see:
* src/modules/desktop_capture/BUILD.gn (option rtc_use_x11_extensions)
Toggling the WEBRTC_USE_X11 define also affects some files under
src/modules/audio_device, but that falls under "X11 support", regardless...
Use cmake_dependent_option to better declare variables that relate on other variables
---
CMakeLists.txt | 42 ++++++++++++++++++++++++++++++++++----
cmake/libwebrtcbuild.cmake | 12 ++++++-----
2 files changed, 45 insertions(+), 9 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e081ae7..2b09682a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,7 @@ endif()
option(BUILD_SHARED_LIBS "Builds shared libraries instead of static." OFF)
option(TG_OWT_USE_PROTOBUF "Use protobuf to generate additional headers. Useful for packaged build." ${BUILD_SHARED_LIBS})
+cmake_dependent_option(TG_OWT_USE_X11 "Use X11 for desktop capture on non-Apple Unix." ON "UNIX; NOT APPLE" OFF)
cmake_dependent_option(TG_OWT_USE_PIPEWIRE "Use pipewire for desktop capture." ON "UNIX; NOT APPLE" OFF)
cmake_dependent_option(TG_OWT_DLOPEN_PIPEWIRE "dlopen pipewire for desktop capture." ${not_packaged_build} TG_OWT_USE_PIPEWIRE OFF)
option(TG_OWT_BUILD_AUDIO_BACKENDS "Build webrtc audio backends." OFF)
@@ -96,6 +97,10 @@ endif()
add_library(tg_owt)
init_target(tg_owt)
+if (TG_OWT_USE_X11)
+ link_x11(tg_owt)
+endif()
+
if (TG_OWT_USE_PIPEWIRE)
if (TG_OWT_DLOPEN_PIPEWIRE)
include(cmake/generate_stubs.cmake)
@@ -188,10 +193,6 @@ endif()
include(cmake/libwebrtcbuild.cmake)
target_link_libraries(tg_owt PUBLIC tg_owt::libwebrtcbuild)
-if (UNIX AND NOT APPLE)
- link_x11(tg_owt)
-endif()
-
function(add_sublibrary postfix)
add_library(tg_owt_${postfix} OBJECT)
init_feature_target(tg_owt_${postfix} ${postfix})
@@ -2369,6 +2370,39 @@ if (NOT TG_OWT_USE_PROTOBUF)
)
endif()
+if (NOT TG_OWT_USE_X11)
+ remove_target_sources(tg_owt ${webrtc_loc}
+ # src/modules/desktop_capture/BUILD.gn (rtc_use_x11_extensions)
+ modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.cc
+ modules/desktop_capture/linux/x11/mouse_cursor_monitor_x11.h
+ modules/desktop_capture/linux/x11/screen_capturer_x11.cc
+ modules/desktop_capture/linux/x11/screen_capturer_x11.h
+ modules/desktop_capture/linux/x11/shared_x_display.cc
+ modules/desktop_capture/linux/x11/shared_x_display.h
+ modules/desktop_capture/linux/x11/window_capturer_x11.cc
+ modules/desktop_capture/linux/x11/window_capturer_x11.h
+ modules/desktop_capture/linux/x11/window_finder_x11.cc
+ modules/desktop_capture/linux/x11/window_finder_x11.h
+ modules/desktop_capture/linux/x11/window_list_utils.cc
+ modules/desktop_capture/linux/x11/window_list_utils.h
+ modules/desktop_capture/linux/x11/x_atom_cache.cc
+ modules/desktop_capture/linux/x11/x_atom_cache.h
+ modules/desktop_capture/linux/x11/x_error_trap.cc
+ modules/desktop_capture/linux/x11/x_error_trap.h
+ modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc
+ modules/desktop_capture/linux/x11/x_server_pixel_buffer.h
+ modules/desktop_capture/linux/x11/x_window_property.cc
+ modules/desktop_capture/linux/x11/x_window_property.h
+
+ # screen_drawer_linux.cc depends on x11, rest are revdeps
+ modules/desktop_capture/screen_drawer.cc
+ modules/desktop_capture/screen_drawer.h
+ modules/desktop_capture/screen_drawer_linux.cc
+ modules/desktop_capture/screen_drawer_lock_posix.cc
+ modules/desktop_capture/screen_drawer_lock_posix.h
+ )
+endif()
+
if (NOT TG_OWT_USE_PIPEWIRE)
remove_target_sources(tg_owt ${webrtc_loc}
modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
diff --git a/cmake/libwebrtcbuild.cmake b/cmake/libwebrtcbuild.cmake
index 4d037f4b..388b7aa9 100644
--- a/cmake/libwebrtcbuild.cmake
+++ b/cmake/libwebrtcbuild.cmake
@@ -29,6 +29,13 @@ INTERFACE
BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0
)
+if (TG_OWT_USE_X11)
+ target_compile_definitions(libwebrtcbuild
+ INTERFACE
+ WEBRTC_USE_X11
+ )
+endif()
+
if (TG_OWT_USE_PIPEWIRE)
target_compile_definitions(libwebrtcbuild
INTERFACE
@@ -65,11 +72,6 @@ else()
INTERFACE
WEBRTC_MAC
)
- else()
- target_compile_definitions(libwebrtcbuild
- INTERFACE
- WEBRTC_USE_X11
- )
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|