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