blob: 1cb421ef352132d7f5cfa888de5d539c8a676a86 [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")
zijiehe54fd5792016-11-02 14:49:35 -070011import("desktop_capture.gni")
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +000012
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000013use_desktop_capture_differ_sse2 =
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020014 !is_ios && (current_cpu == "x86" || current_cpu == "x64")
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000015
kjellanderb62dbbe2016-09-23 00:38:52 -070016rtc_static_library("primitives") {
Sergey Ulanov098c1de2015-09-01 11:36:40 -070017 sources = [
18 "desktop_capture_types.h",
19 "desktop_frame.cc",
20 "desktop_frame.h",
21 "desktop_geometry.cc",
22 "desktop_geometry.h",
23 "desktop_region.cc",
24 "desktop_region.h",
Sergey Ulanov58000a02016-10-20 09:33:52 -070025 "shared_desktop_frame.cc",
26 "shared_desktop_frame.h",
27 ]
28
29 deps = [
30 "../../base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
Sergey Ulanov098c1de2015-09-01 11:36:40 -070031 ]
Sergey Ulanov098c1de2015-09-01 11:36:40 -070032}
33
zijiehe6be0a652016-10-27 16:50:35 -070034if (rtc_include_tests) {
zijiehe54fd5792016-11-02 14:49:35 -070035 source_set("rgba_color") {
zijiehe6be0a652016-10-27 16:50:35 -070036 testonly = true
37
38 public_deps = [
39 ":desktop_capture",
40 ]
41
42 sources = [
43 "rgba_color.cc",
44 "rgba_color.h",
zijiehe54fd5792016-11-02 14:49:35 -070045 ]
46 }
47
48 source_set("screen_drawer") {
49 testonly = true
50
51 public_deps = [
52 ":rgba_color",
53 ]
54
55 sources = [
zijiehe6be0a652016-10-27 16:50:35 -070056 "screen_drawer.cc",
57 "screen_drawer.h",
58 "screen_drawer_linux.cc",
59 "screen_drawer_mac.cc",
60 "screen_drawer_win.cc",
61 ]
62 }
zijiehe54fd5792016-11-02 14:49:35 -070063
64 source_set("desktop_capture_mock") {
65 testonly = true
66
67 public_deps = [
68 ":desktop_capture",
69 ":rgba_color",
70 ]
71
72 sources = [
73 "desktop_frame_generator.cc",
74 "desktop_frame_generator.h",
75 "fake_desktop_capturer.h",
76 "fake_screen_capturer.cc",
77 "fake_screen_capturer.h",
78 "mock_desktop_capturer_callback.h",
79 "screen_capturer_mock_objects.h",
80 ]
81 }
zijiehe6be0a652016-10-27 16:50:35 -070082}
83
kjellanderb62dbbe2016-09-23 00:38:52 -070084rtc_static_library("desktop_capture") {
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000085 sources = [
jiayl@webrtc.org0e710702014-11-11 18:15:55 +000086 "cropped_desktop_frame.cc",
87 "cropped_desktop_frame.h",
88 "cropping_window_capturer.cc",
89 "cropping_window_capturer.h",
90 "cropping_window_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000091 "desktop_and_cursor_composer.cc",
92 "desktop_and_cursor_composer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020093 "desktop_capture_options.cc",
94 "desktop_capture_options.h",
zijieheb68d6552016-10-28 17:35:11 -070095 "desktop_capturer.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000096 "desktop_capturer.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000097 "desktop_frame_win.cc",
98 "desktop_frame_win.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000099 "mac/desktop_configuration.h",
100 "mac/desktop_configuration.mm",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000101 "mac/desktop_configuration_monitor.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200102 "mac/desktop_configuration_monitor.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000103 "mac/full_screen_chrome_window_detector.cc",
104 "mac/full_screen_chrome_window_detector.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000105 "mac/scoped_pixel_buffer_object.cc",
106 "mac/scoped_pixel_buffer_object.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +0000107 "mac/window_list_utils.cc",
108 "mac/window_list_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000109 "mouse_cursor.cc",
110 "mouse_cursor.h",
111 "mouse_cursor_monitor.h",
112 "mouse_cursor_monitor_mac.mm",
113 "mouse_cursor_monitor_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000114 "screen_capture_frame_queue.h",
zijieheb68d6552016-10-28 17:35:11 -0700115 "screen_capturer.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000116 "screen_capturer.h",
117 "screen_capturer_helper.cc",
118 "screen_capturer_helper.h",
119 "screen_capturer_mac.mm",
120 "screen_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000121 "shared_memory.cc",
122 "shared_memory.h",
123 "win/cursor.cc",
124 "win/cursor.h",
zijiehe2d618de2016-08-08 17:50:21 -0700125 "win/d3d_device.cc",
126 "win/d3d_device.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000127 "win/desktop.cc",
128 "win/desktop.h",
zijiehe2d618de2016-08-08 17:50:21 -0700129 "win/dxgi_adapter_duplicator.cc",
130 "win/dxgi_adapter_duplicator.h",
131 "win/dxgi_duplicator_controller.cc",
132 "win/dxgi_duplicator_controller.h",
133 "win/dxgi_output_duplicator.cc",
134 "win/dxgi_output_duplicator.h",
135 "win/dxgi_texture.cc",
136 "win/dxgi_texture.h",
137 "win/dxgi_texture_mapping.cc",
138 "win/dxgi_texture_mapping.h",
139 "win/dxgi_texture_staging.cc",
140 "win/dxgi_texture_staging.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000141 "win/scoped_gdi_object.h",
142 "win/scoped_thread_desktop.cc",
143 "win/scoped_thread_desktop.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200144 "win/screen_capture_utils.cc",
145 "win/screen_capture_utils.h",
zijiehe2970c2a2016-05-20 22:08:00 -0700146 "win/screen_capturer_win_directx.cc",
147 "win/screen_capturer_win_directx.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000148 "win/screen_capturer_win_gdi.cc",
149 "win/screen_capturer_win_gdi.h",
150 "win/screen_capturer_win_magnifier.cc",
151 "win/screen_capturer_win_magnifier.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000152 "win/window_capture_utils.cc",
153 "win/window_capture_utils.h",
zijieheb68d6552016-10-28 17:35:11 -0700154 "window_capturer.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000155 "window_capturer.h",
156 "window_capturer_mac.mm",
157 "window_capturer_win.cc",
158 ]
159
160 if (use_x11) {
161 sources += [
162 "mouse_cursor_monitor_x11.cc",
163 "screen_capturer_x11.cc",
164 "window_capturer_x11.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000165 "x11/shared_x_display.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200166 "x11/shared_x_display.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000167 "x11/x_error_trap.cc",
168 "x11/x_error_trap.h",
169 "x11/x_server_pixel_buffer.cc",
170 "x11/x_server_pixel_buffer.h",
171 ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200172 configs += [ "//build/config/linux:x11" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000173 }
174
175 if (!is_win && !is_mac && !use_x11) {
176 sources += [
177 "mouse_cursor_monitor_null.cc",
178 "screen_capturer_null.cc",
179 "window_capturer_null.cc",
180 ]
181 }
182
kjellander131c9582016-08-30 04:23:58 -0700183 if (!is_ios) {
184 sources += [
zijiehe54fd5792016-11-02 14:49:35 -0700185 "desktop_capturer_differ_wrapper.cc",
186 "desktop_capturer_differ_wrapper.h",
kjellander131c9582016-08-30 04:23:58 -0700187 "differ_block.cc",
188 "differ_block.h",
zijiehefef86532016-09-05 15:26:32 -0700189 "screen_capturer_differ_wrapper.cc",
190 "screen_capturer_differ_wrapper.h",
kjellander131c9582016-08-30 04:23:58 -0700191 ]
192 }
193
kjellander@webrtc.org556caff2014-12-19 13:28:37 +0000194 if (is_mac) {
195 libs = [
196 "AppKit.framework",
197 "IOKit.framework",
198 "OpenGL.framework",
199 ]
200 }
201
zijiehe2970c2a2016-05-20 22:08:00 -0700202 if (is_win) {
zijiehe2d618de2016-08-08 17:50:21 -0700203 libs = [
204 "d3d11.lib",
205 "dxgi.lib",
206 ]
zijiehe2970c2a2016-05-20 22:08:00 -0700207 }
208
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000209 deps = [
Sergey Ulanov098c1de2015-09-01 11:36:40 -0700210 ":primitives",
kjellanderfb114242016-06-13 00:19:48 -0700211 "../../base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000212 "../../system_wrappers",
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000213 ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000214
215 if (use_desktop_capture_differ_sse2) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200216 deps += [ ":desktop_capture_differ_sse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000217 }
zijiehe54fd5792016-11-02 14:49:35 -0700218
219 if (rtc_desktop_capture_supported) {
220 defines = [ "RTC_DESKTOP_CAPTURE_SUPPORTED" ]
221 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000222}
223
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000224if (use_desktop_capture_differ_sse2) {
225 # Have to be compiled as a separate target because it needs to be compiled
226 # with SSE2 enabled.
kjellanderb62dbbe2016-09-23 00:38:52 -0700227 rtc_static_library("desktop_capture_differ_sse2") {
brettw@chromium.org0867f692014-09-10 16:24:11 +0000228 visibility = [ ":*" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000229 sources = [
zijiehefef86532016-09-05 15:26:32 -0700230 "differ_vector_sse2.cc",
231 "differ_vector_sse2.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000232 ]
233
ehmaldonado90920d52016-08-16 04:13:01 -0700234 if (is_posix) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200235 cflags = [ "-msse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000236 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000237 }
238}