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