blob: 2e6b16879803dd3ec35f69c59a2ccdb277f3c7d7 [file] [log] [blame]
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +00001# 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
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +00009import("//build/config/ui.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -080010import("../../webrtc.gni")
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +000011
Sergey Ulanov1c062bf2016-11-22 16:07:10 -080012use_desktop_capture_differ_sse2 = current_cpu == "x86" || current_cpu == "x64"
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000013
kjellanderb62dbbe2016-09-23 00:38:52 -070014rtc_static_library("primitives") {
Sergey Ulanov098c1de2015-09-01 11:36:40 -070015 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",
Sergey Ulanov58000a02016-10-20 09:33:52 -070023 "shared_desktop_frame.cc",
24 "shared_desktop_frame.h",
mbonadeif4235932016-12-29 03:35:56 -080025 "shared_memory.cc",
26 "shared_memory.h",
Sergey Ulanov58000a02016-10-20 09:33:52 -070027 ]
28
29 deps = [
mbonadeif4235932016-12-29 03:35:56 -080030 "../..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -070031 "../../rtc_base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
Sergey Ulanov098c1de2015-09-01 11:36:40 -070032 ]
Sergey Ulanov098c1de2015-09-01 11:36:40 -070033}
34
zijiehe6be0a652016-10-27 16:50:35 -070035if (rtc_include_tests) {
ehmaldonado9cbb0a12017-01-30 03:07:03 -080036 rtc_source_set("desktop_capture_modules_tests") {
37 testonly = true
kjellandere0629c02017-04-25 04:04:50 -070038
39 # Skip restricting visibility on mobile platforms since the tests on those
40 # gets additional generated targets which would require many lines here to
41 # cover (which would be confusing to read and hard to maintain).
42 if (!is_android && !is_ios) {
jianjun.zhuc0247402017-07-11 06:20:45 -070043 visibility = [ "..:modules_tests" ]
kjellandere0629c02017-04-25 04:04:50 -070044 }
ehmaldonado9cbb0a12017-01-30 03:07:03 -080045 sources = []
46 deps = []
47 if (rtc_desktop_capture_supported) {
48 deps += [
49 ":desktop_capture_mock",
50 ":primitives",
51 ":screen_drawer",
ehmaldonadof6a861a2017-07-19 10:40:47 -070052 "../../rtc_base:rtc_base",
53 "../../rtc_base:rtc_base_approved",
zijieheccf57a72017-03-03 14:40:15 -080054 "../../system_wrappers",
ehmaldonado9cbb0a12017-01-30 03:07:03 -080055 "../../test:test_support",
ehmaldonado656610f2017-02-06 02:21:11 -080056 "../../test:video_test_support",
ehmaldonado9cbb0a12017-01-30 03:07:03 -080057 ]
58 sources += [
59 "screen_capturer_integration_test.cc",
60 "screen_drawer_unittest.cc",
Zijie He77b7a1d2017-09-01 15:51:14 -070061 "window_finder_unittest.cc",
ehmaldonado9cbb0a12017-01-30 03:07:03 -080062 ]
63 }
64 }
65
ehmaldonado36268652017-01-19 08:27:11 -080066 rtc_source_set("desktop_capture_unittests") {
67 testonly = true
kjellandere0629c02017-04-25 04:04:50 -070068
69 # Skip restricting visibility on mobile platforms since the tests on those
70 # gets additional generated targets which would require many lines here to
71 # cover (which would be confusing to read and hard to maintain).
72 if (!is_android && !is_ios) {
jianjun.zhuc0247402017-07-11 06:20:45 -070073 visibility = [ "..:modules_unittests" ]
kjellandere0629c02017-04-25 04:04:50 -070074 }
ehmaldonado0d729b32017-02-10 01:38:23 -080075 sources = [
zijieheccf57a72017-03-03 14:40:15 -080076 "blank_detector_desktop_capturer_wrapper_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080077 "desktop_and_cursor_composer_unittest.cc",
78 "desktop_capturer_differ_wrapper_unittest.cc",
79 "desktop_frame_rotation_unittest.cc",
zijiehe8eef7aa2017-05-18 12:27:16 -070080 "desktop_geometry_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080081 "desktop_region_unittest.cc",
82 "differ_block_unittest.cc",
zijiehe8fefe982017-02-17 14:32:04 -080083 "fallback_desktop_capturer_wrapper_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080084 "mouse_cursor_monitor_unittest.cc",
85 "rgba_color_unittest.cc",
86 "test_utils.cc",
87 "test_utils.h",
88 "test_utils_unittest.cc",
89 "win/cursor_unittest.cc",
90 "win/cursor_unittest_resources.h",
91 "win/cursor_unittest_resources.rc",
zijiehe4ff42082017-07-13 16:05:24 -070092 "win/screen_capture_utils_unittest.cc",
Zijie He3e45cb52017-07-17 20:33:47 -070093 "win/screen_capturer_win_directx_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080094 ]
95 deps = [
96 ":desktop_capture",
97 ":desktop_capture_mock",
98 ":primitives",
ehmaldonado0d729b32017-02-10 01:38:23 -080099 "../..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700100 "../../rtc_base:rtc_base_approved",
zijieheccf57a72017-03-03 14:40:15 -0800101 "../../system_wrappers",
ehmaldonado0d729b32017-02-10 01:38:23 -0800102 "../../test:test_support",
103 "//testing/gmock",
104 ]
ehmaldonado36268652017-01-19 08:27:11 -0800105 if (rtc_desktop_capture_supported) {
106 sources += [
ehmaldonado36268652017-01-19 08:27:11 -0800107 "screen_capturer_helper_unittest.cc",
108 "screen_capturer_mac_unittest.cc",
109 "screen_capturer_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800110 "window_capturer_unittest.cc",
111 ]
112 deps += [ ":desktop_capture_mock" ]
113 }
114 if (!build_with_chromium && is_clang) {
115 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
116 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
117 }
118 }
119
perkj528a8342017-03-03 00:01:48 -0800120 source_set("screen_drawer") {
121 testonly = true
122
123 public_deps = [
zijieheccf57a72017-03-03 14:40:15 -0800124 ":desktop_capture",
perkj528a8342017-03-03 00:01:48 -0800125 ]
126
127 sources = [
zijiehe6be0a652016-10-27 16:50:35 -0700128 "screen_drawer.cc",
129 "screen_drawer.h",
130 "screen_drawer_linux.cc",
Zijie He825f65e2017-08-16 14:56:42 -0700131 "screen_drawer_lock_posix.cc",
132 "screen_drawer_lock_posix.h",
zijiehe6be0a652016-10-27 16:50:35 -0700133 "screen_drawer_mac.cc",
134 "screen_drawer_win.cc",
135 ]
mbonadeif4235932016-12-29 03:35:56 -0800136
137 deps = [
138 ":primitives",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700139 "../../rtc_base:rtc_base_approved",
mbonadeif4235932016-12-29 03:35:56 -0800140 "../../system_wrappers",
141 ]
zijiehe6be0a652016-10-27 16:50:35 -0700142 }
zijiehe54fd5792016-11-02 14:49:35 -0700143
144 source_set("desktop_capture_mock") {
145 testonly = true
146
147 public_deps = [
148 ":desktop_capture",
zijiehe372719b2016-11-11 17:18:34 -0800149 "//testing/gmock",
zijiehe54fd5792016-11-02 14:49:35 -0700150 ]
151
152 sources = [
153 "desktop_frame_generator.cc",
154 "desktop_frame_generator.h",
zijiehe98903d22016-11-10 21:57:10 -0800155 "fake_desktop_capturer.cc",
zijiehe54fd5792016-11-02 14:49:35 -0700156 "fake_desktop_capturer.h",
zijiehe372719b2016-11-11 17:18:34 -0800157 "mock_desktop_capturer_callback.cc",
zijiehe54fd5792016-11-02 14:49:35 -0700158 "mock_desktop_capturer_callback.h",
mbonadeif4235932016-12-29 03:35:56 -0800159 ]
160
161 deps = [
162 ":primitives",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700163 "../../rtc_base:rtc_base_approved",
mbonadeif4235932016-12-29 03:35:56 -0800164 "../../test:test_support",
zijiehe54fd5792016-11-02 14:49:35 -0700165 ]
166 }
zijiehe6be0a652016-10-27 16:50:35 -0700167}
168
mbonadei13b98822017-08-30 07:24:43 -0700169rtc_source_set("desktop_capture") {
mbonadeiedb84292017-09-04 07:58:29 -0700170 public_deps = [
171 ":desktop_capture_generic",
172 ]
mbonadei13b98822017-08-30 07:24:43 -0700173 if (is_mac) {
mbonadeiedb84292017-09-04 07:58:29 -0700174 public_deps += [ ":desktop_capture_objc" ]
mbonadei13b98822017-08-30 07:24:43 -0700175 }
176}
177
178if (is_mac) {
179 rtc_source_set("desktop_capture_objc") {
mbonadeiedb84292017-09-04 07:58:29 -0700180 visibility = [ ":desktop_capture" ]
mbonadei13b98822017-08-30 07:24:43 -0700181 sources = [
182 "mac/desktop_configuration.mm",
183 "mouse_cursor_monitor_mac.mm",
184 "screen_capturer_mac.mm",
185 "window_capturer_mac.mm",
186 ]
mbonadei13b98822017-08-30 07:24:43 -0700187 deps = [
mbonadeiedb84292017-09-04 07:58:29 -0700188 ":desktop_capture_generic",
mbonadei13b98822017-08-30 07:24:43 -0700189 ":primitives",
190 "../../rtc_base:rtc_base",
191 "../../rtc_base:rtc_base_approved",
192 ]
193 libs = [
194 "AppKit.framework",
195 "IOKit.framework",
196 "OpenGL.framework",
197 ]
198 }
199}
200
201rtc_static_library("desktop_capture_generic") {
mbonadeiedb84292017-09-04 07:58:29 -0700202 visibility = [
203 ":desktop_capture",
204 ":desktop_capture_objc",
205 ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000206 sources = [
zijieheccf57a72017-03-03 14:40:15 -0800207 "blank_detector_desktop_capturer_wrapper.cc",
208 "blank_detector_desktop_capturer_wrapper.h",
jiayl@webrtc.org0e710702014-11-11 18:15:55 +0000209 "cropped_desktop_frame.cc",
210 "cropped_desktop_frame.h",
211 "cropping_window_capturer.cc",
212 "cropping_window_capturer.h",
213 "cropping_window_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000214 "desktop_and_cursor_composer.cc",
215 "desktop_and_cursor_composer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200216 "desktop_capture_options.cc",
217 "desktop_capture_options.h",
zijieheb68d6552016-10-28 17:35:11 -0700218 "desktop_capturer.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000219 "desktop_capturer.h",
Sergey Ulanov1c062bf2016-11-22 16:07:10 -0800220 "desktop_capturer_differ_wrapper.cc",
221 "desktop_capturer_differ_wrapper.h",
zijiehe90ea7362016-11-22 17:17:09 -0800222 "desktop_frame_rotation.cc",
223 "desktop_frame_rotation.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000224 "desktop_frame_win.cc",
225 "desktop_frame_win.h",
Sergey Ulanov1c062bf2016-11-22 16:07:10 -0800226 "differ_block.cc",
227 "differ_block.h",
zijiehe8fefe982017-02-17 14:32:04 -0800228 "fallback_desktop_capturer_wrapper.cc",
229 "fallback_desktop_capturer_wrapper.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000230 "mac/desktop_configuration.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000231 "mac/desktop_configuration_monitor.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200232 "mac/desktop_configuration_monitor.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000233 "mac/full_screen_chrome_window_detector.cc",
234 "mac/full_screen_chrome_window_detector.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000235 "mac/scoped_pixel_buffer_object.cc",
236 "mac/scoped_pixel_buffer_object.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000237 "mac/window_list_utils.cc",
238 "mac/window_list_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000239 "mouse_cursor.cc",
240 "mouse_cursor.h",
241 "mouse_cursor_monitor.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000242 "mouse_cursor_monitor_win.cc",
Zijie He7e1c24c2017-07-27 18:06:12 -0700243 "resolution_tracker.cc",
244 "resolution_tracker.h",
zijieheccf57a72017-03-03 14:40:15 -0800245 "rgba_color.cc",
246 "rgba_color.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000247 "screen_capture_frame_queue.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000248 "screen_capturer_helper.cc",
249 "screen_capturer_helper.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000250 "screen_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000251 "win/cursor.cc",
252 "win/cursor.h",
zijiehe2d618de2016-08-08 17:50:21 -0700253 "win/d3d_device.cc",
254 "win/d3d_device.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000255 "win/desktop.cc",
256 "win/desktop.h",
Zijie He74544f92017-07-24 16:52:17 -0700257 "win/display_configuration_monitor.cc",
258 "win/display_configuration_monitor.h",
zijiehe2d618de2016-08-08 17:50:21 -0700259 "win/dxgi_adapter_duplicator.cc",
260 "win/dxgi_adapter_duplicator.h",
zijiehecf5753d2017-04-20 12:06:04 -0700261 "win/dxgi_context.cc",
262 "win/dxgi_context.h",
zijiehe2d618de2016-08-08 17:50:21 -0700263 "win/dxgi_duplicator_controller.cc",
264 "win/dxgi_duplicator_controller.h",
zijiehecf5753d2017-04-20 12:06:04 -0700265 "win/dxgi_frame.cc",
266 "win/dxgi_frame.h",
zijiehe2d618de2016-08-08 17:50:21 -0700267 "win/dxgi_output_duplicator.cc",
268 "win/dxgi_output_duplicator.h",
269 "win/dxgi_texture.cc",
270 "win/dxgi_texture.h",
271 "win/dxgi_texture_mapping.cc",
272 "win/dxgi_texture_mapping.h",
273 "win/dxgi_texture_staging.cc",
274 "win/dxgi_texture_staging.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000275 "win/scoped_gdi_object.h",
276 "win/scoped_thread_desktop.cc",
277 "win/scoped_thread_desktop.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200278 "win/screen_capture_utils.cc",
279 "win/screen_capture_utils.h",
zijiehe2970c2a2016-05-20 22:08:00 -0700280 "win/screen_capturer_win_directx.cc",
281 "win/screen_capturer_win_directx.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000282 "win/screen_capturer_win_gdi.cc",
283 "win/screen_capturer_win_gdi.h",
284 "win/screen_capturer_win_magnifier.cc",
285 "win/screen_capturer_win_magnifier.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000286 "win/window_capture_utils.cc",
287 "win/window_capture_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000288 "window_capturer_win.cc",
Zijie He70fbbad2017-08-15 15:45:00 -0700289 "window_finder.h",
290 "window_finder_mac.h",
291 "window_finder_mac.mm",
292 "window_finder_win.cc",
293 "window_finder_win.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000294 ]
295
296 if (use_x11) {
297 sources += [
298 "mouse_cursor_monitor_x11.cc",
299 "screen_capturer_x11.cc",
300 "window_capturer_x11.cc",
Zijie He70fbbad2017-08-15 15:45:00 -0700301 "window_finder_x11.cc",
302 "window_finder_x11.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000303 "x11/shared_x_display.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200304 "x11/shared_x_display.h",
Zijie Head501d12017-08-10 11:58:34 -0700305 "x11/window_list_utils.cc",
306 "x11/window_list_utils.h",
307 "x11/x_atom_cache.cc",
308 "x11/x_atom_cache.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000309 "x11/x_error_trap.cc",
310 "x11/x_error_trap.h",
311 "x11/x_server_pixel_buffer.cc",
312 "x11/x_server_pixel_buffer.h",
313 ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200314 configs += [ "//build/config/linux:x11" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000315 }
316
317 if (!is_win && !is_mac && !use_x11) {
318 sources += [
319 "mouse_cursor_monitor_null.cc",
320 "screen_capturer_null.cc",
321 "window_capturer_null.cc",
322 ]
323 }
324
zijiehe2970c2a2016-05-20 22:08:00 -0700325 if (is_win) {
zijiehe2d618de2016-08-08 17:50:21 -0700326 libs = [
327 "d3d11.lib",
328 "dxgi.lib",
329 ]
zijiehe2970c2a2016-05-20 22:08:00 -0700330 }
331
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000332 deps = [
Sergey Ulanov098c1de2015-09-01 11:36:40 -0700333 ":primitives",
mbonadeif4235932016-12-29 03:35:56 -0800334 "../..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700335 "../../rtc_base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000336 "../../system_wrappers",
zijiehe90ea7362016-11-22 17:17:09 -0800337 "//third_party/libyuv",
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000338 ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000339
340 if (use_desktop_capture_differ_sse2) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200341 deps += [ ":desktop_capture_differ_sse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000342 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000343}
344
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000345if (use_desktop_capture_differ_sse2) {
346 # Have to be compiled as a separate target because it needs to be compiled
347 # with SSE2 enabled.
kjellanderb62dbbe2016-09-23 00:38:52 -0700348 rtc_static_library("desktop_capture_differ_sse2") {
brettw@chromium.org0867f692014-09-10 16:24:11 +0000349 visibility = [ ":*" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000350 sources = [
zijiehefef86532016-09-05 15:26:32 -0700351 "differ_vector_sse2.cc",
352 "differ_vector_sse2.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000353 ]
354
ehmaldonado90920d52016-08-16 04:13:01 -0700355 if (is_posix) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200356 cflags = [ "-msse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000357 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000358 }
359}