blob: 6e7e9bcf3971c946b4383a23db01848ae35678ae [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",
Sergey Ulanov58000a02016-10-20 09:33:52 -070031 "../../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
38 sources = []
39 deps = []
40 if (rtc_desktop_capture_supported) {
41 deps += [
42 ":desktop_capture_mock",
43 ":primitives",
44 ":screen_drawer",
45 "../../base:rtc_base",
46 "../../base:rtc_base_approved",
47 "../../system_wrappers:system_wrappers",
48 "../../test:test_support",
ehmaldonado656610f2017-02-06 02:21:11 -080049 "../../test:video_test_support",
ehmaldonado9cbb0a12017-01-30 03:07:03 -080050 ]
51 sources += [
52 "screen_capturer_integration_test.cc",
53 "screen_drawer_unittest.cc",
54 ]
55 }
56 }
57
ehmaldonado36268652017-01-19 08:27:11 -080058 rtc_source_set("desktop_capture_unittests") {
59 testonly = true
ehmaldonado0d729b32017-02-10 01:38:23 -080060 sources = [
61 "desktop_and_cursor_composer_unittest.cc",
62 "desktop_capturer_differ_wrapper_unittest.cc",
63 "desktop_frame_rotation_unittest.cc",
64 "desktop_region_unittest.cc",
65 "differ_block_unittest.cc",
66 "mouse_cursor_monitor_unittest.cc",
67 "rgba_color_unittest.cc",
68 "test_utils.cc",
69 "test_utils.h",
70 "test_utils_unittest.cc",
71 "win/cursor_unittest.cc",
72 "win/cursor_unittest_resources.h",
73 "win/cursor_unittest_resources.rc",
74 ]
75 deps = [
76 ":desktop_capture",
77 ":desktop_capture_mock",
78 ":primitives",
79 ":rgba_color",
80 "../..:webrtc_common",
81 "../../base:rtc_base_approved",
82 "../../system_wrappers:system_wrappers",
83 "../../test:test_support",
84 "//testing/gmock",
85 ]
ehmaldonado36268652017-01-19 08:27:11 -080086 if (rtc_desktop_capture_supported) {
87 sources += [
ehmaldonado36268652017-01-19 08:27:11 -080088 "screen_capturer_helper_unittest.cc",
89 "screen_capturer_mac_unittest.cc",
90 "screen_capturer_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -080091 "window_capturer_unittest.cc",
92 ]
93 deps += [ ":desktop_capture_mock" ]
94 }
95 if (!build_with_chromium && is_clang) {
96 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
97 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
98 }
99 }
100
zijiehe54fd5792016-11-02 14:49:35 -0700101 source_set("rgba_color") {
zijiehe6be0a652016-10-27 16:50:35 -0700102 testonly = true
103
104 public_deps = [
105 ":desktop_capture",
106 ]
107
108 sources = [
109 "rgba_color.cc",
110 "rgba_color.h",
zijiehe54fd5792016-11-02 14:49:35 -0700111 ]
mbonadeif4235932016-12-29 03:35:56 -0800112
113 deps = [
114 ":primitives",
115 "../..:webrtc_common",
116 ]
zijiehe54fd5792016-11-02 14:49:35 -0700117 }
118
119 source_set("screen_drawer") {
120 testonly = true
121
122 public_deps = [
123 ":rgba_color",
124 ]
125
126 sources = [
zijiehe6be0a652016-10-27 16:50:35 -0700127 "screen_drawer.cc",
128 "screen_drawer.h",
129 "screen_drawer_linux.cc",
130 "screen_drawer_mac.cc",
131 "screen_drawer_win.cc",
132 ]
mbonadeif4235932016-12-29 03:35:56 -0800133
134 deps = [
135 ":primitives",
136 "../../base:rtc_base_approved",
137 "../../system_wrappers",
138 ]
zijiehe6be0a652016-10-27 16:50:35 -0700139 }
zijiehe54fd5792016-11-02 14:49:35 -0700140
141 source_set("desktop_capture_mock") {
142 testonly = true
143
144 public_deps = [
145 ":desktop_capture",
146 ":rgba_color",
zijiehe372719b2016-11-11 17:18:34 -0800147 "//testing/gmock",
zijiehe54fd5792016-11-02 14:49:35 -0700148 ]
149
150 sources = [
151 "desktop_frame_generator.cc",
152 "desktop_frame_generator.h",
zijiehe98903d22016-11-10 21:57:10 -0800153 "fake_desktop_capturer.cc",
zijiehe54fd5792016-11-02 14:49:35 -0700154 "fake_desktop_capturer.h",
zijiehe372719b2016-11-11 17:18:34 -0800155 "mock_desktop_capturer_callback.cc",
zijiehe54fd5792016-11-02 14:49:35 -0700156 "mock_desktop_capturer_callback.h",
mbonadeif4235932016-12-29 03:35:56 -0800157 ]
158
159 deps = [
160 ":primitives",
161 "../../base:rtc_base_approved",
162 "../../test:test_support",
zijiehe54fd5792016-11-02 14:49:35 -0700163 ]
164 }
zijiehe6be0a652016-10-27 16:50:35 -0700165}
166
kjellanderb62dbbe2016-09-23 00:38:52 -0700167rtc_static_library("desktop_capture") {
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000168 sources = [
jiayl@webrtc.org0e710702014-11-11 18:15:55 +0000169 "cropped_desktop_frame.cc",
170 "cropped_desktop_frame.h",
171 "cropping_window_capturer.cc",
172 "cropping_window_capturer.h",
173 "cropping_window_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000174 "desktop_and_cursor_composer.cc",
175 "desktop_and_cursor_composer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200176 "desktop_capture_options.cc",
177 "desktop_capture_options.h",
zijieheb68d6552016-10-28 17:35:11 -0700178 "desktop_capturer.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000179 "desktop_capturer.h",
Sergey Ulanov1c062bf2016-11-22 16:07:10 -0800180 "desktop_capturer_differ_wrapper.cc",
181 "desktop_capturer_differ_wrapper.h",
zijiehe90ea7362016-11-22 17:17:09 -0800182 "desktop_frame_rotation.cc",
183 "desktop_frame_rotation.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000184 "desktop_frame_win.cc",
185 "desktop_frame_win.h",
Sergey Ulanov1c062bf2016-11-22 16:07:10 -0800186 "differ_block.cc",
187 "differ_block.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000188 "mac/desktop_configuration.h",
189 "mac/desktop_configuration.mm",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000190 "mac/desktop_configuration_monitor.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200191 "mac/desktop_configuration_monitor.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000192 "mac/full_screen_chrome_window_detector.cc",
193 "mac/full_screen_chrome_window_detector.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000194 "mac/scoped_pixel_buffer_object.cc",
195 "mac/scoped_pixel_buffer_object.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000196 "mac/window_list_utils.cc",
197 "mac/window_list_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000198 "mouse_cursor.cc",
199 "mouse_cursor.h",
200 "mouse_cursor_monitor.h",
201 "mouse_cursor_monitor_mac.mm",
202 "mouse_cursor_monitor_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000203 "screen_capture_frame_queue.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000204 "screen_capturer_helper.cc",
205 "screen_capturer_helper.h",
206 "screen_capturer_mac.mm",
207 "screen_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000208 "win/cursor.cc",
209 "win/cursor.h",
zijiehe2d618de2016-08-08 17:50:21 -0700210 "win/d3d_device.cc",
211 "win/d3d_device.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000212 "win/desktop.cc",
213 "win/desktop.h",
zijiehe2d618de2016-08-08 17:50:21 -0700214 "win/dxgi_adapter_duplicator.cc",
215 "win/dxgi_adapter_duplicator.h",
216 "win/dxgi_duplicator_controller.cc",
217 "win/dxgi_duplicator_controller.h",
218 "win/dxgi_output_duplicator.cc",
219 "win/dxgi_output_duplicator.h",
220 "win/dxgi_texture.cc",
221 "win/dxgi_texture.h",
222 "win/dxgi_texture_mapping.cc",
223 "win/dxgi_texture_mapping.h",
224 "win/dxgi_texture_staging.cc",
225 "win/dxgi_texture_staging.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000226 "win/scoped_gdi_object.h",
227 "win/scoped_thread_desktop.cc",
228 "win/scoped_thread_desktop.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200229 "win/screen_capture_utils.cc",
230 "win/screen_capture_utils.h",
zijiehe2970c2a2016-05-20 22:08:00 -0700231 "win/screen_capturer_win_directx.cc",
232 "win/screen_capturer_win_directx.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000233 "win/screen_capturer_win_gdi.cc",
234 "win/screen_capturer_win_gdi.h",
235 "win/screen_capturer_win_magnifier.cc",
236 "win/screen_capturer_win_magnifier.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000237 "win/window_capture_utils.cc",
238 "win/window_capture_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000239 "window_capturer_mac.mm",
240 "window_capturer_win.cc",
241 ]
242
243 if (use_x11) {
244 sources += [
245 "mouse_cursor_monitor_x11.cc",
246 "screen_capturer_x11.cc",
247 "window_capturer_x11.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000248 "x11/shared_x_display.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200249 "x11/shared_x_display.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000250 "x11/x_error_trap.cc",
251 "x11/x_error_trap.h",
252 "x11/x_server_pixel_buffer.cc",
253 "x11/x_server_pixel_buffer.h",
254 ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200255 configs += [ "//build/config/linux:x11" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000256 }
257
258 if (!is_win && !is_mac && !use_x11) {
259 sources += [
260 "mouse_cursor_monitor_null.cc",
261 "screen_capturer_null.cc",
262 "window_capturer_null.cc",
263 ]
264 }
265
kjellander@webrtc.org556caff2014-12-19 13:28:37 +0000266 if (is_mac) {
267 libs = [
268 "AppKit.framework",
269 "IOKit.framework",
270 "OpenGL.framework",
271 ]
272 }
273
zijiehe2970c2a2016-05-20 22:08:00 -0700274 if (is_win) {
zijiehe2d618de2016-08-08 17:50:21 -0700275 libs = [
276 "d3d11.lib",
277 "dxgi.lib",
278 ]
zijiehe2970c2a2016-05-20 22:08:00 -0700279 }
280
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000281 deps = [
Sergey Ulanov098c1de2015-09-01 11:36:40 -0700282 ":primitives",
mbonadeif4235932016-12-29 03:35:56 -0800283 "../..:webrtc_common",
kjellanderfb114242016-06-13 00:19:48 -0700284 "../../base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000285 "../../system_wrappers",
zijiehe90ea7362016-11-22 17:17:09 -0800286 "//third_party/libyuv",
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000287 ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000288
289 if (use_desktop_capture_differ_sse2) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200290 deps += [ ":desktop_capture_differ_sse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000291 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000292}
293
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000294if (use_desktop_capture_differ_sse2) {
295 # Have to be compiled as a separate target because it needs to be compiled
296 # with SSE2 enabled.
kjellanderb62dbbe2016-09-23 00:38:52 -0700297 rtc_static_library("desktop_capture_differ_sse2") {
brettw@chromium.org0867f692014-09-10 16:24:11 +0000298 visibility = [ ":*" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000299 sources = [
zijiehefef86532016-09-05 15:26:32 -0700300 "differ_vector_sse2.cc",
301 "differ_vector_sse2.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000302 ]
303
ehmaldonado90920d52016-08-16 04:13:01 -0700304 if (is_posix) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200305 cflags = [ "-msse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000306 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000307 }
308}