diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn index 864732b4b0..af00596df6 100644 --- a/modules/desktop_capture/BUILD.gn +++ b/modules/desktop_capture/BUILD.gn @@ -57,6 +57,7 @@ if (rtc_include_tests) { defines = [] sources = [] deps = [ + ":desktop_capture", "../../api:function_view", "../../api:scoped_refptr", "../../rtc_base:checks", @@ -171,8 +172,6 @@ if (rtc_include_tests) { rtc_library("screen_drawer") { testonly = true - public_deps = [ ":desktop_capture" ] # no-presubmit-check TODO(webrtc:8603) - sources = [ "screen_drawer.cc", "screen_drawer.h", @@ -191,6 +190,7 @@ if (rtc_include_tests) { } deps = [ + ":desktop_capture", ":primitives", "../../api:scoped_refptr", "../../rtc_base:checks", @@ -209,14 +209,13 @@ if (rtc_include_tests) { rtc_library("desktop_capture_mock") { testonly = true - public_deps = [ ":desktop_capture" ] # no-presubmit-check TODO(webrtc:8603) - sources = [ "mock_desktop_capturer_callback.cc", "mock_desktop_capturer_callback.h", ] deps = [ + ":desktop_capture", ":primitives", "../../test:test_support", ] @@ -294,62 +293,31 @@ if (is_linux || is_chromeos) { } } -rtc_source_set("desktop_capture") { - visibility = [ "*" ] - public_deps = # no-presubmit-check TODO(webrtc:8603) - [ ":desktop_capture_generic" ] - if (is_mac) { - public_deps += [ ":desktop_capture_objc" ] - } -} - -if (is_mac) { - rtc_library("desktop_capture_objc") { - visibility = [ ":desktop_capture" ] - sources = [ - "mac/desktop_configuration.mm", - "mac/desktop_frame_cgimage.h", - "mac/desktop_frame_cgimage.mm", - "mac/desktop_frame_iosurface.h", - "mac/desktop_frame_iosurface.mm", - "mac/desktop_frame_provider.h", - "mac/desktop_frame_provider.mm", - "mac/screen_capturer_mac.h", - "mac/screen_capturer_mac.mm", - "mouse_cursor_monitor_mac.mm", - "screen_capturer_darwin.mm", - "window_capturer_mac.mm", - "window_finder_mac.h", - "window_finder_mac.mm", - ] - deps = [ - ":desktop_capture_generic", - ":primitives", - "../../api:scoped_refptr", - "../../api:sequence_checker", - "../../rtc_base", - "../../rtc_base:checks", - "../../rtc_base:event_tracer", - "../../rtc_base:logging", - "../../rtc_base:timeutils", - "../../rtc_base/system:rtc_export", - "../../sdk:helpers_objc", - ] - frameworks = [ - "AppKit.framework", - "IOKit.framework", - "IOSurface.framework", - ] - } -} - -rtc_library("desktop_capture_generic") { - defines = [] - public_configs = [ ":x11_config" ] - visibility = [ +# TODO(mbonadei): Just for backwards compatibility, remove. +rtc_source_set("desktop_capture_generic") { + deps = [ ":desktop_capture", - ":desktop_capture_objc", + ":primitives", + "../../api:scoped_refptr", + "../../rtc_base/system:rtc_export", ] + sources = [ + "desktop_capture_options.h", + "desktop_capturer.h", + "desktop_frame_generator.h", + "fake_desktop_capturer.h", + ] + if (rtc_use_x11_extensions) { + sources += [ "linux/x11/shared_x_display.h" ] + deps += [ "../../api:refcountedbase" ] + } +} + +rtc_library("desktop_capture") { + visibility = [ "*" ] + defines = [] + deps = [] + public_configs = [ ":x11_config" ] sources = [ "blank_detector_desktop_capturer_wrapper.cc", "blank_detector_desktop_capturer_wrapper.h", @@ -409,6 +377,7 @@ rtc_library("desktop_capture_generic") { "mac/window_list_utils.cc", "mac/window_list_utils.h", ] + deps += [ ":desktop_capture_objc" ] } if (build_with_mozilla) { @@ -487,14 +456,13 @@ rtc_library("desktop_capture_generic") { ] } - deps = [ + deps += [ ":primitives", "../../api:function_view", "../../api:make_ref_counted", "../../api:refcountedbase", "../../api:scoped_refptr", "../../api:sequence_checker", - "../../rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806. "../../rtc_base:checks", "../../rtc_base:event_tracer", "../../rtc_base:logging", @@ -673,6 +641,71 @@ rtc_library("desktop_capture_generic") { } } +if (is_mac) { + rtc_library("desktop_capture_objc") { + # This target, needs to be separated from ":desktop_capture" because + # that is the C++ part of the target while this one is the Obj-C++ part. + # Aside from this, both represent a "desktop_capture" target. + # This target separation based on programming languages introduces a + # dependency cycle between ":desktop_capture" and + # ":desktop_capture_objc". + # To break this, ":desktop_capture_objc" shares some .h files with + # ":desktop_capture" but when external targets need one of these + # headers, they should depend on ":desktop_capture" and consider + # this target as private. + visibility = [ ":desktop_capture" ] + sources = [ + "desktop_capture_options.h", + "desktop_capturer.h", + "full_screen_application_handler.h", + "full_screen_window_detector.h", + "mac/desktop_configuration.h", + "mac/desktop_configuration.mm", + "mac/desktop_configuration_monitor.h", + "mac/desktop_frame_cgimage.h", + "mac/desktop_frame_cgimage.mm", + "mac/desktop_frame_iosurface.h", + "mac/desktop_frame_iosurface.mm", + "mac/desktop_frame_provider.h", + "mac/desktop_frame_provider.mm", + "mac/screen_capturer_mac.h", + "mac/screen_capturer_mac.mm", + "mac/window_list_utils.h", + "mouse_cursor.h", + "mouse_cursor_monitor.h", + "mouse_cursor_monitor_mac.mm", + "screen_capture_frame_queue.h", + "screen_capturer_darwin.mm", + "screen_capturer_helper.h", + "window_capturer_mac.mm", + "window_finder.h", + "window_finder_mac.h", + "window_finder_mac.mm", + ] + deps = [ + ":primitives", + "../../api:function_view", + "../../api:refcountedbase", + "../../api:scoped_refptr", + "../../api:sequence_checker", + "../../rtc_base", + "../../rtc_base:checks", + "../../rtc_base:event_tracer", + "../../rtc_base:logging", + "../../rtc_base:macromagic", + "../../rtc_base:timeutils", + "../../rtc_base/synchronization:mutex", + "../../rtc_base/system:rtc_export", + "../../sdk:helpers_objc", + ] + frameworks = [ + "AppKit.framework", + "IOKit.framework", + "IOSurface.framework", + ] + } +} + if (use_desktop_capture_differ_sse2) { # Have to be compiled as a separate target because it needs to be compiled # with SSE2 enabled.