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