Rename ui/events/keycodes/dom[34]/ into .../dom/
[chromium-blink-merge.git] / remoting / host / BUILD.gn
blobbbaefbc9229ed8994099588dfc27f6b6d88ee69c
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:dom_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         "desktop_resizer_x11.cc",
75         "input_injector_x11.cc",
76         "local_input_monitor_x11.cc",
77       ]
78       if (is_linux) {
79         # These will already be filtered out on non-Linux.
80         sources -= [
81           "linux/x_server_clipboard.cc",
82           "linux/x_server_clipboard.h",
83         ]
84       }
85     }
87     if (!use_ozone) {
88       sources -= [ "desktop_resizer_ozone.cc" ]
89     }
91     if (is_chromeos) {
92       # TODO(GYP): crbug.com/481627. These should only be included
93       # when enable_me2me_host is true.
94       sources -= [
95         "me2me_desktop_environment.cc",
96         "me2me_desktop_environment.h",
97       ]
98       deps += [
99         "//cc",
100         "//ppapi/host",
101         "//skia",
102         "//ui/aura",
103         "//ui/compositor",
104         "//ui/events",
105         "//ui/views",
106       ]
108       if (use_ash) {
109         deps += [ "//ash" ]
110       }
112       if (use_ozone) {
113         deps += [ "//ui/ozone" ]
114         sources -= [ "desktop_resizer_ozone.cc" ]
115       } else {
116         sources -= [
117           "clipboard_x11.cc",
118           "desktop_resizer_x11.cc",
119           "input_injector_chromeos.cc",
120           "input_injector_chromeos.h",
121           "linux/x_server_clipboard.cc",
122           "linux/x_server_clipboard.h",
123           "local_input_monitor_x11.cc",
124         ]
125       }
127       sources -= [
128         "continue_window_linux.cc",
129         "disconnect_window_linux.cc",
130       ]
131     }
133     if (is_mac) {
134       # TODO(GYP) Mac host_bundle_name and prefpane_bundle_name.
135       # Note if you are looking at this: It really sucks to have to synchronously
136       # call into python twice to get these values. They should instead be
137       # written into a generated header via the process_version template, and we
138       # change the source files to include that header rather than rely on these
139       # defines being set in the build.
140       #defines += [
141       #  "HOST_BUNDLE_NAME=\"$host_bundle_name\"",
142       #  "PREFPANE_BUNDLE_NAME=\"$prefpane_bundle_name\"",
143       #]
145       libs += [
146         "Accelerate.framework",
147         "libpam.a",
148       ]
150       deps += [ "//third_party/google_toolbox_for_mac" ]
151     }
153     if (is_win) {
154       deps += [
155         ":messages",
156         ":remoting_lib_idl",
157       ]
158     }
160     if (enable_webrtc) {
161       deps += [
162         # TODO(GYP): crbug.com/481633. We should probably not have to depend on
163         # libjingle_webrtc; that should be pulled in automatically by
164         # libpeerconnection instead.
165         "//third_party/libjingle:libjingle_webrtc",
166         "//third_party/libjingle:libpeerconnection",
167         "//third_party/webrtc/modules/desktop_capture",
168       ]
170       sources +=
171           rebase_path(remoting_host_srcs_gypi_values.remoting_cast_sources,
172                       ".",
173                       "//remoting")
174     }
175   }
177   source_set("test_support") {
178     testonly = true
180     sources = [
181       "fake_desktop_capturer.cc",
182       "fake_desktop_capturer.h",
183       "fake_desktop_environment.cc",
184       "fake_desktop_environment.h",
185       "fake_host_extension.cc",
186       "fake_host_extension.h",
187       "fake_host_status_monitor.h",
188       "fake_host_status_monitor.h",
189       "fake_mouse_cursor_monitor.cc",
190       "fake_mouse_cursor_monitor.h",
191     ]
193     configs += [ "//remoting:version" ]
195     deps = [
196       "//remoting/proto",
197       "//testing/gtest",
198     ]
199     public_deps = [
200       ":host",
201     ]
203     if (enable_webrtc) {
204       public_deps += [
205         "//third_party/libjingle:libpeerconnection",
206         "//third_party/webrtc/modules/desktop_capture",
207       ]
208     }
209   }
211   # The host portions of the remoting unit tests.
212   source_set("unit_tests") {
213     testonly = true
215     sources = [
216       "audio_pump_unittest.cc",
217       "audio_silence_detector_unittest.cc",
218       "capture_scheduler_unittest.cc",
219       "chromeos/aura_desktop_capturer_unittest.cc",
220       "chromeos/clipboard_aura_unittest.cc",
221       "chromoting_host_context_unittest.cc",
222       "chromoting_host_unittest.cc",
223       "client_session_unittest.cc",
224       "config_file_watcher_unittest.cc",
225       "daemon_process_unittest.cc",
226       "desktop_process_unittest.cc",
227       "desktop_shape_tracker_unittest.cc",
228       "gnubby_auth_handler_posix_unittest.cc",
229       "heartbeat_sender_unittest.cc",
230       "host_change_notification_listener_unittest.cc",
231       "host_config_unittest.cc",
232       "host_extension_session_manager_unittest.cc",
233       "host_mock_objects.cc",
234       "host_status_logger_unittest.cc",
235       "ipc_desktop_environment_unittest.cc",
236       "it2me/it2me_confirmation_dialog_proxy_unittest.cc",
237       "it2me/it2me_native_messaging_host_unittest.cc",
238       "linux/audio_pipe_reader_unittest.cc",
239       "linux/unicode_to_keysym_unittest.cc",
240       "linux/x_server_clipboard_unittest.cc",
241       "local_input_monitor_unittest.cc",
242       "mouse_shape_pump_unittest.cc",
243       "native_messaging/native_messaging_reader_unittest.cc",
244       "native_messaging/native_messaging_writer_unittest.cc",
245       "pairing_registry_delegate_linux_unittest.cc",
246       "pairing_registry_delegate_win_unittest.cc",
247       "pin_hash_unittest.cc",
248       "policy_watcher_unittest.cc",
249       "register_support_host_request_unittest.cc",
250       "remote_input_filter_unittest.cc",
251       "resizing_host_observer_unittest.cc",
252       "screen_resolution_unittest.cc",
253       "server_log_entry_host_unittest.cc",
254       "setup/me2me_native_messaging_host_unittest.cc",
255       "setup/mock_oauth_client.cc",
256       "setup/oauth_helper_unittest.cc",
257       "setup/pin_validator_unittest.cc",
258       "shaped_desktop_capturer_unittest.cc",
259       "token_validator_factory_impl_unittest.cc",
260       "video_frame_pump_unittest.cc",
261       "video_frame_recorder_unittest.cc",
262       "win/rdp_client_unittest.cc",
263       "win/worker_process_launcher.cc",
264       "win/worker_process_launcher.h",
265       "win/worker_process_launcher_unittest.cc",
266     ]
268     if (use_ozone || is_chromeos) {
269       sources -= [ "local_input_monitor_unittest.cc" ]
270     }
271     if (is_chromeos) {
272       sources -= [ "linux/x_server_clipboard_unittest.cc" ]
273     }
275     configs += [ "//remoting:version" ]
277     deps = [
278       ":host",
279       ":test_support",
280       "//remoting/host/setup",
281       "//remoting/host/it2me:common",
282       "//remoting/host/native_messaging",
283       "//remoting/proto",
284       "//skia",
285       "//testing/gmock",
286       "//testing/gtest",
287     ]
289     if (enable_configuration_policy) {
290       deps += [ "//components/policy:policy_component_test_support" ]
291     }
292   }
294   if (is_win) {
295     import("//build/toolchain/win/midl.gni")
296     import("//remoting/tools/build/message_compiler.gni")
298     # TODO(brettw) these should not be generated via exec_script. This should be
299     # part of the build process rather than the metabuild. Instead, a script
300     # should generate a header containing the #defines for this as well as the
301     # IDL file with the values.
302     clsids = exec_script("win/get_clsids.py",
303                          [
304                            remoting_srcs_gypi_values.daemon_controller_guid,
305                            remoting_srcs_gypi_values.rdp_desktop_session_guid,
306                            version_full,
307                          ],
308                          "value")
309     daemon_controller_clsid = clsids[0]
310     rdp_desktop_session_clsid = clsids[1]
312     action("generate_idl") {
313       script = "//build/util/version.py"
315       inputs = [
316         "win/chromoting_lib_idl.templ",
317       ]
318       outputs = [
319         "$target_gen_dir/chromoting_lib.idl",
320       ]
322       args = [
323         "-e",
324         "DAEMON_CONTROLLER_CLSID='$daemon_controller_clsid'",
325         "-e",
326         "RDP_DESKTOP_SESSION_CLSID='$rdp_desktop_session_clsid'",
327         rebase_path(inputs[0], root_build_dir),
328         rebase_path(outputs[0], root_build_dir),
329       ]
330     }
332     midl("remoting_lib_idl") {
333       sources = get_target_outputs(":generate_idl")
334       deps = [
335         ":generate_idl",
336       ]
337     }
339     # Makes the .mc file from the .mc.jinja file.
340     remoting_localize("messages_localizing") {
341       sources = [
342         "win/host_messages.mc.jinja2",
343       ]
344       locales = remoting_locales
345       locale_dir = webapp_locale_dir
346       encoding = "utf-16"
348       # This target is funny. It only produces one file and the output doesn't
349       # match the input. We want to generate remoting_host_messages.mc from
350       # host_messages.mg.jinja2. GN complains if it doesn't see a pattern in the
351       # output, so the following pattern produces the name we want with a template
352       # based on the input.
353       #
354       # TODO: This is for GYP compat. We should just make the names match instead.
355       output = "$target_gen_dir/remoting_{{source_name_part}}"
356     }
358     # Makes the .h/.rc files from the .mc file.
359     message_compiler("messages") {
360       sources = get_target_outputs(":messages_localizing")
361       deps = [
362         ":messages_localizing",
363       ]
364     }
366     # TODO(GYP) More Windows remoting targets from remoting_host_win.gypi
367   }
369   if (enable_remoting_host) {
370     executable("remoting_start_host") {
371       sources = [
372         "setup/host_starter.cc",
373         "setup/host_starter.h",
374         "setup/start_host.cc",
375       ]
377       deps = [
378         "//remoting/host/setup",
379       ]
381       if (enable_webrtc) {
382         deps += [ "//third_party/libjingle:libjingle_webrtc" ]
383       }
384     }
385   }
387   if (enable_me2me_host) {
388     source_set("remoting_me2me_host_static") {
389       sources = [
390         "curtain_mode.h",
391         "curtain_mode_linux.cc",
392         "curtain_mode_mac.cc",
393         "curtain_mode_win.cc",
394         "pam_authorization_factory_posix.cc",
395         "pam_authorization_factory_posix.h",
396         "posix/signal_handler.cc",
397         "posix/signal_handler.h",
398         "remoting_me2me_host.cc",
399       ]
401       configs += [ "//remoting:version" ]
403       deps = [
404         "//base",
405         "//base:i18n",
406         "//components/policy",
407         "//components/policy:policy_component_common",
408         "//net",
409         "//remoting/base",
410         "//remoting/host",
411         "//remoting/proto",
412         "//third_party/webrtc/modules/desktop_capture",
413       ]
415       if (enable_webrtc) {
416         deps += [ "//third_party/libjingle:libjingle_webrtc" ]
417       }
419       if (is_linux) {
420         deps += [ "//build/config/linux/gtk" ]
421       }
422       if (is_linux || is_mac) {
423         libs = [ "pam" ]
424       }
425     }
427     if (!is_win) {
428       executable("remoting_me2me_host") {
429         sources = [
430           "host_main.cc",
431           "host_main.h",
432         ]
434         deps = [
435           ":remoting_me2me_host_static",
436         ]
437       }
438     }
439   }