Switch audio hang monitor to default-off. Enable for non-beta,stable.
[chromium-blink-merge.git] / remoting / host / BUILD.gn
blob722b9355a24ecf3319d9781a640420aba5351e67
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_host.gni")
8 import("//remoting/remoting_locales.gni")
9 import("//remoting/remoting_srcs.gni")
10 import("//remoting/remoting_version.gni")
11 import("//remoting/tools/build/remoting_localize.gni")
13 if (is_mac) {  # TODO(GYP) Mac build of remoting host.
14   group("host") {
15   }
16   group("test_support") {
17   }
18   group("unit_tests") {
19   }
20 } else {
21   # This must be a static library instead of a source set because
22   # remoting_unittests requires that remoting_me2me_host.cc not be pulled in,
23   # which in turn depends on remoting_me2me_host_static which isn't part of that
24   # build.
25   #
26   # TODO fix this, successful builds should not depend on static libraries
27   # stripping code.
28   static_library("host") {
29     sources = rebase_path(remoting_host_srcs_gypi_values.remoting_host_sources,
30                           ".",
31                           "//remoting")
33     libs = []
35     configs += [
36       "//build/config/compiler:wexit_time_destructors",
37       "//remoting:version",
38     ]
40     defines = [ "WEBRTC_CHROMIUM_BUILD" ]
42     deps = [
43       "//base:i18n",
44       "//components/policy:policy_component_common",
45       "//crypto",
46       "//google_apis",
47       "//ipc",
48       "//remoting/base",
49       "//remoting/protocol",
50       "//remoting/resources",
51       "//ui/events/platform",
52       "//ui/events:dom4_keycode_converter",
53     ]
55     if (enable_configuration_policy) {
56       deps += [ "//components/policy:policy" ]
57     }
59     if (is_linux && !is_chromeos) {
60       libs += [ "pam" ]
61     }
63     if (use_x11) {
64       configs += [
65         "//build/config/linux:x11",
66         "//build/config/linux:xrandr",
67       ]
68       if (!is_chromeos) {
69         deps += [ "//build/config/linux/gtk" ]
70       }
71     } else {
72       sources -= [
73         "clipboard_x11.cc",
74         "input_injector_x11.cc",
75         "local_input_monitor_x11.cc",
76       ]
77       if (is_linux) {
78         # These will already be filtered out on non-Linux.
79         sources -= [
80           "linux/x_server_clipboard.cc",
81           "linux/x_server_clipboard.h",
82         ]
83       }
84     }
86     if (is_chromeos) {
87       # TODO(GYP): crbug.com/481627. These should only be included
88       # when enable_me2me_host is true.
89       sources -= [
90         "me2me_desktop_environment.cc",
91         "me2me_desktop_environment.h",
92       ]
93       deps += [
94         "//cc",
95         "//ppapi/host",
96         "//skia",
97         "//ui/aura",
98         "//ui/compositor",
99         "//ui/events",
100         "//ui/views",
101       ]
103       if (use_ash) {
104         deps += [ "//ash" ]
105       }
107       if (use_ozone) {
108         deps += [ "//ui/ozone" ]
109       } else {
110         sources -= [
111           "clipboard_x11.cc",
112           "input_injector_chromeos.cc",
113           "input_injector_chromeos.h",
114           "linux/x_server_clipboard.cc",
115           "linux/x_server_clipboard.h",
116           "local_input_monitor_x11.cc",
117         ]
118       }
120       sources -= [
121         "continue_window_linux.cc",
122         "disconnect_window_linux.cc",
123       ]
124     }
126     if (is_mac) {
127       # TODO(GYP) Mac host_bundle_name and prefpane_bundle_name.
128       # Note if you are looking at this: It really sucks to have to synchronously
129       # call into python twice to get these values. They should instead be
130       # written into a generated header via the process_version template, and we
131       # change the source files to include that header rather than rely on these
132       # defines being set in the build.
133       #defines += [
134       #  "HOST_BUNDLE_NAME=\"$host_bundle_name\"",
135       #  "PREFPANE_BUNDLE_NAME=\"$prefpane_bundle_name\"",
136       #]
138       libs += [
139         "Accelerate.framework",
140         "libpam.a",
141       ]
143       deps += [ "//third_party/google_toolbox_for_mac" ]
144     }
146     if (is_win) {
147       deps += [
148         ":messages",
149         ":remoting_lib_idl",
150       ]
151     }
153     if (enable_webrtc) {
154       deps += [
155         # TODO(GYP): crbug.com/481633. We should probably not have to depend on
156         # libjingle_webrtc; that should be pulled in automatically by
157         # libpeerconnection instead.
158         "//third_party/libjingle:libjingle_webrtc",
159         "//third_party/libjingle:libpeerconnection",
160         "//third_party/webrtc/modules/desktop_capture",
161       ]
163       sources +=
164           rebase_path(remoting_host_srcs_gypi_values.remoting_cast_sources,
165                       ".",
166                       "//remoting")
167     }
168   }
170   source_set("test_support") {
171     testonly = true
173     sources = [
174       "fake_desktop_capturer.cc",
175       "fake_desktop_capturer.h",
176       "fake_desktop_environment.cc",
177       "fake_desktop_environment.h",
178       "fake_host_extension.cc",
179       "fake_host_extension.h",
180       "fake_host_status_monitor.h",
181       "fake_host_status_monitor.h",
182       "fake_mouse_cursor_monitor.cc",
183       "fake_mouse_cursor_monitor.h",
184     ]
186     configs += [ "//remoting:version" ]
188     deps = [
189       "//remoting/proto",
190       "//testing/gtest",
191     ]
192     public_deps = [
193       ":host",
194     ]
196     if (enable_webrtc) {
197       public_deps += [
198         "//third_party/libjingle:libpeerconnection",
199         "//third_party/webrtc/modules/desktop_capture",
200       ]
201     }
202   }
204   # The host portions of the remoting unit tests.
205   source_set("unit_tests") {
206     testonly = true
208     sources = [
209       "audio_pump_unittest.cc",
210       "audio_silence_detector_unittest.cc",
211       "capture_scheduler_unittest.cc",
212       "chromeos/aura_desktop_capturer_unittest.cc",
213       "chromeos/clipboard_aura_unittest.cc",
214       "chromoting_host_context_unittest.cc",
215       "chromoting_host_unittest.cc",
216       "client_session_unittest.cc",
217       "config_file_watcher_unittest.cc",
218       "daemon_process_unittest.cc",
219       "desktop_process_unittest.cc",
220       "desktop_shape_tracker_unittest.cc",
221       "gnubby_auth_handler_posix_unittest.cc",
222       "heartbeat_sender_unittest.cc",
223       "host_change_notification_listener_unittest.cc",
224       "host_config_unittest.cc",
225       "host_extension_session_manager_unittest.cc",
226       "host_mock_objects.cc",
227       "host_status_logger_unittest.cc",
228       "ipc_desktop_environment_unittest.cc",
229       "it2me/it2me_confirmation_dialog_proxy_unittest.cc",
230       "it2me/it2me_native_messaging_host_unittest.cc",
231       "linux/audio_pipe_reader_unittest.cc",
232       "linux/unicode_to_keysym_unittest.cc",
233       "linux/x_server_clipboard_unittest.cc",
234       "local_input_monitor_unittest.cc",
235       "mouse_shape_pump_unittest.cc",
236       "native_messaging/native_messaging_reader_unittest.cc",
237       "native_messaging/native_messaging_writer_unittest.cc",
238       "pairing_registry_delegate_linux_unittest.cc",
239       "pairing_registry_delegate_win_unittest.cc",
240       "pin_hash_unittest.cc",
241       "policy_watcher_unittest.cc",
242       "register_support_host_request_unittest.cc",
243       "remote_input_filter_unittest.cc",
244       "resizing_host_observer_unittest.cc",
245       "screen_resolution_unittest.cc",
246       "server_log_entry_host_unittest.cc",
247       "setup/me2me_native_messaging_host_unittest.cc",
248       "setup/mock_oauth_client.cc",
249       "setup/oauth_helper_unittest.cc",
250       "setup/pin_validator_unittest.cc",
251       "shaped_desktop_capturer_unittest.cc",
252       "token_validator_factory_impl_unittest.cc",
253       "video_frame_pump_unittest.cc",
254       "video_frame_recorder_unittest.cc",
255       "win/rdp_client_unittest.cc",
256       "win/worker_process_launcher.cc",
257       "win/worker_process_launcher.h",
258       "win/worker_process_launcher_unittest.cc",
259     ]
261     if (use_ozone || is_chromeos) {
262       sources -= [ "local_input_monitor_unittest.cc" ]
263     }
264     if (is_chromeos) {
265       sources -= [ "linux/x_server_clipboard_unittest.cc" ]
266     }
268     configs += [ "//remoting:version" ]
270     deps = [
271       ":host",
272       ":test_support",
273       "//remoting/host/setup",
274       "//remoting/host/it2me:common",
275       "//remoting/host/native_messaging",
276       "//remoting/proto",
277       "//skia",
278       "//testing/gmock",
279       "//testing/gtest",
280     ]
282     if (enable_configuration_policy) {
283       deps += [ "//components/policy:policy_component_test_support" ]
284     }
285   }
287   if (is_win) {
288     import("//build/toolchain/win/midl.gni")
289     import("//remoting/tools/build/message_compiler.gni")
291     # TODO(brettw) these should not be generated via exec_script. This should be
292     # part of the build process rather than the metabuild. Instead, a script
293     # should generate a header containing the #defines for this as well as the
294     # IDL file with the values.
295     clsids = exec_script("win/get_clsids.py",
296                          [
297                            remoting_srcs_gypi_values.daemon_controller_guid,
298                            remoting_srcs_gypi_values.rdp_desktop_session_guid,
299                            version_full,
300                          ],
301                          "value")
302     daemon_controller_clsid = clsids[0]
303     rdp_desktop_session_clsid = clsids[1]
305     action("generate_idl") {
306       script = "//build/util/version.py"
308       inputs = [
309         "win/chromoting_lib_idl.templ",
310       ]
311       outputs = [
312         "$target_gen_dir/chromoting_lib.idl",
313       ]
315       args = [
316         "-e",
317         "DAEMON_CONTROLLER_CLSID='$daemon_controller_clsid'",
318         "-e",
319         "RDP_DESKTOP_SESSION_CLSID='$rdp_desktop_session_clsid'",
320         rebase_path(inputs[0], root_build_dir),
321         rebase_path(outputs[0], root_build_dir),
322       ]
323     }
325     midl("remoting_lib_idl") {
326       sources = get_target_outputs(":generate_idl")
327       deps = [
328         ":generate_idl",
329       ]
330     }
332     # Makes the .mc file from the .mc.jinja file.
333     remoting_localize("messages_localizing") {
334       sources = [
335         "win/host_messages.mc.jinja2",
336       ]
337       locales = remoting_locales
338       locale_dir = webapp_locale_dir
339       encoding = "utf-16"
341       # This target is funny. It only produces one file and the output doesn't
342       # match the input. We want to generate remoting_host_messages.mc from
343       # host_messages.mg.jinja2. GN complains if it doesn't see a pattern in the
344       # output, so the following pattern produces the name we want with a template
345       # based on the input.
346       #
347       # TODO: This is for GYP compat. We should just make the names match instead.
348       output = "$target_gen_dir/remoting_{{source_name_part}}"
349     }
351     # Makes the .h/.rc files from the .mc file.
352     message_compiler("messages") {
353       sources = get_target_outputs(":messages_localizing")
354       deps = [
355         ":messages_localizing",
356       ]
357     }
359     # TODO(GYP) More Windows remoting targets from remoting_host_win.gypi
360   }
362   if (enable_remoting_host) {
363     executable("remoting_start_host") {
364       sources = [
365         "setup/host_starter.cc",
366         "setup/host_starter.h",
367         "setup/start_host.cc",
368       ]
370       deps = [
371         "//remoting/host/setup",
372       ]
374       if (enable_webrtc) {
375         deps += [ "//third_party/libjingle:libjingle_webrtc" ]
376       }
377     }
378   }
380   if (enable_me2me_host) {
381     source_set("remoting_me2me_host_static") {
382       sources = [
383         "curtain_mode.h",
384         "curtain_mode_linux.cc",
385         "curtain_mode_mac.cc",
386         "curtain_mode_win.cc",
387         "pam_authorization_factory_posix.cc",
388         "pam_authorization_factory_posix.h",
389         "posix/signal_handler.cc",
390         "posix/signal_handler.h",
391         "remoting_me2me_host.cc",
392       ]
394       configs += [ "//remoting:version" ]
396       deps = [
397         "//base",
398         "//base:i18n",
399         "//components/policy",
400         "//components/policy:policy_component_common",
401         "//net",
402         "//remoting/base",
403         "//remoting/host",
404         "//remoting/proto",
405         "//third_party/webrtc/modules/desktop_capture",
406       ]
408       if (enable_webrtc) {
409         deps += [ "//third_party/libjingle:libjingle_webrtc" ]
410       }
412       if (is_linux) {
413         deps += [ "//build/config/linux/gtk" ]
414       }
415       if (is_linux || is_mac) {
416         libs = [ "pam" ]
417       }
418     }
420     if (!is_win) {
421       executable("remoting_me2me_host") {
422         sources = [
423           "host_main.cc",
424           "host_main.h",
425         ]
427         deps = [
428           ":remoting_me2me_host_static",
429         ]
430       }
431     }
432   }