blob: 4920611bec6db777fc044af6c1bd6bc65802e516 [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")
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +000010import("../../build/webrtc.gni")
11
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) {
zijiehe54fd5792016-11-02 14:49:35 -070036 source_set("rgba_color") {
zijiehe6be0a652016-10-27 16:50:35 -070037 testonly = true
38
39 public_deps = [
40 ":desktop_capture",
41 ]
42
43 sources = [
44 "rgba_color.cc",
45 "rgba_color.h",
zijiehe54fd5792016-11-02 14:49:35 -070046 ]
mbonadeif4235932016-12-29 03:35:56 -080047
48 deps = [
49 ":primitives",
50 "../..:webrtc_common",
51 ]
zijiehe54fd5792016-11-02 14:49:35 -070052 }
53
54 source_set("screen_drawer") {
55 testonly = true
56
57 public_deps = [
58 ":rgba_color",
59 ]
60
61 sources = [
zijiehe6be0a652016-10-27 16:50:35 -070062 "screen_drawer.cc",
63 "screen_drawer.h",
64 "screen_drawer_linux.cc",
65 "screen_drawer_mac.cc",
66 "screen_drawer_win.cc",
67 ]
mbonadeif4235932016-12-29 03:35:56 -080068
69 deps = [
70 ":primitives",
71 "../../base:rtc_base_approved",
72 "../../system_wrappers",
73 ]
zijiehe6be0a652016-10-27 16:50:35 -070074 }
zijiehe54fd5792016-11-02 14:49:35 -070075
76 source_set("desktop_capture_mock") {
77 testonly = true
78
79 public_deps = [
80 ":desktop_capture",
81 ":rgba_color",
zijiehe372719b2016-11-11 17:18:34 -080082 "//testing/gmock",
zijiehe54fd5792016-11-02 14:49:35 -070083 ]
84
85 sources = [
86 "desktop_frame_generator.cc",
87 "desktop_frame_generator.h",
zijiehe98903d22016-11-10 21:57:10 -080088 "fake_desktop_capturer.cc",
zijiehe54fd5792016-11-02 14:49:35 -070089 "fake_desktop_capturer.h",
zijiehe372719b2016-11-11 17:18:34 -080090 "mock_desktop_capturer_callback.cc",
zijiehe54fd5792016-11-02 14:49:35 -070091 "mock_desktop_capturer_callback.h",
mbonadeif4235932016-12-29 03:35:56 -080092 ]
93
94 deps = [
95 ":primitives",
96 "../../base:rtc_base_approved",
97 "../../test:test_support",
zijiehe54fd5792016-11-02 14:49:35 -070098 ]
99 }
zijiehe6be0a652016-10-27 16:50:35 -0700100}
101
kjellanderb62dbbe2016-09-23 00:38:52 -0700102rtc_static_library("desktop_capture") {
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000103 sources = [
jiayl@webrtc.org0e710702014-11-11 18:15:55 +0000104 "cropped_desktop_frame.cc",
105 "cropped_desktop_frame.h",
106 "cropping_window_capturer.cc",
107 "cropping_window_capturer.h",
108 "cropping_window_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000109 "desktop_and_cursor_composer.cc",
110 "desktop_and_cursor_composer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200111 "desktop_capture_options.cc",
112 "desktop_capture_options.h",
zijieheb68d6552016-10-28 17:35:11 -0700113 "desktop_capturer.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000114 "desktop_capturer.h",
Sergey Ulanov1c062bf2016-11-22 16:07:10 -0800115 "desktop_capturer_differ_wrapper.cc",
116 "desktop_capturer_differ_wrapper.h",
zijiehe90ea7362016-11-22 17:17:09 -0800117 "desktop_frame_rotation.cc",
118 "desktop_frame_rotation.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000119 "desktop_frame_win.cc",
120 "desktop_frame_win.h",
Sergey Ulanov1c062bf2016-11-22 16:07:10 -0800121 "differ_block.cc",
122 "differ_block.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000123 "mac/desktop_configuration.h",
124 "mac/desktop_configuration.mm",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000125 "mac/desktop_configuration_monitor.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200126 "mac/desktop_configuration_monitor.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000127 "mac/full_screen_chrome_window_detector.cc",
128 "mac/full_screen_chrome_window_detector.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000129 "mac/scoped_pixel_buffer_object.cc",
130 "mac/scoped_pixel_buffer_object.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000131 "mac/window_list_utils.cc",
132 "mac/window_list_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000133 "mouse_cursor.cc",
134 "mouse_cursor.h",
135 "mouse_cursor_monitor.h",
136 "mouse_cursor_monitor_mac.mm",
137 "mouse_cursor_monitor_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000138 "screen_capture_frame_queue.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000139 "screen_capturer_helper.cc",
140 "screen_capturer_helper.h",
141 "screen_capturer_mac.mm",
142 "screen_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000143 "win/cursor.cc",
144 "win/cursor.h",
zijiehe2d618de2016-08-08 17:50:21 -0700145 "win/d3d_device.cc",
146 "win/d3d_device.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000147 "win/desktop.cc",
148 "win/desktop.h",
zijiehe2d618de2016-08-08 17:50:21 -0700149 "win/dxgi_adapter_duplicator.cc",
150 "win/dxgi_adapter_duplicator.h",
151 "win/dxgi_duplicator_controller.cc",
152 "win/dxgi_duplicator_controller.h",
153 "win/dxgi_output_duplicator.cc",
154 "win/dxgi_output_duplicator.h",
155 "win/dxgi_texture.cc",
156 "win/dxgi_texture.h",
157 "win/dxgi_texture_mapping.cc",
158 "win/dxgi_texture_mapping.h",
159 "win/dxgi_texture_staging.cc",
160 "win/dxgi_texture_staging.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000161 "win/scoped_gdi_object.h",
162 "win/scoped_thread_desktop.cc",
163 "win/scoped_thread_desktop.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200164 "win/screen_capture_utils.cc",
165 "win/screen_capture_utils.h",
zijiehe2970c2a2016-05-20 22:08:00 -0700166 "win/screen_capturer_win_directx.cc",
167 "win/screen_capturer_win_directx.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000168 "win/screen_capturer_win_gdi.cc",
169 "win/screen_capturer_win_gdi.h",
170 "win/screen_capturer_win_magnifier.cc",
171 "win/screen_capturer_win_magnifier.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000172 "win/window_capture_utils.cc",
173 "win/window_capture_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000174 "window_capturer_mac.mm",
175 "window_capturer_win.cc",
176 ]
177
178 if (use_x11) {
179 sources += [
180 "mouse_cursor_monitor_x11.cc",
181 "screen_capturer_x11.cc",
182 "window_capturer_x11.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000183 "x11/shared_x_display.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200184 "x11/shared_x_display.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000185 "x11/x_error_trap.cc",
186 "x11/x_error_trap.h",
187 "x11/x_server_pixel_buffer.cc",
188 "x11/x_server_pixel_buffer.h",
189 ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200190 configs += [ "//build/config/linux:x11" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000191 }
192
193 if (!is_win && !is_mac && !use_x11) {
194 sources += [
195 "mouse_cursor_monitor_null.cc",
196 "screen_capturer_null.cc",
197 "window_capturer_null.cc",
198 ]
199 }
200
kjellander@webrtc.org556caff2014-12-19 13:28:37 +0000201 if (is_mac) {
202 libs = [
203 "AppKit.framework",
204 "IOKit.framework",
205 "OpenGL.framework",
206 ]
207 }
208
zijiehe2970c2a2016-05-20 22:08:00 -0700209 if (is_win) {
zijiehe2d618de2016-08-08 17:50:21 -0700210 libs = [
211 "d3d11.lib",
212 "dxgi.lib",
213 ]
zijiehe2970c2a2016-05-20 22:08:00 -0700214 }
215
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000216 deps = [
Sergey Ulanov098c1de2015-09-01 11:36:40 -0700217 ":primitives",
mbonadeif4235932016-12-29 03:35:56 -0800218 "../..:webrtc_common",
kjellanderfb114242016-06-13 00:19:48 -0700219 "../../base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000220 "../../system_wrappers",
zijiehe90ea7362016-11-22 17:17:09 -0800221 "//third_party/libyuv",
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000222 ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000223
224 if (use_desktop_capture_differ_sse2) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200225 deps += [ ":desktop_capture_differ_sse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000226 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000227}
228
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000229if (use_desktop_capture_differ_sse2) {
230 # Have to be compiled as a separate target because it needs to be compiled
231 # with SSE2 enabled.
kjellanderb62dbbe2016-09-23 00:38:52 -0700232 rtc_static_library("desktop_capture_differ_sse2") {
brettw@chromium.org0867f692014-09-10 16:24:11 +0000233 visibility = [ ":*" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000234 sources = [
zijiehefef86532016-09-05 15:26:32 -0700235 "differ_vector_sse2.cc",
236 "differ_vector_sse2.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000237 ]
238
ehmaldonado90920d52016-08-16 04:13:01 -0700239 if (is_posix) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200240 cflags = [ "-msse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000241 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000242 }
243}