blob: 1583066dc6e62f9348261c104344d6935573a789 [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
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000012use_desktop_capture_differ_sse2 =
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020013 !is_ios && (current_cpu == "x86" || current_cpu == "x64")
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000014
kjellanderb62dbbe2016-09-23 00:38:52 -070015rtc_static_library("primitives") {
Sergey Ulanov098c1de2015-09-01 11:36:40 -070016 sources = [
17 "desktop_capture_types.h",
18 "desktop_frame.cc",
19 "desktop_frame.h",
20 "desktop_geometry.cc",
21 "desktop_geometry.h",
22 "desktop_region.cc",
23 "desktop_region.h",
Sergey Ulanov58000a02016-10-20 09:33:52 -070024 "shared_desktop_frame.cc",
25 "shared_desktop_frame.h",
26 ]
27
28 deps = [
29 "../../base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
Sergey Ulanov098c1de2015-09-01 11:36:40 -070030 ]
Sergey Ulanov098c1de2015-09-01 11:36:40 -070031}
32
zijiehe6be0a652016-10-27 16:50:35 -070033if (rtc_include_tests) {
34 source_set("desktop_capture_test_tools") {
35 testonly = true
36
37 public_deps = [
38 ":desktop_capture",
39 ]
40
41 sources = [
42 "rgba_color.cc",
43 "rgba_color.h",
44 "screen_drawer.cc",
45 "screen_drawer.h",
46 "screen_drawer_linux.cc",
47 "screen_drawer_mac.cc",
48 "screen_drawer_win.cc",
49 ]
50 }
51}
52
kjellanderb62dbbe2016-09-23 00:38:52 -070053rtc_static_library("desktop_capture") {
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000054 sources = [
jiayl@webrtc.org0e710702014-11-11 18:15:55 +000055 "cropped_desktop_frame.cc",
56 "cropped_desktop_frame.h",
57 "cropping_window_capturer.cc",
58 "cropping_window_capturer.h",
59 "cropping_window_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000060 "desktop_and_cursor_composer.cc",
61 "desktop_and_cursor_composer.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020062 "desktop_capture_options.cc",
63 "desktop_capture_options.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000064 "desktop_capturer.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000065 "desktop_frame_win.cc",
66 "desktop_frame_win.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000067 "mac/desktop_configuration.h",
68 "mac/desktop_configuration.mm",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000069 "mac/desktop_configuration_monitor.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020070 "mac/desktop_configuration_monitor.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +000071 "mac/full_screen_chrome_window_detector.cc",
72 "mac/full_screen_chrome_window_detector.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000073 "mac/scoped_pixel_buffer_object.cc",
74 "mac/scoped_pixel_buffer_object.h",
jiayl@webrtc.org12b4efe2014-07-08 22:05:24 +000075 "mac/window_list_utils.cc",
76 "mac/window_list_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000077 "mouse_cursor.cc",
78 "mouse_cursor.h",
79 "mouse_cursor_monitor.h",
80 "mouse_cursor_monitor_mac.mm",
81 "mouse_cursor_monitor_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000082 "screen_capture_frame_queue.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000083 "screen_capturer.h",
84 "screen_capturer_helper.cc",
85 "screen_capturer_helper.h",
86 "screen_capturer_mac.mm",
87 "screen_capturer_win.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000088 "shared_memory.cc",
89 "shared_memory.h",
90 "win/cursor.cc",
91 "win/cursor.h",
zijiehe2d618de2016-08-08 17:50:21 -070092 "win/d3d_device.cc",
93 "win/d3d_device.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +000094 "win/desktop.cc",
95 "win/desktop.h",
zijiehe2d618de2016-08-08 17:50:21 -070096 "win/dxgi_adapter_duplicator.cc",
97 "win/dxgi_adapter_duplicator.h",
98 "win/dxgi_duplicator_controller.cc",
99 "win/dxgi_duplicator_controller.h",
100 "win/dxgi_output_duplicator.cc",
101 "win/dxgi_output_duplicator.h",
102 "win/dxgi_texture.cc",
103 "win/dxgi_texture.h",
104 "win/dxgi_texture_mapping.cc",
105 "win/dxgi_texture_mapping.h",
106 "win/dxgi_texture_staging.cc",
107 "win/dxgi_texture_staging.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000108 "win/scoped_gdi_object.h",
109 "win/scoped_thread_desktop.cc",
110 "win/scoped_thread_desktop.h",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200111 "win/screen_capture_utils.cc",
112 "win/screen_capture_utils.h",
zijiehe2970c2a2016-05-20 22:08:00 -0700113 "win/screen_capturer_win_directx.cc",
114 "win/screen_capturer_win_directx.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000115 "win/screen_capturer_win_gdi.cc",
116 "win/screen_capturer_win_gdi.h",
117 "win/screen_capturer_win_magnifier.cc",
118 "win/screen_capturer_win_magnifier.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000119 "win/window_capture_utils.cc",
120 "win/window_capture_utils.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000121 "window_capturer.h",
122 "window_capturer_mac.mm",
123 "window_capturer_win.cc",
124 ]
125
126 if (use_x11) {
127 sources += [
128 "mouse_cursor_monitor_x11.cc",
129 "screen_capturer_x11.cc",
130 "window_capturer_x11.cc",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000131 "x11/shared_x_display.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200132 "x11/shared_x_display.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000133 "x11/x_error_trap.cc",
134 "x11/x_error_trap.h",
135 "x11/x_server_pixel_buffer.cc",
136 "x11/x_server_pixel_buffer.h",
137 ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200138 configs += [ "//build/config/linux:x11" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000139 }
140
141 if (!is_win && !is_mac && !use_x11) {
142 sources += [
143 "mouse_cursor_monitor_null.cc",
144 "screen_capturer_null.cc",
145 "window_capturer_null.cc",
146 ]
147 }
148
kjellander131c9582016-08-30 04:23:58 -0700149 if (!is_ios) {
150 sources += [
kjellander131c9582016-08-30 04:23:58 -0700151 "differ_block.cc",
152 "differ_block.h",
zijiehefef86532016-09-05 15:26:32 -0700153 "screen_capturer_differ_wrapper.cc",
154 "screen_capturer_differ_wrapper.h",
kjellander131c9582016-08-30 04:23:58 -0700155 ]
156 }
157
kjellander@webrtc.org556caff2014-12-19 13:28:37 +0000158 if (is_mac) {
159 libs = [
160 "AppKit.framework",
161 "IOKit.framework",
162 "OpenGL.framework",
163 ]
164 }
165
zijiehe2970c2a2016-05-20 22:08:00 -0700166 if (is_win) {
zijiehe2d618de2016-08-08 17:50:21 -0700167 libs = [
168 "d3d11.lib",
169 "dxgi.lib",
170 ]
zijiehe2970c2a2016-05-20 22:08:00 -0700171 }
172
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000173 deps = [
Sergey Ulanov098c1de2015-09-01 11:36:40 -0700174 ":primitives",
kjellanderfb114242016-06-13 00:19:48 -0700175 "../../base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000176 "../../system_wrappers",
andrew@webrtc.org6ae5a6d2014-09-16 01:03:29 +0000177 ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000178
179 if (use_desktop_capture_differ_sse2) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200180 deps += [ ":desktop_capture_differ_sse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000181 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000182}
183
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000184if (use_desktop_capture_differ_sse2) {
185 # Have to be compiled as a separate target because it needs to be compiled
186 # with SSE2 enabled.
kjellanderb62dbbe2016-09-23 00:38:52 -0700187 rtc_static_library("desktop_capture_differ_sse2") {
brettw@chromium.org0867f692014-09-10 16:24:11 +0000188 visibility = [ ":*" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000189 sources = [
zijiehefef86532016-09-05 15:26:32 -0700190 "differ_vector_sse2.cc",
191 "differ_vector_sse2.h",
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000192 ]
193
ehmaldonado90920d52016-08-16 04:13:01 -0700194 if (is_posix) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200195 cflags = [ "-msse2" ]
jiayl@webrtc.org93426cd2014-07-02 15:47:12 +0000196 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000197 }
198}