Add IsAlternativeServiceBroken(), remove is_broken.
[chromium-blink-merge.git] / remoting / remoting_host_win.gypi
blob8a796a0b20e75d66f1e57723ec5ed03c5414a47c
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.
6   'variables': {
7     'remoting_host_installer_win_roots': [
8       'host/installer/win/',
9     ],
10     'remoting_host_installer_win_files': [
11       'host/installer/win/chromoting.wxs',
12       'host/installer/win/parameters.json',
13     ],
14   },  # end of 'variables'
16   'targets': [
17     {
18       'target_name': 'remoting_breakpad_tester',
19       'type': 'executable',
20       'variables': { 'enable_wexit_time_destructors': 1, },
21       'dependencies': [
22         '../base/base.gyp:base',
23         'remoting_host',
24       ],
25       'sources': [
26         'tools/breakpad_tester_win.cc',
27       ],
28     },  # end of target 'remoting_breakpad_tester'
29     {
30       # GN version: //remoting/host:remoting_lib_idl
31       'target_name': 'remoting_lib_idl',
32       'type': 'static_library',
33       'sources': [
34         'host/win/chromoting_lib_idl.templ',
35         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.h',
36         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.idl',
37         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib_i.c',
38       ],
39       # This target exports a hard dependency because dependent targets may
40       # include chromoting_lib.h, a generated header.
41       'hard_dependency': 1,
42       'msvs_settings': {
43         'VCMIDLTool': {
44           'OutputDirectory': '<(SHARED_INTERMEDIATE_DIR)/remoting/host',
45         },
46       },
47       'direct_dependent_settings': {
48         'include_dirs': [
49           '<(SHARED_INTERMEDIATE_DIR)',
50         ],
51       },
52       'rules': [
53         {
54           # GN version: //remoting/host:generate_idl
55           'rule_name': 'generate_idl',
56           'extension': 'templ',
57           'outputs': [
58             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.idl',
59           ],
60           'action': [
61             'python', '<(version_py_path)',
62             '-e', "DAEMON_CONTROLLER_CLSID='<(daemon_controller_clsid)'",
63             '-e', "RDP_DESKTOP_SESSION_CLSID='<(rdp_desktop_session_clsid)'",
64             '<(RULE_INPUT_PATH)',
65             '<@(_outputs)',
66           ],
67           'process_outputs_as_sources': 1,
68           'message': 'Generating <@(_outputs)',
69         },
70       ],
71     },  # end of target 'remoting_lib_idl'
73     # remoting_lib_ps builds the proxy/stub code generated by MIDL (see
74     # remoting_lib_idl).
75     {
76       'target_name': 'remoting_lib_ps',
77       'type': 'static_library',
78       'defines': [
79         # Prepend 'Ps' to the MIDL-generated routines. This includes
80         # DllGetClassObject, DllCanUnloadNow, DllRegisterServer,
81         # DllUnregisterServer, and DllMain.
82         'ENTRY_PREFIX=Ps',
83         'REGISTER_PROXY_DLL',
84       ],
85       'dependencies': [
86         'remoting_lib_idl',
87       ],
88       'sources': [
89         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.dlldata.c',
90         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib_p.c',
91       ],
92     },  # end of target 'remoting_lib_ps'
94     # Regenerates 'chromoting_lib.rc' (used to embed 'chromoting_lib.tlb'
95     # into remoting_core.dll's resources) every time
96     # 'chromoting_lib_idl.templ' changes. Making remoting_core depend on
97     # both this and 'remoting_lib_idl' targets ensures that the resorces
98     # are rebuilt every time the type library is updated. GYP alone is
99     # not smart enough to figure out this dependency on its own.
100     {
101       'target_name': 'remoting_lib_rc',
102       'type': 'none',
103       'sources': [
104         'host/win/chromoting_lib_idl.templ',
105       ],
106       'hard_dependency': 1,
107       'direct_dependent_settings': {
108         'include_dirs': [
109           '<(SHARED_INTERMEDIATE_DIR)',
110         ],
111       },
112       'rules': [
113         {
114           'rule_name': 'generate_rc',
115           'extension': 'templ',
116           'outputs': [
117             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.rc',
118           ],
119           'action': [
120             'echo 1 typelib "remoting/host/chromoting_lib.tlb" > <@(_outputs)',
121           ],
122           'message': 'Generating <@(_outputs)',
123         },
124       ],
125     },  # end of target 'remoting_lib_rc'
126     # The only difference between |remoting_console.exe| and
127     # |remoting_host.exe| is that the former is a console application.
128     # |remoting_console.exe| is used for debugging purposes.
129     {
130       'target_name': 'remoting_console',
131       'type': 'executable',
132       'variables': { 'enable_wexit_time_destructors': 1, },
133       'defines': [
134         'BINARY=BINARY_HOST_ME2ME',
135       ],
136       'dependencies': [
137         'remoting_core',
138         'remoting_windows_resources',
139       ],
140       'sources': [
141         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
142         'host/win/entry_point.cc',
143       ],
144       'msvs_settings': {
145         'VCManifestTool': {
146           'AdditionalManifestFiles': [
147             'host/win/dpi_aware.manifest',
148           ],
149         },
150         'VCLinkerTool': {
151           'EntryPointSymbol': 'HostEntryPoint',
152           'IgnoreAllDefaultLibraries': 'true',
153           'SubSystem': '1', # /SUBSYSTEM:CONSOLE
154         },
155       },
156     },  # end of target 'remoting_console'
157     {
158       'target_name': 'remoting_core',
159       'type': 'shared_library',
160       'variables': { 'enable_wexit_time_destructors': 1, },
161       'defines' : [
162         '_ATL_APARTMENT_THREADED',
163         '_ATL_CSTRING_EXPLICIT_CONSTRUCTORS',
164         '_ATL_NO_AUTOMATIC_NAMESPACE',
165         '_ATL_NO_EXCEPTIONS',
166         'BINARY=BINARY_CORE',
167         'DAEMON_CONTROLLER_CLSID="{<(daemon_controller_clsid)}"',
168         'RDP_DESKTOP_SESSION_CLSID="{<(rdp_desktop_session_clsid)}"',
169         'HOST_IMPLEMENTATION',
170         'ISOLATION_AWARE_ENABLED=1',
171         'STRICT',
172         'VERSION=<(version_full)',
173       ],
174       'dependencies': [
175         '../base/base.gyp:base',
176         '../base/base.gyp:base_static',
177         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
178         '../ipc/ipc.gyp:ipc',
179         '../net/net.gyp:net',
180         '../third_party/webrtc/modules/modules.gyp:desktop_capture',
181         'remoting_base',
182         'remoting_breakpad',
183         'remoting_host',
184         'remoting_host_setup_base',
185         'remoting_it2me_host_static',
186         'remoting_lib_idl',
187         'remoting_lib_ps',
188         'remoting_lib_rc',
189         'remoting_me2me_host_static',
190         'remoting_native_messaging_base',
191         'remoting_protocol',
192         'remoting_windows_resources',
193       ],
194       'sources': [
195         '<(SHARED_INTERMEDIATE_DIR)/remoting/core.rc',
196         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.rc',
197         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/remoting_host_messages.rc',
198         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
199         'host/desktop_process_main.cc',
200         'host/host_main.cc',
201         'host/host_main.h',
202         'host/it2me/it2me_native_messaging_host_main.cc',
203         'host/it2me/it2me_native_messaging_host_main.h',
204         'host/setup/me2me_native_messaging_host_main.cc',
205         'host/setup/me2me_native_messaging_host_main.h',
206         'host/win/chromoting_module.cc',
207         'host/win/chromoting_module.h',
208         'host/win/core.cc',
209         'host/win/core_resource.h',
210         'host/win/host_service.cc',
211         'host/win/host_service.h',
212         'host/win/omaha.cc',
213         'host/win/omaha.h',
214         'host/win/rdp_desktop_session.cc',
215         'host/win/rdp_desktop_session.h',
216         'host/win/unprivileged_process_delegate.cc',
217         'host/win/unprivileged_process_delegate.h',
218         'host/win/worker_process_launcher.cc',
219         'host/win/worker_process_launcher.h',
220         'host/win/wts_session_process_delegate.cc',
221         'host/win/wts_session_process_delegate.h',
222         'host/worker_process_ipc_delegate.h',
223       ],
224       'msvs_settings': {
225         'VCManifestTool': {
226           'EmbedManifest': 'true',
227           'AdditionalManifestFiles': [
228             'host/win/common-controls.manifest',
229           ],
230         },
231         'VCLinkerTool': {
232           'AdditionalDependencies': [
233             'comctl32.lib',
234             'rpcns4.lib',
235             'rpcrt4.lib',
236             'uuid.lib',
237             'wtsapi32.lib',
238           ],
239           'AdditionalOptions': [
240             # Export the proxy/stub entry points. Note that the generated
241             # routines have 'Ps' prefix to avoid conflicts with our own
242             # DllMain().
243             '/EXPORT:DllGetClassObject=PsDllGetClassObject,PRIVATE',
244             '/EXPORT:DllCanUnloadNow=PsDllCanUnloadNow,PRIVATE',
245             '/EXPORT:DllRegisterServer=PsDllRegisterServer,PRIVATE',
246             '/EXPORT:DllUnregisterServer=PsDllUnregisterServer,PRIVATE',
247           ],
248         },
249         'conditions': [
250           ['clang==1', {
251             # atlapp.h contains a global "using namespace WTL;".
252             # TODO: Remove once remoting/host/verify_config_window_win.h no
253             # longer depends on atlapp.h, http://crbug.com/5027
254             'VCCLCompilerTool': {
255               'AdditionalOptions': ['-Wno-header-hygiene'],
256             },
257           }],
258         ],
259       },
260     },  # end of target 'remoting_core'
261     {
262       'target_name': 'remoting_desktop',
263       'type': 'executable',
264       'variables': { 'enable_wexit_time_destructors': 1, },
265       'defines': [
266         'BINARY=BINARY_DESKTOP',
267       ],
268       'dependencies': [
269         'remoting_core',
270         'remoting_windows_resources',
271       ],
272       'sources': [
273         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
274         'host/win/entry_point.cc',
275       ],
276       'msvs_settings': {
277         'VCManifestTool': {
278           'AdditionalManifestFiles': [
279             'host/win/dpi_aware.manifest',
280           ],
281         },
282         'VCLinkerTool': {
283           'EnableUAC': 'true',
284           # Add 'level="requireAdministrator" uiAccess="true"' to
285           # the manifest only for the official builds because it requires
286           # the binary to be signed to work.
287           'conditions': [
288             ['buildtype == "Official"', {
289               'UACExecutionLevel': 2,
290               'UACUIAccess': 'true',
291             }],
292           ],
293           'EntryPointSymbol': 'HostEntryPoint',
294           'IgnoreAllDefaultLibraries': 'true',
295           'SubSystem': '2', # /SUBSYSTEM:WINDOWS
296         },
297       },
298     },  # end of target 'remoting_desktop'
299     {
300       'target_name': 'remoting_me2me_host',
301       'product_name': 'remoting_host',
302       'type': 'executable',
303       'variables': { 'enable_wexit_time_destructors': 1, },
304       'defines': [
305         'BINARY=BINARY_HOST_ME2ME',
306       ],
307       'dependencies': [
308         'remoting_core',
309         'remoting_windows_resources',
310       ],
311       'sources': [
312         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
313         'host/win/entry_point.cc',
314       ],
315       'msvs_settings': {
316         'VCManifestTool': {
317           'AdditionalManifestFiles': [
318             'host/win/dpi_aware.manifest',
319           ],
320         },
321         'VCLinkerTool': {
322           'EntryPointSymbol': 'HostEntryPoint',
323           'IgnoreAllDefaultLibraries': 'true',
324           'OutputFile': '$(OutDir)\\remoting_host.exe',
325           'SubSystem': '2', # /SUBSYSTEM:WINDOWS
326         },
327       },
328     },  # end of target 'remoting_me2me_host'
329     {
330       'target_name': 'remoting_me2me_native_messaging_host',
331       'type': 'executable',
332       'product_name': 'remoting_native_messaging_host',
333       'variables': { 'enable_wexit_time_destructors': 1, },
334       'defines' : [
335         'BINARY=BINARY_NATIVE_MESSAGING_HOST',
336       ],
337       'dependencies': [
338         'remoting_core',
339         'remoting_windows_resources',
340       ],
341       'sources': [
342         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
343         'host/setup/me2me_native_messaging_host_entry_point.cc',
344       ],
345       'msvs_settings': {
346         'VCLinkerTool': {
347           'IgnoreAllDefaultLibraries': 'true',
348           'SubSystem': '1', # /SUBSYSTEM:CONSOLE
349         },
350       },
351     },  # end of target 'remoting_me2me_native_messaging_host'
352     {
353       'target_name': 'remoting_it2me_native_messaging_host',
354       'type': 'executable',
355       'product_name': 'remote_assistance_host',
356       'variables': { 'enable_wexit_time_destructors': 1, },
357       'dependencies': [
358         'remoting_core',
359         'remoting_windows_resources',
360       ],
361       'sources': [
362         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
363         'host/it2me/it2me_native_messaging_host_entry_point.cc',
364       ],
365       'defines' : [
366         'BINARY=BINARY_REMOTE_ASSISTANCE_HOST',
367       ],
368       'msvs_settings': {
369         'VCManifestTool': {
370           'EmbedManifest': 'true',
371           'AdditionalManifestFiles': [
372             'host/win/common-controls.manifest',
373             'host/win/dpi_aware.manifest',
374           ],
375         },
376         'VCLinkerTool': {
377           'IgnoreAllDefaultLibraries': 'true',
378           'SubSystem': '1', # /SUBSYSTEM:CONSOLE
379           'AdditionalDependencies': [
380             'comctl32.lib',
381           ],
382         },
383       },
384     },  # end of target 'remoting_it2me_native_messaging_host'
385     {
386       # GN version: //remoting/host:messages
387       'target_name': 'remoting_host_messages',
388       'type': 'none',
389       'dependencies': [
390         'remoting_resources',
391       ],
392       'hard_dependency': 1,
393       'direct_dependent_settings': {
394         'include_dirs': [
395           '<(SHARED_INTERMEDIATE_DIR)',
396         ],
397       },
398       'sources': [
399         'host/win/host_messages.mc.jinja2'
400       ],
401       'rules': [
402         {
403           'rule_name': 'localize',
404           'extension': 'jinja2',
405           'outputs': [
406             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/remoting_host_messages.mc',
407           ],
408           'action': [
409             'python', '<(remoting_localize_path)',
410             '--locale_dir', '<(webapp_locale_dir)',
411             '--template', '<(RULE_INPUT_PATH)',
412             '--output', '<@(_outputs)',
413             '--encoding', 'utf-16',
414             '<@(remoting_locales)',
415           ],
416           'message': 'Localizing the event log messages'
417         },
418       ],
419     },  # end of target 'remoting_host_messages'
421     # Generates localized resources for the Windows binaries.
422     # The substitution strings are taken from:
423     #   - build/util/LASTCHANGE - the last source code revision. There is
424     #       no explicit dependency on this file to avoid rebuilding the host
425     #       after unrelated changes.
426     #   - chrome/VERSION - the major, build & patch versions.
427     #   - remoting/VERSION - the chromoting patch version (and overrides
428     #       for chrome/VERSION).
429     #   - translated webapp strings
430     {
431       'target_name': 'remoting_windows_resources',
432       'type': 'none',
433       'dependencies': [
434         'remoting_resources',
435       ],
436       'hard_dependency': 1,
437       'direct_dependent_settings': {
438         'include_dirs': [
439           '<(SHARED_INTERMEDIATE_DIR)',
440         ],
441       },
442       'sources': [
443         'host/win/core.rc.jinja2',
444         'host/win/version.rc.jinja2',
445       ],
446       'rules': [
447         {
448           'rule_name': 'version',
449           'extension': 'jinja2',
450           'variables': {
451             'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
452           },
453           'inputs': [
454             '<(chrome_version_path)',
455             '<(remoting_version_path)',
456           ],
457           'outputs': [
458             '<(SHARED_INTERMEDIATE_DIR)/remoting/<(RULE_INPUT_ROOT)',
459           ],
460           'action': [
461             'python', '<(remoting_localize_path)',
462             '--variables', '<(chrome_version_path)',
463             # |remoting_version_path| must be after |chrome_version_path|
464             # because it can contain overrides for the version numbers.
465             '--variables', '<(remoting_version_path)',
466             '--variables', '<(lastchange_path)',
467             '--locale_dir', '<(webapp_locale_dir)',
468             '--template', '<(RULE_INPUT_PATH)',
469             '--output', '<@(_outputs)',
470             '--encoding', 'utf-16',
471             '<@(remoting_locales)',
472           ],
473           'message': 'Localizing the version information'
474         },
475       ],
476     },  # end of target 'remoting_windows_resources'
477   ],  # end of 'targets'
479   'conditions': [
480     # The host installation is generated only if WiX is available. If
481     # component build is used the produced installation will not work due to
482     # missing DLLs. We build it anyway to make sure the GYP scripts are executed
483     # by the bots.
484     ['wix_exists == "True" and sas_dll_exists == "True"', {
485       'targets': [
486         {
487           'target_name': 'remoting_host_installation',
488           'type': 'none',
489           'dependencies': [
490             'remoting_me2me_host_archive',
491           ],
492           'sources': [
493             '<(PRODUCT_DIR)/remoting-me2me-host-<(OS).zip',
494           ],
495           'outputs': [
496             '<(PRODUCT_DIR)/chromoting.msi',
497           ],
498           'rules': [
499             {
500               'rule_name': 'zip2msi',
501               'extension': 'zip',
502               'inputs': [
503                 'tools/zip2msi.py',
504               ],
505               'outputs': [
506                 '<(PRODUCT_DIR)/chromoting.msi',
507               ],
508               'action': [
509                 'python', 'tools/zip2msi.py',
510                 '--wix_path', '<(wix_path)',
511                 '--intermediate_dir', '<(INTERMEDIATE_DIR)/installation',
512                 '--target_arch', '<(target_arch)',
513                 '<(RULE_INPUT_PATH)',
514                 '<@(_outputs)',
515               ],
516               'message': 'Generating <@(_outputs)',
517             },
518           ],
519         },  # end of target 'remoting_host_installation'
521         {
522           'target_name': 'remoting_me2me_host_archive',
523           'type': 'none',
524           'dependencies': [
525             '<(icu_gyp_path):icudata',
526             'remoting_core',
527             'remoting_desktop',
528             'remoting_it2me_native_messaging_host',
529             'remoting_me2me_host',
530             'remoting_me2me_native_messaging_host',
531             'remoting_native_messaging_manifests',
532           ],
533           'compiled_inputs': [
534             '<(PRODUCT_DIR)/remote_assistance_host.exe',
535             '<(PRODUCT_DIR)/remoting_core.dll',
536             '<(PRODUCT_DIR)/remoting_desktop.exe',
537             '<(PRODUCT_DIR)/remoting_host.exe',
538             '<(PRODUCT_DIR)/remoting_native_messaging_host.exe',
539           ],
540           'compiled_inputs_dst': [
541             'files/remote_assistance_host.exe',
542             'files/remoting_core.dll',
543             'files/remoting_desktop.exe',
544             'files/remoting_host.exe',
545             'files/remoting_native_messaging_host.exe',
546           ],
547           'conditions': [
548             ['buildtype == "Official"', {
549               'defs': [
550                 'OFFICIAL_BUILD=1',
551               ],
552             }, {  # else buildtype != "Official"
553               'defs': [
554                 'OFFICIAL_BUILD=0',
555               ],
556             }],
557           ],
558           'defs': [
559             'BRANDING=<(branding)',
560             'DAEMON_CONTROLLER_CLSID={<(daemon_controller_clsid)}',
561             'RDP_DESKTOP_SESSION_CLSID={<(rdp_desktop_session_clsid)}',
562             'VERSION=<(version_full)',
563           ],
564           'generated_files': [
565             '<@(_compiled_inputs)',
566             '<(sas_dll_path)/sas.dll',
567             '<(PRODUCT_DIR)/remoting/com.google.chrome.remote_assistance.json',
568             '<(PRODUCT_DIR)/remoting/com.google.chrome.remote_desktop.json',
569             'resources/chromoting.ico',
570             '<(PRODUCT_DIR)/icudtl.dat',
571           ],
572           'generated_files_dst': [
573             '<@(_compiled_inputs_dst)',
574             'files/sas.dll',
575             'files/com.google.chrome.remote_assistance.json',
576             'files/com.google.chrome.remote_desktop.json',
577             'files/chromoting.ico',
578             'files/icudtl.dat',
579           ],
580           'zip_path': '<(PRODUCT_DIR)/remoting-me2me-host-<(OS).zip',
581           'outputs': [
582             '<(_zip_path)',
583           ],
584           'actions': [
585             {
586               'action_name': 'Zip installer files for signing',
587               'temp_dir': '<(INTERMEDIATE_DIR)/installation',
588               'source_files': [
589                 '<@(remoting_host_installer_win_files)',
590               ],
591               'inputs': [
592                 '<@(_compiled_inputs)',
593                 '<(sas_dll_path)/sas.dll',
594                 '<@(_source_files)',
595                 'host/installer/build-installer-archive.py',
596                 'resources/chromoting.ico',
597               ],
598               'outputs': [
599                 '<(_zip_path)',
600               ],
601               'action': [
602                 'python', 'host/installer/build-installer-archive.py',
603                 '<(_temp_dir)',
604                 '<(_zip_path)',
605                 '--source-file-roots', '<@(remoting_host_installer_win_roots)',
606                 '--source-files', '<@(_source_files)',
607                 '--generated-files', '<@(_generated_files)',
608                 '--generated-files-dst', '<@(_generated_files_dst)',
609                 '--defs', '<@(_defs)',
610               ],
611             },
612           ],  # actions
613         }, # end of target 'remoting_me2me_host_archive'
614       ],  # end of 'targets'
615     }, {
616       # Dummy targets for when Wix is not available.
617       'targets': [
618         {
619           'target_name': 'remoting_host_installation',
620           'type': 'none',
621         },
623         {
624           'target_name': 'remoting_me2me_host_archive',
625           'type': 'none',
626         },
627       ],  # end of 'targets'
628     }],  # 'wix_exists == "True" and sas_dll_exists == "True"'
630   ],  # end of 'conditions'