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