Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling X11 desktop capturing independently. #107

Merged
merged 1 commit into from Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 35 additions & 1 deletion CMakeLists.txt
Expand Up @@ -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 "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)
Expand Down Expand Up @@ -188,7 +189,7 @@ endif()
include(cmake/libwebrtcbuild.cmake)
target_link_libraries(tg_owt PUBLIC tg_owt::libwebrtcbuild)

if (UNIX AND NOT APPLE)
if (TG_OWT_USE_X11)
link_x11(tg_owt)
endif()

Expand Down Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions cmake/libwebrtcbuild.cmake
Expand Up @@ -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
Expand Down Expand Up @@ -65,11 +72,6 @@ else()
INTERFACE
WEBRTC_MAC
)
else()
target_compile_definitions(libwebrtcbuild
INTERFACE
WEBRTC_USE_X11
)
endif()

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
Expand Down