Infer appropriate GNU_STACK alignment for a shared library.
[chromium-blink-merge.git] / remoting / remoting_host_win.gypi
blob36fbcbe134f19df5ebd2666b4bf5611095a79637
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       'target_name': 'remoting_lib_idl',
31       'type': 'static_library',
32       'sources': [
33         'host/win/chromoting_lib_idl.templ',
34         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.h',
35         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.idl',
36         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib_i.c',
37       ],
38       # This target exports a hard dependency because dependent targets may
39       # include chromoting_lib.h, a generated header.
40       'hard_dependency': 1,
41       'msvs_settings': {
42         'VCMIDLTool': {
43           'OutputDirectory': '<(SHARED_INTERMEDIATE_DIR)/remoting/host',
44         },
45       },
46       'direct_dependent_settings': {
47         'include_dirs': [
48           '<(SHARED_INTERMEDIATE_DIR)',
49         ],
50       },
51       'rules': [
52         {
53           'rule_name': 'generate_idl',
54           'extension': 'templ',
55           'outputs': [
56             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.idl',
57           ],
58           'action': [
59             'python', '<(version_py_path)',
60             '-e', "DAEMON_CONTROLLER_CLSID='<(daemon_controller_clsid)'",
61             '-e', "RDP_DESKTOP_SESSION_CLSID='<(rdp_desktop_session_clsid)'",
62             '<(RULE_INPUT_PATH)',
63             '<@(_outputs)',
64           ],
65           'process_outputs_as_sources': 1,
66           'message': 'Generating <@(_outputs)',
67         },
68       ],
69     },  # end of target 'remoting_lib_idl'
71     # remoting_lib_ps builds the proxy/stub code generated by MIDL (see
72     # remoting_lib_idl).
73     {
74       'target_name': 'remoting_lib_ps',
75       'type': 'static_library',
76       'defines': [
77         # Prepend 'Ps' to the MIDL-generated routines. This includes
78         # DllGetClassObject, DllCanUnloadNow, DllRegisterServer,
79         # DllUnregisterServer, and DllMain.
80         'ENTRY_PREFIX=Ps',
81         'REGISTER_PROXY_DLL',
82       ],
83       'dependencies': [
84         'remoting_lib_idl',
85       ],
86       'sources': [
87         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.dlldata.c',
88         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib_p.c',
89       ],
90     },  # end of target 'remoting_lib_ps'
92     # Regenerates 'chromoting_lib.rc' (used to embed 'chromoting_lib.tlb'
93     # into remoting_core.dll's resources) every time
94     # 'chromoting_lib_idl.templ' changes. Making remoting_core depend on
95     # both this and 'remoting_lib_idl' targets ensures that the resorces
96     # are rebuilt every time the type library is updated. GYP alone is
97     # not smart enough to figure out this dependency on its own.
98     {
99       'target_name': 'remoting_lib_rc',
100       'type': 'none',
101       'sources': [
102         'host/win/chromoting_lib_idl.templ',
103       ],
104       'hard_dependency': 1,
105       'direct_dependent_settings': {
106         'include_dirs': [
107           '<(SHARED_INTERMEDIATE_DIR)',
108         ],
109       },
110       'rules': [
111         {
112           'rule_name': 'generate_rc',
113           'extension': 'templ',
114           'outputs': [
115             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.rc',
116           ],
117           'action': [
118             'echo 1 typelib "remoting/host/chromoting_lib.tlb" > <@(_outputs)',
119           ],
120           'message': 'Generating <@(_outputs)',
121         },
122       ],
123     },  # end of target 'remoting_lib_rc'
124     # The only difference between |remoting_console.exe| and
125     # |remoting_host.exe| is that the former is a console application.
126     # |remoting_console.exe| is used for debugging purposes.
127     {
128       'target_name': 'remoting_console',
129       'type': 'executable',
130       'variables': { 'enable_wexit_time_destructors': 1, },
131       'defines': [
132         'BINARY=BINARY_HOST_ME2ME',
133       ],
134       'dependencies': [
135         'remoting_core',
136         'remoting_windows_resources',
137       ],
138       'sources': [
139         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
140         'host/win/entry_point.cc',
141       ],
142       'msvs_settings': {
143         'VCManifestTool': {
144           'AdditionalManifestFiles': [
145             'host/win/dpi_aware.manifest',
146           ],
147         },
148         'VCLinkerTool': {
149           'EntryPointSymbol': 'HostEntryPoint',
150           'IgnoreAllDefaultLibraries': 'true',
151           'SubSystem': '1', # /SUBSYSTEM:CONSOLE
152         },
153       },
154     },  # end of target 'remoting_console'
155     {
156       'target_name': 'remoting_core',
157       'type': 'shared_library',
158       'variables': { 'enable_wexit_time_destructors': 1, },
159       'defines' : [
160         '_ATL_APARTMENT_THREADED',
161         '_ATL_CSTRING_EXPLICIT_CONSTRUCTORS',
162         '_ATL_NO_AUTOMATIC_NAMESPACE',
163         '_ATL_NO_EXCEPTIONS',
164         'BINARY=BINARY_CORE',
165         'DAEMON_CONTROLLER_CLSID="{<(daemon_controller_clsid)}"',
166         'RDP_DESKTOP_SESSION_CLSID="{<(rdp_desktop_session_clsid)}"',
167         'HOST_IMPLEMENTATION',
168         'ISOLATION_AWARE_ENABLED=1',
169         'STRICT',
170         'VERSION=<(version_full)',
171       ],
172       'dependencies': [
173         '../base/base.gyp:base',
174         '../base/base.gyp:base_static',
175         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
176         '../ipc/ipc.gyp:ipc',
177         '../net/net.gyp:net',
178         '../third_party/webrtc/modules/modules.gyp:desktop_capture',
179         'remoting_base',
180         'remoting_breakpad',
181         'remoting_host',
182         'remoting_host_setup_base',
183         'remoting_it2me_host_static',
184         'remoting_lib_idl',
185         'remoting_lib_ps',
186         'remoting_lib_rc',
187         'remoting_me2me_host_static',
188         'remoting_native_messaging_base',
189         'remoting_protocol',
190         'remoting_windows_resources',
191       ],
192       'sources': [
193         '<(SHARED_INTERMEDIATE_DIR)/remoting/core.rc',
194         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.rc',
195         '<(SHARED_INTERMEDIATE_DIR)/remoting/host/remoting_host_messages.rc',
196         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
197         'host/desktop_process_main.cc',
198         'host/host_main.cc',
199         'host/host_main.h',
200         'host/it2me/it2me_native_messaging_host_main.cc',
201         'host/it2me/it2me_native_messaging_host_main.h',
202         'host/setup/me2me_native_messaging_host_main.cc',
203         'host/setup/me2me_native_messaging_host_main.h',
204         'host/verify_config_window_win.cc',
205         'host/verify_config_window_win.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       'target_name': 'remoting_host_messages',
387       'type': 'none',
388       'dependencies': [
389         'remoting_resources',
390       ],
391       'hard_dependency': 1,
392       'direct_dependent_settings': {
393         'include_dirs': [
394           '<(SHARED_INTERMEDIATE_DIR)',
395         ],
396       },
397       'sources': [
398         'host/win/host_messages.mc.jinja2'
399       ],
400       'rules': [
401         {
402           'rule_name': 'localize',
403           'extension': 'jinja2',
404           'outputs': [
405             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/remoting_host_messages.mc',
406           ],
407           'action': [
408             'python', '<(remoting_localize_path)',
409             '--locale_dir', '<(webapp_locale_dir)',
410             '--template', '<(RULE_INPUT_PATH)',
411             '--output', '<@(_outputs)',
412             '--encoding', 'utf-16',
413             '<@(remoting_locales)',
414           ],
415           'message': 'Localizing the event log messages'
416         },
417       ],
418     },  # end of target 'remoting_host_messages'
420     # Generates localized resources for the Windows binaries.
421     # The substitution strings are taken from:
422     #   - build/util/LASTCHANGE - the last source code revision. There is
423     #       no explicit dependency on this file to avoid rebuilding the host
424     #       after unrelated changes.
425     #   - chrome/VERSION - the major, build & patch versions.
426     #   - remoting/VERSION - the chromoting patch version (and overrides
427     #       for chrome/VERSION).
428     #   - translated webapp strings
429     {
430       'target_name': 'remoting_windows_resources',
431       'type': 'none',
432       'dependencies': [
433         'remoting_resources',
434       ],
435       'hard_dependency': 1,
436       'direct_dependent_settings': {
437         'include_dirs': [
438           '<(SHARED_INTERMEDIATE_DIR)',
439         ],
440       },
441       'sources': [
442         'host/win/core.rc.jinja2',
443         'host/win/version.rc.jinja2',
444       ],
445       'rules': [
446         {
447           'rule_name': 'version',
448           'extension': 'jinja2',
449           'variables': {
450             'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
451           },
452           'inputs': [
453             '<(chrome_version_path)',
454             '<(remoting_version_path)',
455           ],
456           'outputs': [
457             '<(SHARED_INTERMEDIATE_DIR)/remoting/<(RULE_INPUT_ROOT)',
458           ],
459           'action': [
460             'python', '<(remoting_localize_path)',
461             '--variables', '<(chrome_version_path)',
462             # |remoting_version_path| must be after |chrome_version_path|
463             # because it can contain overrides for the version numbers.
464             '--variables', '<(remoting_version_path)',
465             '--variables', '<(lastchange_path)',
466             '--locale_dir', '<(webapp_locale_dir)',
467             '--template', '<(RULE_INPUT_PATH)',
468             '--output', '<@(_outputs)',
469             '--encoding', 'utf-16',
470             '<@(remoting_locales)',
471           ],
472           'message': 'Localizing the version information'
473         },
474       ],
475     },  # end of target 'remoting_windows_resources'
476   ],  # end of 'targets'
478   'conditions': [
479     # The host installation is generated only if WiX is available. If
480     # component build is used the produced installation will not work due to
481     # missing DLLs. We build it anyway to make sure the GYP scripts are executed
482     # by the bots.
483     ['wix_exists == "True" and sas_dll_exists == "True"', {
484       'targets': [
485         {
486           'target_name': 'remoting_host_installation',
487           'type': 'none',
488           'dependencies': [
489             'remoting_me2me_host_archive',
490           ],
491           'sources': [
492             '<(PRODUCT_DIR)/remoting-me2me-host-<(OS).zip',
493           ],
494           'outputs': [
495             '<(PRODUCT_DIR)/chromoting.msi',
496           ],
497           'rules': [
498             {
499               'rule_name': 'zip2msi',
500               'extension': 'zip',
501               'inputs': [
502                 'tools/zip2msi.py',
503               ],
504               'outputs': [
505                 '<(PRODUCT_DIR)/chromoting.msi',
506               ],
507               'action': [
508                 'python', 'tools/zip2msi.py',
509                 '--wix_path', '<(wix_path)',
510                 '--intermediate_dir', '<(INTERMEDIATE_DIR)/installation',
511                 '--target_arch', '<(target_arch)',
512                 '<(RULE_INPUT_PATH)',
513                 '<@(_outputs)',
514               ],
515               'message': 'Generating <@(_outputs)',
516             },
517           ],
518         },  # end of target 'remoting_host_installation'
520         {
521           'target_name': 'remoting_me2me_host_archive',
522           'type': 'none',
523           'dependencies': [
524             '<(icu_gyp_path):icudata',
525             'remoting_core',
526             'remoting_desktop',
527             'remoting_it2me_native_messaging_host',
528             'remoting_me2me_host',
529             'remoting_me2me_native_messaging_host',
530             'remoting_native_messaging_manifests',
531           ],
532           'compiled_inputs': [
533             '<(PRODUCT_DIR)/remote_assistance_host.exe',
534             '<(PRODUCT_DIR)/remoting_core.dll',
535             '<(PRODUCT_DIR)/remoting_desktop.exe',
536             '<(PRODUCT_DIR)/remoting_host.exe',
537             '<(PRODUCT_DIR)/remoting_native_messaging_host.exe',
538           ],
539           'compiled_inputs_dst': [
540             'files/remote_assistance_host.exe',
541             'files/remoting_core.dll',
542             'files/remoting_desktop.exe',
543             'files/remoting_host.exe',
544             'files/remoting_native_messaging_host.exe',
545           ],
546           'conditions': [
547             ['buildtype == "Official"', {
548               'defs': [
549                 'OFFICIAL_BUILD=1',
550               ],
551             }, {  # else buildtype != "Official"
552               'defs': [
553                 'OFFICIAL_BUILD=0',
554               ],
555             }],
556           ],
557           'defs': [
558             'BRANDING=<(branding)',
559             'DAEMON_CONTROLLER_CLSID={<(daemon_controller_clsid)}',
560             'RDP_DESKTOP_SESSION_CLSID={<(rdp_desktop_session_clsid)}',
561             'VERSION=<(version_full)',
562           ],
563           'generated_files': [
564             '<@(_compiled_inputs)',
565             '<(sas_dll_path)/sas.dll',
566             '<(PRODUCT_DIR)/remoting/com.google.chrome.remote_assistance.json',
567             '<(PRODUCT_DIR)/remoting/com.google.chrome.remote_desktop.json',
568             'resources/chromoting.ico',
569             '<(PRODUCT_DIR)/icudtl.dat',
570           ],
571           'generated_files_dst': [
572             '<@(_compiled_inputs_dst)',
573             'files/sas.dll',
574             'files/com.google.chrome.remote_assistance.json',
575             'files/com.google.chrome.remote_desktop.json',
576             'files/chromoting.ico',
577             'files/icudtl.dat',
578           ],
579           'zip_path': '<(PRODUCT_DIR)/remoting-me2me-host-<(OS).zip',
580           'outputs': [
581             '<(_zip_path)',
582           ],
583           'actions': [
584             {
585               'action_name': 'Zip installer files for signing',
586               'temp_dir': '<(INTERMEDIATE_DIR)/installation',
587               'source_files': [
588                 '<@(remoting_host_installer_win_files)',
589               ],
590               'inputs': [
591                 '<@(_compiled_inputs)',
592                 '<(sas_dll_path)/sas.dll',
593                 '<@(_source_files)',
594                 'host/installer/build-installer-archive.py',
595                 'resources/chromoting.ico',
596               ],
597               'outputs': [
598                 '<(_zip_path)',
599               ],
600               'action': [
601                 'python', 'host/installer/build-installer-archive.py',
602                 '<(_temp_dir)',
603                 '<(_zip_path)',
604                 '--source-file-roots', '<@(remoting_host_installer_win_roots)',
605                 '--source-files', '<@(_source_files)',
606                 '--generated-files', '<@(_generated_files)',
607                 '--generated-files-dst', '<@(_generated_files_dst)',
608                 '--defs', '<@(_defs)',
609               ],
610             },
611           ],  # actions
612         }, # end of target 'remoting_me2me_host_archive'
613       ],  # end of 'targets'
614     }, {
615       # Dummy targets for when Wix is not available.
616       'targets': [
617         {
618           'target_name': 'remoting_host_installation',
619           'type': 'none',
620         },
622         {
623           'target_name': 'remoting_me2me_host_archive',
624           'type': 'none',
625         },
626       ],  # end of 'targets'
627     }],  # 'wix_exists == "True" and sas_dll_exists == "True"'
629   ],  # end of 'conditions'