Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / remoting / host / BUILD.gn
blob5bbd40bdbe4ced1507f2c50e514f2935cd429bed
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 += [ "//build/config/compiler:wexit_time_destructors" ]
37     defines = [ "WEBRTC_CHROMIUM_BUILD" ]
39     deps = [
40       "//base:i18n",
41       "//components/policy:policy_component_common",
42       "//crypto",
43       "//google_apis",
44       "//ipc",
45       "//remoting/base",
46       "//remoting/protocol",
47       "//remoting/resources",
48       "//ui/events/platform",
49       "//ui/events:dom4_keycode_converter",
50     ]
52     if (enable_configuration_policy) {
53       deps += [ "//components/policy:policy" ]
54     }
56     if (is_linux && !is_chromeos) {
57       libs += [ "pam" ]
58     }
60     if (use_x11) {
61       configs += [
62         "//build/config/linux:x11",
63         "//build/config/linux:xrandr",
64       ]
65       if (!is_chromeos) {
66         deps += [ "//build/config/linux/gtk" ]
67       }
68     } else {
69       sources -= [
70         "clipboard_x11.cc",
71         "input_injector_x11.cc",
72         "local_input_monitor_x11.cc",
73       ]
74       if (is_linux) {
75         # These will already be filtered out on non-Linux.
76         sources -= [
77           "linux/x_server_clipboard.cc",
78           "linux/x_server_clipboard.h",
79         ]
80       }
81     }
83     if (is_chromeos) {
84       deps += [
85         "//cc",
86         "//ppapi/host",
87         "//skia",
88         "//ui/aura",
89         "//ui/compositor",
90         "//ui/events",
91         "//ui/views",
92       ]
94       if (use_ash) {
95         deps += [ "//ash" ]
96       }
98       if (use_ozone) {
99         deps += [ "//ui/ozone" ]
100       } else {
101         sources -= [
102           "clipboard_x11.cc",
103           "input_injector_chromeos.cc",
104           "input_injector_chromeos.h",
105           "linux/x_server_clipboard.cc",
106           "linux/x_server_clipboard.h",
107           "local_input_monitor_x11.cc",
108         ]
109       }
111       sources -= [
112         "continue_window_linux.cc",
113         "disconnect_window_linux.cc",
114       ]
115     }
117     if (is_mac) {
118       # TODO(GYP) Mac host_bundle_name and prefpane_bundle_name.
119       # Note if you are looking at this: It really sucks to have to synchronously
120       # call into python twice to get these values. They should instead be
121       # written into a generated header via the process_version template, and we
122       # change the source files to include that header rather than rely on these
123       # defines being set in the build.
124       #defines += [
125       #  "HOST_BUNDLE_NAME=\"$host_bundle_name\"",
126       #  "PREFPANE_BUNDLE_NAME=\"$prefpane_bundle_name\"",
127       #]
129       libs += [
130         "Accelerate.framework",
131         "libpam.a",
132       ]
134       deps += [ "//third_party/google_toolbox_for_mac" ]
135     }
137     if (is_win) {
138       deps += [
139         ":messages",
140         ":remoting_lib_idl",
141       ]
142     }
144     if (enable_webrtc) {
145       deps += [
146         "//third_party/libjingle:libpeerconnection",
147         "//third_party/webrtc/modules/desktop_capture",
148       ]
150       sources +=
151           rebase_path(remoting_host_srcs_gypi_values.remoting_cast_sources,
152                       ".",
153                       "//remoting")
154     }
155   }
157   source_set("test_support") {
158     testonly = true
160     sources = [
161       "fake_desktop_capturer.cc",
162       "fake_desktop_capturer.h",
163       "fake_desktop_environment.cc",
164       "fake_desktop_environment.h",
165       "fake_host_extension.cc",
166       "fake_host_extension.h",
167       "fake_host_status_monitor.h",
168       "fake_host_status_monitor.h",
169       "fake_mouse_cursor_monitor.cc",
170       "fake_mouse_cursor_monitor.h",
171     ]
173     deps = [
174       "//remoting/proto",
175       "//testing/gtest",
176     ]
177     public_deps = [
178       ":host",
179     ]
181     if (enable_webrtc) {
182       public_deps += [
183         "//third_party/libjingle:libpeerconnection",
184         "//third_party/webrtc/modules/desktop_capture",
185       ]
186     }
187   }
189   # The host portions of the remoting unit tests.
190   source_set("unit_tests") {
191     testonly = true
193     sources = [
194       "audio_pump_unittest.cc",
195       "audio_silence_detector_unittest.cc",
196       "capture_scheduler_unittest.cc",
197       "chromeos/aura_desktop_capturer_unittest.cc",
198       "chromeos/clipboard_aura_unittest.cc",
199       "chromoting_host_context_unittest.cc",
200       "chromoting_host_unittest.cc",
201       "client_session_unittest.cc",
202       "config_file_watcher_unittest.cc",
203       "daemon_process_unittest.cc",
204       "desktop_process_unittest.cc",
205       "desktop_shape_tracker_unittest.cc",
206       "gnubby_auth_handler_posix_unittest.cc",
207       "heartbeat_sender_unittest.cc",
208       "host_change_notification_listener_unittest.cc",
209       "host_config_unittest.cc",
210       "host_extension_session_manager_unittest.cc",
211       "host_mock_objects.cc",
212       "host_status_logger_unittest.cc",
213       "ipc_desktop_environment_unittest.cc",
214       "it2me/it2me_confirmation_dialog_proxy_unittest.cc",
215       "it2me/it2me_native_messaging_host_unittest.cc",
216       "linux/audio_pipe_reader_unittest.cc",
217       "linux/unicode_to_keysym_unittest.cc",
218       "linux/x_server_clipboard_unittest.cc",
219       "local_input_monitor_unittest.cc",
220       "mouse_shape_pump_unittest.cc",
221       "native_messaging/native_messaging_reader_unittest.cc",
222       "native_messaging/native_messaging_writer_unittest.cc",
223       "pairing_registry_delegate_linux_unittest.cc",
224       "pairing_registry_delegate_win_unittest.cc",
225       "pin_hash_unittest.cc",
226       "policy_watcher_unittest.cc",
227       "register_support_host_request_unittest.cc",
228       "remote_input_filter_unittest.cc",
229       "resizing_host_observer_unittest.cc",
230       "screen_resolution_unittest.cc",
231       "server_log_entry_host_unittest.cc",
232       "setup/me2me_native_messaging_host_unittest.cc",
233       "setup/oauth_helper_unittest.cc",
234       "setup/pin_validator_unittest.cc",
235       "shaped_desktop_capturer_unittest.cc",
236       "token_validator_factory_impl_unittest.cc",
237       "video_frame_pump_unittest.cc",
238       "video_frame_recorder_unittest.cc",
239       "win/rdp_client_unittest.cc",
240       "win/worker_process_launcher.cc",
241       "win/worker_process_launcher.h",
242       "win/worker_process_launcher_unittest.cc",
243     ]
245     if (use_ozone || is_chromeos) {
246       sources -= [ "local_input_monitor_unittest.cc" ]
247     }
248     if (is_chromeos) {
249       sources -= [ "linux/x_server_clipboard_unittest.cc" ]
250     }
252     deps = [
253       ":host",
254       ":test_support",
255       "//remoting/host/setup",
256       "//remoting/host/it2me:common",
257       "//remoting/host/native_messaging",
258       "//remoting/proto",
259       "//skia",
260       "//testing/gmock",
261       "//testing/gtest",
262     ]
264     if (enable_configuration_policy) {
265       deps += [ "//components/policy:policy_component_test_support" ]
266     }
267   }
269   if (is_win) {
270     import("//build/toolchain/win/midl.gni")
271     import("//remoting/tools/build/message_compiler.gni")
273     # TODO(brettw) these should not be generated via exec_script. This should be
274     # part of the build process rather than the metabuild. Instead, a script
275     # should generate a header containing the #defines for this as well as the
276     # IDL file with the values.
277     clsids = exec_script("win/get_clsids.py",
278                          [
279                            remoting_srcs_gypi_values.daemon_controller_guid,
280                            remoting_srcs_gypi_values.rdp_desktop_session_guid,
281                            version_full,
282                          ],
283                          "value")
284     daemon_controller_clsid = clsids[0]
285     rdp_desktop_session_clsid = clsids[1]
287     action("generate_idl") {
288       script = "//build/util/version.py"
290       inputs = [
291         "win/chromoting_lib_idl.templ",
292       ]
293       outputs = [
294         "$target_gen_dir/chromoting_lib.idl",
295       ]
297       args = [
298         "-e",
299         "DAEMON_CONTROLLER_CLSID='$daemon_controller_clsid'",
300         "-e",
301         "RDP_DESKTOP_SESSION_CLSID='$rdp_desktop_session_clsid'",
302         rebase_path(inputs[0], root_build_dir),
303         rebase_path(outputs[0], root_build_dir),
304       ]
305     }
307     midl("remoting_lib_idl") {
308       sources = get_target_outputs(":generate_idl")
309       deps = [
310         ":generate_idl",
311       ]
312     }
314     # Makes the .mc file from the .mc.jinja file.
315     remoting_localize("messages_localizing") {
316       sources = [
317         "win/host_messages.mc.jinja2",
318       ]
319       locales = remoting_locales
320       locale_dir = webapp_locale_dir
321       encoding = "utf-16"
323       # This target is funny. It only produces one file and the output doesn't
324       # match the input. We want to generate remoting_host_messages.mc from
325       # host_messages.mg.jinja2. GN complains if it doesn't see a pattern in the
326       # output, so the following pattern produces the name we want with a template
327       # based on the input.
328       #
329       # TODO: This is for GYP compat. We should just make the names match instead.
330       output = "$target_gen_dir/remoting_{{source_name_part}}"
331     }
333     # Makes the .h/.rc files from the .mc file.
334     message_compiler("messages") {
335       sources = get_target_outputs(":messages_localizing")
336       deps = [
337         ":messages_localizing",
338       ]
339     }
341     # TODO(GYP) More Windows remoting targets from remoting_host_win.gypi
342   }
344   if (enable_remoting_host) {
345     executable("remoting_start_host") {
346       sources = [
347         "setup/host_starter.cc",
348         "setup/host_starter.h",
349         "setup/start_host.cc",
350       ]
352       deps = [
353         "//remoting/host/setup",
354       ]
356       if (enable_webrtc) {
357         deps += [ "//third_party/libjingle:libjingle_webrtc" ]
358       }
359     }
360   }
362   if (enable_me2me_host) {
363     source_set("remoting_me2me_host_static") {
364       sources = [
365         "curtain_mode.h",
366         "curtain_mode_linux.cc",
367         "curtain_mode_mac.cc",
368         "curtain_mode_win.cc",
369         "pam_authorization_factory_posix.cc",
370         "pam_authorization_factory_posix.h",
371         "posix/signal_handler.cc",
372         "posix/signal_handler.h",
373         "remoting_me2me_host.cc",
374       ]
376       configs += [ "//remoting:version" ]
378       deps = [
379         "//base",
380         "//base:i18n",
381         "//components/policy",
382         "//components/policy:policy_component_common",
383         "//net",
384         "//remoting/base",
385         "//remoting/host",
386         "//remoting/proto",
387         "//third_party/webrtc/modules/desktop_capture",
388       ]
390       if (enable_webrtc) {
391         deps += [ "//third_party/libjingle:libjingle_webrtc" ]
392       }
394       if (is_linux) {
395         deps += [ "//build/config/linux/gtk" ]
396       }
397       if (is_linux || is_mac) {
398         libs = [ "pam" ]
399       }
400     }
402     if (!is_win) {
403       executable("remoting_me2me_host") {
404         sources = [
405           "host_main.cc",
406           "host_main.h",
407         ]
409         deps = [
410           ":remoting_me2me_host_static",
411         ]
412       }
413     }
414   }