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