1# 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
9import("//build/config/ui.gni")
10import("../../build/webrtc.gni")
11
12use_desktop_capture_differ_sse2 =
13    !is_ios && (current_cpu == "x86" || current_cpu == "x64")
14
15source_set("primitives") {
16  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",
24  ]
25
26  public_configs = [ "../..:common_inherited_config" ]
27}
28
29source_set("desktop_capture") {
30  sources = [
31    "cropped_desktop_frame.cc",
32    "cropped_desktop_frame.h",
33    "cropping_window_capturer.cc",
34    "cropping_window_capturer.h",
35    "cropping_window_capturer_win.cc",
36    "desktop_and_cursor_composer.cc",
37    "desktop_and_cursor_composer.h",
38    "desktop_capture_options.cc",
39    "desktop_capture_options.h",
40    "desktop_capturer.h",
41    "desktop_capturer.h",
42    "desktop_frame_win.cc",
43    "desktop_frame_win.h",
44    "differ.cc",
45    "differ.h",
46    "differ_block.cc",
47    "differ_block.h",
48    "mac/desktop_configuration.h",
49    "mac/desktop_configuration.mm",
50    "mac/desktop_configuration_monitor.cc",
51    "mac/desktop_configuration_monitor.h",
52    "mac/full_screen_chrome_window_detector.cc",
53    "mac/full_screen_chrome_window_detector.h",
54    "mac/scoped_pixel_buffer_object.cc",
55    "mac/scoped_pixel_buffer_object.h",
56    "mac/window_list_utils.cc",
57    "mac/window_list_utils.h",
58    "mouse_cursor.cc",
59    "mouse_cursor.h",
60    "mouse_cursor_monitor.h",
61    "mouse_cursor_monitor_mac.mm",
62    "mouse_cursor_monitor_win.cc",
63    "screen_capture_frame_queue.cc",
64    "screen_capture_frame_queue.h",
65    "screen_capturer.cc",
66    "screen_capturer.h",
67    "screen_capturer_helper.cc",
68    "screen_capturer_helper.h",
69    "screen_capturer_mac.mm",
70    "screen_capturer_win.cc",
71    "shared_desktop_frame.cc",
72    "shared_desktop_frame.h",
73    "shared_memory.cc",
74    "shared_memory.h",
75    "win/cursor.cc",
76    "win/cursor.h",
77    "win/desktop.cc",
78    "win/desktop.h",
79    "win/scoped_gdi_object.h",
80    "win/scoped_thread_desktop.cc",
81    "win/scoped_thread_desktop.h",
82    "win/screen_capture_utils.cc",
83    "win/screen_capture_utils.h",
84    "win/screen_capturer_win_gdi.cc",
85    "win/screen_capturer_win_gdi.h",
86    "win/screen_capturer_win_magnifier.cc",
87    "win/screen_capturer_win_magnifier.h",
88    "win/window_capture_utils.cc",
89    "win/window_capture_utils.h",
90    "window_capturer.cc",
91    "window_capturer.h",
92    "window_capturer_mac.mm",
93    "window_capturer_win.cc",
94  ]
95
96  if (use_x11) {
97    sources += [
98      "mouse_cursor_monitor_x11.cc",
99      "screen_capturer_x11.cc",
100      "window_capturer_x11.cc",
101      "x11/shared_x_display.cc",
102      "x11/shared_x_display.h",
103      "x11/x_error_trap.cc",
104      "x11/x_error_trap.h",
105      "x11/x_server_pixel_buffer.cc",
106      "x11/x_server_pixel_buffer.h",
107    ]
108    configs += [ "//build/config/linux:x11" ]
109  }
110
111  if (!is_win && !is_mac && !use_x11) {
112    sources += [
113      "mouse_cursor_monitor_null.cc",
114      "screen_capturer_null.cc",
115      "window_capturer_null.cc",
116    ]
117  }
118
119  if (is_mac) {
120    libs = [
121      "AppKit.framework",
122      "IOKit.framework",
123      "OpenGL.framework",
124    ]
125  }
126
127  configs += [ "../..:common_config" ]
128  public_configs = [ "../..:common_inherited_config" ]
129
130  if (is_clang && !is_nacl) {
131    # Suppress warnings from Chrome's Clang plugins.
132    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
133    configs -= [ "//build/config/clang:find_bad_constructs" ]
134  }
135
136  deps = [
137    ":primitives",
138    "../../base:rtc_base_approved",
139    "../../system_wrappers",
140  ]
141
142  if (use_desktop_capture_differ_sse2) {
143    deps += [ ":desktop_capture_differ_sse2" ]
144  }
145}
146
147if (use_desktop_capture_differ_sse2) {
148  # Have to be compiled as a separate target because it needs to be compiled
149  # with SSE2 enabled.
150  source_set("desktop_capture_differ_sse2") {
151    visibility = [ ":*" ]
152    sources = [
153      "differ_block_sse2.cc",
154      "differ_block_sse2.h",
155    ]
156
157    configs += [ "../..:common_config" ]
158    public_configs = [ "../..:common_inherited_config" ]
159
160    if (is_posix && !is_mac) {
161      cflags = [ "-msse2" ]
162    }
163  }
164}
165