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