Revert of Remove OneClickSigninHelper since it is no longer used. (patchset #5 id...
[chromium-blink-merge.git] / remoting / host / BUILD.gn
blob417fc010f3f7dcae8468a23a4f4bb28bf0339de7
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/features.gni")
6 import("//build/config/ui.gni")
7 import("//remoting/remoting_locales.gni")
8 import("//remoting/remoting_srcs.gni")
9 import("//remoting/remoting_version.gni")
10 import("//remoting/tools/build/remoting_localize.gni")
12 if (is_mac) {  # TODO(GYP) Mac build of remoting host.
13   group("host") {
14   }
15   group("test_support") {
16   }
17   group("unit_tests") {
18   }
19 } else {
20   # This must be a static library instead of a source set because
21   # remoting_unittests requires that remoting_me2me_host.cc not be pulled in,
22   # which in turn depends on remoting_me2me_host_static which isn't part of that
23   # build.
24   #
25   # TODO fix this, successful builds should not depend on static libraries
26   # stripping code.
27   static_library("host") {
28     sources = rebase_path(remoting_host_srcs_gypi_values.remoting_host_sources,
29                           ".",
30                           "//remoting")
32     libs = []
34     configs += [ "//build/config/compiler:wexit_time_destructors" ]
36     defines = [ "WEBRTC_CHROMIUM_BUILD" ]
38     deps = [
39       "//base:i18n",
40       "//components/policy:policy",
41       "//components/policy:policy_component_common",
42       "//crypto",
43       "//google_apis",
44       "//ipc",
45       "//remoting/base",
46       "//remoting/protocol",
47       "//remoting/resources",
48       "//ui/events/platform",
49       "//ui/events:dom4_keycode_converter",
50     ]
52     if (is_linux && !is_chromeos) {
53       libs += [ "pam" ]
54     }
56     if (use_x11) {
57       configs += [
58         "//build/config/linux:x11",
59         "//build/config/linux:xrandr",
60       ]
61       if (!is_chromeos) {
62         deps += [ "//build/config/linux/gtk" ]
63       }
64     } else {
65       sources -= [
66         "clipboard_x11.cc",
67         "input_injector_x11.cc",
68         "local_input_monitor_x11.cc",
69       ]
70       if (is_linux) {
71         # These will already be filtered out on non-Linux.
72         sources -= [
73           "linux/x_server_clipboard.cc",
74           "linux/x_server_clipboard.h",
75         ]
76       }
77     }
79     if (is_chromeos) {
80       deps += [
81         "//cc",
82         "//ppapi/host",
83         "//skia",
84         "//ui/aura",
85         "//ui/compositor",
86         "//ui/events",
87         "//ui/views",
88       ]
90       if (use_ash) {
91         deps += [ "//ash" ]
92       }
94       if (!use_x11) {
95         sources -= [ "input_injector_x11.cc" ]
96       }
98       if (use_ozone) {
99         deps += [ "//ui/ozone" ]
100       } else {
101         sources -= [
102           "clipboard_x11.cc",
103           "input_injector_chromeos.cc",
104           "input_injector_chromeos.h",
105           "linux/x_server_clipboard.cc",
106           "linux/x_server_clipboard.h",
107           "local_input_monitor_x11.cc",
108         ]
109       }
111       sources -= [
112         "continue_window_linux.cc",
113         "disconnect_window_linux.cc",
114       ]
115     }
117     if (is_mac) {
118       # TODO(GYP) Mac host_bundle_name and prefpane_bundle_name.
119       # Note if you are looking at this: It really sucks to have to synchronously
120       # call into python twice to get these values. They should instead be
121       # written into a generated header via the process_version template, and we
122       # change the source files to include that header rather than rely on these
123       # defines being set in the build.
124       #defines += [
125       #  "HOST_BUNDLE_NAME=\"$host_bundle_name\"",
126       #  "PREFPANE_BUNDLE_NAME=\"$prefpane_bundle_name\"",
127       #]
129       libs += [
130         "Accelerate.framework",
131         "libpam.a",
132       ]
134       deps += [ "//third_party/google_toolbox_for_mac" ]
135     }
137     if (is_win) {
138       deps += [
139         ":messages",
140         ":remoting_lib_idl",
141       ]
142     }
144     if (enable_webrtc) {
145       deps += [
146         "//third_party/libjingle:libpeerconnection",
147         "//third_party/webrtc/modules/desktop_capture",
148       ]
150       sources +=
151           rebase_path(remoting_host_srcs_gypi_values.remoting_cast_sources,
152                       ".",
153                       "//remoting")
154     }
155   }
157   source_set("test_support") {
158     testonly = true
160     sources = [
161       "fake_desktop_capturer.cc",
162       "fake_desktop_capturer.h",
163       "fake_desktop_environment.cc",
164       "fake_desktop_environment.h",
165       "fake_host_extension.cc",
166       "fake_host_extension.h",
167       "fake_host_status_monitor.h",
168       "fake_host_status_monitor.h",
169       "fake_mouse_cursor_monitor.cc",
170       "fake_mouse_cursor_monitor.h",
171     ]
173     deps = [
174       "//remoting/proto",
175       "//testing/gtest",
176     ]
177     public_deps = [
178       ":host",
179     ]
181     if (enable_webrtc) {
182       public_deps += [
183         "//third_party/libjingle:libpeerconnection",
184         "//third_party/webrtc/modules/desktop_capture",
185       ]
186     }
187   }
189   # The host portions of the remoting unit tests.
190   source_set("unit_tests") {
191     testonly = true
193     sources = [
194       "audio_pump_unittest.cc",
195       "audio_silence_detector_unittest.cc",
196       "capture_scheduler_unittest.cc",
197       "chromeos/aura_desktop_capturer_unittest.cc",
198       "chromeos/clipboard_aura_unittest.cc",
199       "chromoting_host_context_unittest.cc",
200       "chromoting_host_unittest.cc",
201       "client_session_unittest.cc",
202       "config_file_watcher_unittest.cc",
203       "daemon_process_unittest.cc",
204       "desktop_process_unittest.cc",
205       "desktop_shape_tracker_unittest.cc",
206       "gnubby_auth_handler_posix_unittest.cc",
207       "heartbeat_sender_unittest.cc",
208       "host_change_notification_listener_unittest.cc",
209       "host_config_unittest.cc",
210       "host_extension_session_manager_unittest.cc",
211       "host_mock_objects.cc",
212       "host_status_logger_unittest.cc",
213       "ipc_desktop_environment_unittest.cc",
214       "it2me/it2me_confirmation_dialog_proxy_unittest.cc",
215       "it2me/it2me_native_messaging_host_unittest.cc",
216       "linux/audio_pipe_reader_unittest.cc",
217       "linux/unicode_to_keysym_unittest.cc",
218       "linux/x_server_clipboard_unittest.cc",
219       "local_input_monitor_unittest.cc",
220       "mouse_shape_pump_unittest.cc",
221       "native_messaging/native_messaging_reader_unittest.cc",
222       "native_messaging/native_messaging_writer_unittest.cc",
223       "pairing_registry_delegate_linux_unittest.cc",
224       "pairing_registry_delegate_win_unittest.cc",
225       "pin_hash_unittest.cc",
226       "policy_watcher_unittest.cc",
227       "register_support_host_request_unittest.cc",
228       "remote_input_filter_unittest.cc",
229       "resizing_host_observer_unittest.cc",
230       "screen_resolution_unittest.cc",
231       "server_log_entry_host_unittest.cc",
232       "setup/me2me_native_messaging_host_unittest.cc",
233       "setup/oauth_helper_unittest.cc",
234       "setup/pin_validator_unittest.cc",
235       "shaped_desktop_capturer_unittest.cc",
236       "token_validator_factory_impl_unittest.cc",
237       "video_frame_pump_unittest.cc",
238       "video_frame_recorder_unittest.cc",
239       "win/rdp_client_unittest.cc",
240       "win/worker_process_launcher.cc",
241       "win/worker_process_launcher.h",
242       "win/worker_process_launcher_unittest.cc",
243     ]
245     if (use_ozone || is_chromeos) {
246       sources -= [ "local_input_monitor_unittest.cc" ]
247     }
248     if (is_chromeos) {
249       sources -= [ "linux/x_server_clipboard_unittest.cc" ]
250     }
252     deps = [
253       ":host",
254       ":test_support",
255       "//components/policy:policy_component_test_support",
256       "//remoting/host/setup",
257       "//remoting/host/it2me:common",
258       "//remoting/host/native_messaging",
259       "//remoting/proto",
260       "//skia",
261       "//testing/gmock",
262       "//testing/gtest",
263     ]
264   }
266   if (is_win) {
267     import("//build/toolchain/win/midl.gni")
268     import("//remoting/tools/build/message_compiler.gni")
270     # TODO(brettw) these should not be generated via exec_script. This should be
271     # part of the build process rather than the metabuild. Instead, a script
272     # should generate a header containing the #defines for this as well as the
273     # IDL file with the values.
274     clsids = exec_script("win/get_clsids.py",
275                          [
276                            remoting_srcs_gypi_values.daemon_controller_guid,
277                            remoting_srcs_gypi_values.rdp_desktop_session_guid,
278                            version_full,
279                          ],
280                          "value")
281     daemon_controller_clsid = clsids[0]
282     rdp_desktop_session_clsid = clsids[1]
284     action("generate_idl") {
285       script = "//build/util/version.py"
287       inputs = [
288         "win/chromoting_lib_idl.templ",
289       ]
290       outputs = [
291         "$target_gen_dir/chromoting_lib.idl",
292       ]
294       args = [
295         "-e",
296         "DAEMON_CONTROLLER_CLSID='$daemon_controller_clsid'",
297         "-e",
298         "RDP_DESKTOP_SESSION_CLSID='$rdp_desktop_session_clsid'",
299         rebase_path(inputs[0], root_build_dir),
300         rebase_path(outputs[0], root_build_dir),
301       ]
302     }
304     midl("remoting_lib_idl") {
305       sources = get_target_outputs(":generate_idl")
306       deps = [
307         ":generate_idl",
308       ]
309     }
311     # Makes the .mc file from the .mc.jinja file.
312     remoting_localize("messages_localizing") {
313       sources = [
314         "win/host_messages.mc.jinja2",
315       ]
316       locales = remoting_locales
317       locale_dir = webapp_locale_dir
318       encoding = "utf-16"
320       # This target is funny. It only produces one file and the output doesn't
321       # match the input. We want to generate remoting_host_messages.mc from
322       # host_messages.mg.jinja2. GN complains if it doesn't see a pattern in the
323       # output, so the following pattern produces the name we want with a template
324       # based on the input.
325       #
326       # TODO: This is for GYP compat. We should just make the names match instead.
327       output = "$target_gen_dir/remoting_{{source_name_part}}"
328     }
330     # Makes the .h/.rc files from the .mc file.
331     message_compiler("messages") {
332       sources = get_target_outputs(":messages_localizing")
333       deps = [
334         ":messages_localizing",
335       ]
336     }
338     # TODO(GYP) More Windows remoting targets from remoting_host_win.gypi
339   }