blob: b63ebb6915575fc321dfc531e20951eec31be513 [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",
Zijie He05ec1782017-09-06 14:09:20 -070077 "cropped_desktop_frame_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080078 "desktop_and_cursor_composer_unittest.cc",
79 "desktop_capturer_differ_wrapper_unittest.cc",
80 "desktop_frame_rotation_unittest.cc",
zijiehe8eef7aa2017-05-18 12:27:16 -070081 "desktop_geometry_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080082 "desktop_region_unittest.cc",
83 "differ_block_unittest.cc",
zijiehe8fefe982017-02-17 14:32:04 -080084 "fallback_desktop_capturer_wrapper_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080085 "mouse_cursor_monitor_unittest.cc",
86 "rgba_color_unittest.cc",
87 "test_utils.cc",
88 "test_utils.h",
89 "test_utils_unittest.cc",
90 "win/cursor_unittest.cc",
91 "win/cursor_unittest_resources.h",
92 "win/cursor_unittest_resources.rc",
zijiehe4ff42082017-07-13 16:05:24 -070093 "win/screen_capture_utils_unittest.cc",
Zijie He3e45cb52017-07-17 20:33:47 -070094 "win/screen_capturer_win_directx_unittest.cc",
ehmaldonado0d729b32017-02-10 01:38:23 -080095 ]
96 deps = [
97 ":desktop_capture",
98 ":desktop_capture_mock",
99 ":primitives",
ehmaldonado0d729b32017-02-10 01:38:23 -0800100 "../..:webrtc_common",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700101 "../../rtc_base:rtc_base_approved",
zijieheccf57a72017-03-03 14:40:15 -0800102 "../../system_wrappers",
ehmaldonado0d729b32017-02-10 01:38:23 -0800103 "../../test:test_support",
104 "//testing/gmock",
105 ]
ehmaldonado36268652017-01-19 08:27:11 -0800106 if (rtc_desktop_capture_supported) {
107 sources += [
ehmaldonado36268652017-01-19 08:27:11 -0800108 "screen_capturer_helper_unittest.cc",
109 "screen_capturer_mac_unittest.cc",
110 "screen_capturer_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800111 "window_capturer_unittest.cc",
112 ]
113 deps += [ ":desktop_capture_mock" ]
114 }
115 if (!build_with_chromium && is_clang) {
116 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
117 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
118 }
119 }
120
perkj528a8342017-03-03 00:01:48 -0800121 source_set("screen_drawer") {
122 testonly = true
123
124 public_deps = [
zijieheccf57a72017-03-03 14:40:15 -0800125 ":desktop_capture",
perkj528a8342017-03-03 00:01:48 -0800126 ]
127
128 sources = [
zijiehe6be0a652016-10-27 16:50:35 -0700129 "screen_drawer.cc",
130 "screen_drawer.h",
131 "screen_drawer_linux.cc",
Zijie He825f65e2017-08-16 14:56:42 -0700132 "screen_drawer_lock_posix.cc",
133 "screen_drawer_lock_posix.h",
zijiehe6be0a652016-10-27 16:50:35 -0700134 "screen_drawer_mac.cc",
135 "screen_drawer_win.cc",
136 ]
mbonadeif4235932016-12-29 03:35:56 -0800137
138 deps = [
139 ":primitives",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700140 "../../rtc_base:rtc_base_approved",
mbonadeif4235932016-12-29 03:35:56 -0800141 "../../system_wrappers",
142 ]
zijiehe6be0a652016-10-27 16:50:35 -0700143 }
zijiehe54fd5792016-11-02 14:49:35 -0700144
145 source_set("desktop_capture_mock") {
146 testonly = true
147
148 public_deps = [
149 ":desktop_capture",
zijiehe372719b2016-11-11 17:18:34 -0800150 "//testing/gmock",
zijiehe54fd5792016-11-02 14:49:35 -0700151 ]
152
153 sources = [
154 "desktop_frame_generator.cc",
155 "desktop_frame_generator.h",
zijiehe98903d22016-11-10 21:57:10 -0800156 "fake_desktop_capturer.cc",
zijiehe54fd5792016-11-02 14:49:35 -0700157 "fake_desktop_capturer.h",
zijiehe372719b2016-11-11 17:18:34 -0800158 "mock_desktop_capturer_callback.cc",
zijiehe54fd5792016-11-02 14:49:35 -0700159 "mock_desktop_capturer_callback.h",
mbonadeif4235932016-12-29 03:35:56 -0800160 ]
161
162 deps = [
163 ":primitives",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700164 "../../rtc_base:rtc_base_approved",
mbonadeif4235932016-12-29 03:35:56 -0800165 "../../test:test_support",
zijiehe54fd5792016-11-02 14:49:35 -0700166 ]
167 }
zijiehe6be0a652016-10-27 16:50:35 -0700168}
169
mbonadei13b98822017-08-30 07:24:43 -0700170rtc_source_set("desktop_capture") {
mbonadeiedb84292017-09-04 07:58:29 -0700171 public_deps = [
172 ":desktop_capture_generic",
173 ]
mbonadei13b98822017-08-30 07:24:43 -0700174 if (is_mac) {
mbonadeiedb84292017-09-04 07:58:29 -0700175 public_deps += [ ":desktop_capture_objc" ]
mbonadei13b98822017-08-30 07:24:43 -0700176 }
177}
178
179if (is_mac) {
180 rtc_source_set("desktop_capture_objc") {
mbonadeiedb84292017-09-04 07:58:29 -0700181 visibility = [ ":desktop_capture" ]
mbonadei13b98822017-08-30 07:24:43 -0700182 sources = [
183 "mac/desktop_configuration.mm",
184 "mouse_cursor_monitor_mac.mm",
185 "screen_capturer_mac.mm",
186 "window_capturer_mac.mm",
Mirko Bonadei080832e2017-09-19 15:44:23 +0200187 "window_finder_mac.h",
188 "window_finder_mac.mm",
mbonadei13b98822017-08-30 07:24:43 -0700189 ]
mbonadei13b98822017-08-30 07:24:43 -0700190 deps = [
mbonadeiedb84292017-09-04 07:58:29 -0700191 ":desktop_capture_generic",
mbonadei13b98822017-08-30 07:24:43 -0700192 ":primitives",
193 "../../rtc_base:rtc_base",
194 "../../rtc_base:rtc_base_approved",
195 ]
196 libs = [
197 "AppKit.framework",
198 "IOKit.framework",
199 "OpenGL.framework",
200 ]
201 }
202}
203
204rtc_static_library("desktop_capture_generic") {
mbonadeiedb84292017-09-04 07:58:29 -0700205 visibility = [
206 ":desktop_capture",
207 ":desktop_capture_objc",
208 ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000209 sources = [
zijieheccf57a72017-03-03 14:40:15 -0800210 "blank_detector_desktop_capturer_wrapper.cc",
211 "blank_detector_desktop_capturer_wrapper.h",
Zijie Hea7567a92017-09-15 09:12:25 -0700212 "capture_result_desktop_capturer_wrapper.cc",
213 "capture_result_desktop_capturer_wrapper.h",
jiayl@webrtc.org0e710702014-11-11 18:15:55 +0000214 "cropped_desktop_frame.cc",
215 "cropped_desktop_frame.h",
216 "cropping_window_capturer.cc",
217 "cropping_window_capturer.h",
218 "cropping_window_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000219 "desktop_and_cursor_composer.cc",
220 "desktop_and_cursor_composer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200221 "desktop_capture_options.cc",
222 "desktop_capture_options.h",
zijieheb68d6552016-10-28 17:35:11 -0700223 "desktop_capturer.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000224 "desktop_capturer.h",
Sergey Ulanov1c062bf2016-11-22 16:07:10 -0800225 "desktop_capturer_differ_wrapper.cc",
226 "desktop_capturer_differ_wrapper.h",
Zijie Hea7567a92017-09-15 09:12:25 -0700227 "desktop_capturer_wrapper.cc",
228 "desktop_capturer_wrapper.h",
zijiehe90ea7362016-11-22 17:17:09 -0800229 "desktop_frame_rotation.cc",
230 "desktop_frame_rotation.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000231 "desktop_frame_win.cc",
232 "desktop_frame_win.h",
Sergey Ulanov1c062bf2016-11-22 16:07:10 -0800233 "differ_block.cc",
234 "differ_block.h",
zijiehe8fefe982017-02-17 14:32:04 -0800235 "fallback_desktop_capturer_wrapper.cc",
236 "fallback_desktop_capturer_wrapper.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000237 "mac/desktop_configuration.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000238 "mac/desktop_configuration_monitor.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200239 "mac/desktop_configuration_monitor.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000240 "mac/full_screen_chrome_window_detector.cc",
241 "mac/full_screen_chrome_window_detector.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000242 "mac/scoped_pixel_buffer_object.cc",
243 "mac/scoped_pixel_buffer_object.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000244 "mac/window_list_utils.cc",
245 "mac/window_list_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000246 "mouse_cursor.cc",
247 "mouse_cursor.h",
248 "mouse_cursor_monitor.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000249 "mouse_cursor_monitor_win.cc",
Zijie He7e1c24c2017-07-27 18:06:12 -0700250 "resolution_tracker.cc",
251 "resolution_tracker.h",
zijieheccf57a72017-03-03 14:40:15 -0800252 "rgba_color.cc",
253 "rgba_color.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000254 "screen_capture_frame_queue.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000255 "screen_capturer_helper.cc",
256 "screen_capturer_helper.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000257 "screen_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000258 "win/cursor.cc",
259 "win/cursor.h",
zijiehe2d618de2016-08-08 17:50:21 -0700260 "win/d3d_device.cc",
261 "win/d3d_device.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000262 "win/desktop.cc",
263 "win/desktop.h",
Zijie He74544f92017-07-24 16:52:17 -0700264 "win/display_configuration_monitor.cc",
265 "win/display_configuration_monitor.h",
zijiehe2d618de2016-08-08 17:50:21 -0700266 "win/dxgi_adapter_duplicator.cc",
267 "win/dxgi_adapter_duplicator.h",
zijiehecf5753d2017-04-20 12:06:04 -0700268 "win/dxgi_context.cc",
269 "win/dxgi_context.h",
zijiehe2d618de2016-08-08 17:50:21 -0700270 "win/dxgi_duplicator_controller.cc",
271 "win/dxgi_duplicator_controller.h",
zijiehecf5753d2017-04-20 12:06:04 -0700272 "win/dxgi_frame.cc",
273 "win/dxgi_frame.h",
zijiehe2d618de2016-08-08 17:50:21 -0700274 "win/dxgi_output_duplicator.cc",
275 "win/dxgi_output_duplicator.h",
276 "win/dxgi_texture.cc",
277 "win/dxgi_texture.h",
278 "win/dxgi_texture_mapping.cc",
279 "win/dxgi_texture_mapping.h",
280 "win/dxgi_texture_staging.cc",
281 "win/dxgi_texture_staging.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000282 "win/scoped_gdi_object.h",
283 "win/scoped_thread_desktop.cc",
284 "win/scoped_thread_desktop.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200285 "win/screen_capture_utils.cc",
286 "win/screen_capture_utils.h",
zijiehe2970c2a2016-05-20 22:08:00 -0700287 "win/screen_capturer_win_directx.cc",
288 "win/screen_capturer_win_directx.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000289 "win/screen_capturer_win_gdi.cc",
290 "win/screen_capturer_win_gdi.h",
291 "win/screen_capturer_win_magnifier.cc",
292 "win/screen_capturer_win_magnifier.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000293 "win/window_capture_utils.cc",
294 "win/window_capture_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000295 "window_capturer_win.cc",
Zijie He70fbbad2017-08-15 15:45:00 -0700296 "window_finder.h",
Zijie He70fbbad2017-08-15 15:45:00 -0700297 "window_finder_win.cc",
298 "window_finder_win.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000299 ]
300
301 if (use_x11) {
302 sources += [
303 "mouse_cursor_monitor_x11.cc",
304 "screen_capturer_x11.cc",
305 "window_capturer_x11.cc",
Zijie He70fbbad2017-08-15 15:45:00 -0700306 "window_finder_x11.cc",
307 "window_finder_x11.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000308 "x11/shared_x_display.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200309 "x11/shared_x_display.h",
Zijie Head501d12017-08-10 11:58:34 -0700310 "x11/window_list_utils.cc",
311 "x11/window_list_utils.h",
312 "x11/x_atom_cache.cc",
313 "x11/x_atom_cache.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000314 "x11/x_error_trap.cc",
315 "x11/x_error_trap.h",
316 "x11/x_server_pixel_buffer.cc",
317 "x11/x_server_pixel_buffer.h",
318 ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200319 configs += [ "//build/config/linux:x11" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000320 }
321
322 if (!is_win && !is_mac && !use_x11) {
323 sources += [
324 "mouse_cursor_monitor_null.cc",
325 "screen_capturer_null.cc",
326 "window_capturer_null.cc",
327 ]
328 }
329
zijiehe2970c2a2016-05-20 22:08:00 -0700330 if (is_win) {
zijiehe2d618de2016-08-08 17:50:21 -0700331 libs = [
332 "d3d11.lib",
333 "dxgi.lib",
334 ]
zijiehe2970c2a2016-05-20 22:08:00 -0700335 }
336
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000337 deps = [
Sergey Ulanov098c1de2015-09-01 11:36:40 -0700338 ":primitives",
mbonadeif4235932016-12-29 03:35:56 -0800339 "../..:webrtc_common",
Niels Möller9155e492017-10-23 11:22:30 +0200340 "../../api:refcountedbase",
ehmaldonadof6a861a2017-07-19 10:40:47 -0700341 "../../rtc_base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000342 "../../system_wrappers",
zijiehe90ea7362016-11-22 17:17:09 -0800343 "//third_party/libyuv",
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000344 ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000345
346 if (use_desktop_capture_differ_sse2) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200347 deps += [ ":desktop_capture_differ_sse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000348 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000349}
350
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000351if (use_desktop_capture_differ_sse2) {
352 # Have to be compiled as a separate target because it needs to be compiled
353 # with SSE2 enabled.
kjellanderb62dbbe2016-09-23 00:38:52 -0700354 rtc_static_library("desktop_capture_differ_sse2") {
brettw@chromium.org0867f692014-09-10 16:24:11 +0000355 visibility = [ ":*" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000356 sources = [
zijiehefef86532016-09-05 15:26:32 -0700357 "differ_vector_sse2.cc",
358 "differ_vector_sse2.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000359 ]
360
ehmaldonado90920d52016-08-16 04:13:01 -0700361 if (is_posix) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200362 cflags = [ "-msse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000363 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000364 }
365}