1# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2# 3# Use of this source code is governed by a BSD-style license 4# that can be found in the LICENSE file in the root of the source 5# tree. An additional intellectual property rights grant can be found 6# in the file PATENTS. All contributing project authors may 7# be found in the AUTHORS file in the root of the source tree. 8 9import("//build/config/ui.gni") 10import("../../build/webrtc.gni") 11 12use_desktop_capture_differ_sse2 = current_cpu == "x86" || current_cpu == "x64" 13 14rtc_static_library("primitives") { 15 sources = [ 16 "desktop_capture_types.h", 17 "desktop_frame.cc", 18 "desktop_frame.h", 19 "desktop_geometry.cc", 20 "desktop_geometry.h", 21 "desktop_region.cc", 22 "desktop_region.h", 23 "shared_desktop_frame.cc", 24 "shared_desktop_frame.h", 25 "shared_memory.cc", 26 "shared_memory.h", 27 ] 28 29 deps = [ 30 "../..:webrtc_common", 31 ] 32 33 if (!build_with_mozilla) { 34 deps += [ 35 "../../base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806. 36 ] 37 } 38} 39 40if (rtc_include_tests) { 41 source_set("rgba_color") { 42 testonly = true 43 44 public_deps = [ 45 ":desktop_capture", 46 ] 47 48 sources = [ 49 "rgba_color.cc", 50 "rgba_color.h", 51 ] 52 53 deps = [ 54 ":primitives", 55 "../..:webrtc_common", 56 ] 57 } 58 59 source_set("screen_drawer") { 60 testonly = true 61 62 public_deps = [ 63 ":rgba_color", 64 ] 65 66 sources = [ 67 "screen_drawer.cc", 68 "screen_drawer.h", 69 "screen_drawer_linux.cc", 70 "screen_drawer_mac.cc", 71 "screen_drawer_win.cc", 72 ] 73 74 deps = [ 75 ":primitives", 76 "../../base:rtc_base_approved", 77 "../../system_wrappers", 78 ] 79 } 80 81 source_set("desktop_capture_mock") { 82 testonly = true 83 84 public_deps = [ 85 ":desktop_capture", 86 ":rgba_color", 87 "//testing/gmock", 88 ] 89 90 sources = [ 91 "desktop_frame_generator.cc", 92 "desktop_frame_generator.h", 93 "fake_desktop_capturer.cc", 94 "fake_desktop_capturer.h", 95 "mock_desktop_capturer_callback.cc", 96 "mock_desktop_capturer_callback.h", 97 ] 98 99 deps = [ 100 ":primitives", 101 "../../base:rtc_base_approved", 102 "../../test:test_support", 103 ] 104 } 105} 106 107rtc_static_library("desktop_capture") { 108 sources = [ 109 "cropped_desktop_frame.cc", 110 "cropped_desktop_frame.h", 111 "cropping_window_capturer.cc", 112 "cropping_window_capturer.h", 113 "cropping_window_capturer_win.cc", 114 "desktop_and_cursor_composer.cc", 115 "desktop_and_cursor_composer.h", 116 "desktop_capture_options.cc", 117 "desktop_capture_options.h", 118 "desktop_capturer.cc", 119 "desktop_capturer.h", 120 "desktop_capturer_differ_wrapper.cc", 121 "desktop_capturer_differ_wrapper.h", 122 "desktop_frame_rotation.cc", 123 "desktop_frame_rotation.h", 124 "desktop_frame_win.cc", 125 "desktop_frame_win.h", 126 "differ_block.cc", 127 "differ_block.h", 128 "mac/desktop_configuration.h", 129 "mac/desktop_configuration.mm", 130 "mac/desktop_configuration_monitor.cc", 131 "mac/desktop_configuration_monitor.h", 132 "mac/full_screen_chrome_window_detector.cc", 133 "mac/full_screen_chrome_window_detector.h", 134 "mac/scoped_pixel_buffer_object.cc", 135 "mac/scoped_pixel_buffer_object.h", 136 "mac/window_list_utils.cc", 137 "mac/window_list_utils.h", 138 "mouse_cursor.cc", 139 "mouse_cursor.h", 140 "mouse_cursor_monitor.h", 141 "mouse_cursor_monitor_mac.mm", 142 "mouse_cursor_monitor_win.cc", 143 "screen_capture_frame_queue.h", 144 "screen_capturer_helper.cc", 145 "screen_capturer_helper.h", 146 "screen_capturer_mac.mm", 147 "screen_capturer_win.cc", 148 "win/cursor.cc", 149 "win/cursor.h", 150 "win/d3d_device.cc", 151 "win/d3d_device.h", 152 "win/desktop.cc", 153 "win/desktop.h", 154 "win/dxgi_adapter_duplicator.cc", 155 "win/dxgi_adapter_duplicator.h", 156 "win/dxgi_duplicator_controller.cc", 157 "win/dxgi_duplicator_controller.h", 158 "win/dxgi_output_duplicator.cc", 159 "win/dxgi_output_duplicator.h", 160 "win/dxgi_texture.cc", 161 "win/dxgi_texture.h", 162 "win/dxgi_texture_mapping.cc", 163 "win/dxgi_texture_mapping.h", 164 "win/dxgi_texture_staging.cc", 165 "win/dxgi_texture_staging.h", 166 "win/scoped_gdi_object.h", 167 "win/scoped_thread_desktop.cc", 168 "win/scoped_thread_desktop.h", 169 "win/screen_capture_utils.cc", 170 "win/screen_capture_utils.h", 171 "win/screen_capturer_win_directx.cc", 172 "win/screen_capturer_win_directx.h", 173 "win/screen_capturer_win_gdi.cc", 174 "win/screen_capturer_win_gdi.h", 175 "win/screen_capturer_win_magnifier.cc", 176 "win/screen_capturer_win_magnifier.h", 177 "win/window_capture_utils.cc", 178 "win/window_capture_utils.h", 179 "window_capturer_mac.mm", 180 "window_capturer_win.cc", 181 ] 182 183 if (build_with_mozilla) { 184 defines = [ "MULTI_MONITOR_SCREENSHARE" ] 185 sources += [ 186 "desktop_device_info.cc", 187 "desktop_device_info.h", 188 "app_capturer_win.cc", 189 "win/desktop_device_info_win.cc", 190 "win/win_shared.cc", 191 ] 192 193 if (is_mac) { 194 sources += [ 195 "app_capturer_mac.mm", 196 ] 197 } 198 } 199 200 if (use_x11) { 201 sources += [ 202 "mouse_cursor_monitor_x11.cc", 203 "screen_capturer_x11.cc", 204 "window_capturer_x11.cc", 205 "x11/shared_x_display.cc", 206 "x11/shared_x_display.h", 207 "x11/x_error_trap.cc", 208 "x11/x_error_trap.h", 209 "x11/x_server_pixel_buffer.cc", 210 "x11/x_server_pixel_buffer.h", 211 ] 212 213 if (build_with_mozilla) { 214 sources += [ 215 "app_capturer_x11.cc", 216 "app_capturer_x11.h", 217 "x11/desktop_device_info_x11.cc", 218 "x11/desktop_device_info_x11.h", 219 "x11/shared_x_util.cc", 220 "x11/shared_x_util.h", 221 ] 222 } 223 224 configs += [ "//build/config/linux:x11" ] 225 } 226 227 if (!is_win && !is_mac && !use_x11) { 228 sources += [ 229 "mouse_cursor_monitor_null.cc", 230 "screen_capturer_null.cc", 231 "window_capturer_null.cc", 232 ] 233 } 234 235 if (is_mac) { 236 libs = [ 237 "AppKit.framework", 238 "IOKit.framework", 239 "OpenGL.framework", 240 ] 241 242 if (build_with_mozilla) { 243 sources += [ 244 "mac/desktop_device_info_mac.mm", 245 ] 246 } 247 } 248 249 if (is_win) { 250 libs = [ 251 "d3d11.lib", 252 "dxgi.lib", 253 ] 254 } 255 256 deps = [ 257 ":primitives", 258 "../..:webrtc_common", 259 "../../system_wrappers", 260 ] 261 262 if (!build_with_mozilla) { 263 deps += [ 264 "../../base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806. 265 ] 266 } 267 268 if (rtc_build_libyuv) { 269 deps += [ "$rtc_libyuv_dir" ] 270 } else { 271 include_dirs = [ "$rtc_libyuv_dir/include" ] 272 } 273 274 if (use_desktop_capture_differ_sse2) { 275 deps += [ ":desktop_capture_differ_sse2" ] 276 } 277 278 if (build_with_mozilla) { 279 deps += ["../../base:rtc_base_approved"] 280 } 281} 282 283if (use_desktop_capture_differ_sse2) { 284 # Have to be compiled as a separate target because it needs to be compiled 285 # with SSE2 enabled. 286 rtc_static_library("desktop_capture_differ_sse2") { 287 visibility = [ ":*" ] 288 sources = [ 289 "differ_vector_sse2.cc", 290 "differ_vector_sse2.h", 291 ] 292 293 if (is_posix) { 294 cflags = [ "-msse2" ] 295 } 296 } 297} 298