scheduler: Implement task observers
[chromium-blink-merge.git] / remoting / remoting_host_win.gypi
blob54074d16dd7678fb4abe3ef927155a1646589363
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/win/chromoting_module.cc',
205         'host/win/chromoting_module.h',
206         'host/win/core.cc',
207         'host/win/core_resource.h',
208         'host/win/host_service.cc',
209         'host/win/host_service.h',
210         'host/win/omaha.cc',
211         'host/win/omaha.h',
212         'host/win/rdp_desktop_session.cc',
213         'host/win/rdp_desktop_session.h',
214         'host/win/unprivileged_process_delegate.cc',
215         'host/win/unprivileged_process_delegate.h',
216         'host/win/worker_process_launcher.cc',
217         'host/win/worker_process_launcher.h',
218         'host/win/wts_session_process_delegate.cc',
219         'host/win/wts_session_process_delegate.h',
220         'host/worker_process_ipc_delegate.h',
221       ],
222       'msvs_settings': {
223         'VCManifestTool': {
224           'EmbedManifest': 'true',
225           'AdditionalManifestFiles': [
226             'host/win/common-controls.manifest',
227           ],
228         },
229         'VCLinkerTool': {
230           'AdditionalDependencies': [
231             'comctl32.lib',
232             'rpcns4.lib',
233             'rpcrt4.lib',
234             'uuid.lib',
235             'wtsapi32.lib',
236           ],
237           'AdditionalOptions': [
238             # Export the proxy/stub entry points. Note that the generated
239             # routines have 'Ps' prefix to avoid conflicts with our own
240             # DllMain().
241             '/EXPORT:DllGetClassObject=PsDllGetClassObject,PRIVATE',
242             '/EXPORT:DllCanUnloadNow=PsDllCanUnloadNow,PRIVATE',
243             '/EXPORT:DllRegisterServer=PsDllRegisterServer,PRIVATE',
244             '/EXPORT:DllUnregisterServer=PsDllUnregisterServer,PRIVATE',
245           ],
246         },
247         'conditions': [
248           ['clang==1', {
249             # atlapp.h contains a global "using namespace WTL;".
250             # TODO: Remove once remoting/host/verify_config_window_win.h no
251             # longer depends on atlapp.h, http://crbug.com/5027
252             'VCCLCompilerTool': {
253               'AdditionalOptions': ['-Wno-header-hygiene'],
254             },
255           }],
256         ],
257       },
258     },  # end of target 'remoting_core'
259     {
260       'target_name': 'remoting_desktop',
261       'type': 'executable',
262       'variables': { 'enable_wexit_time_destructors': 1, },
263       'defines': [
264         'BINARY=BINARY_DESKTOP',
265       ],
266       'dependencies': [
267         'remoting_core',
268         'remoting_windows_resources',
269       ],
270       'sources': [
271         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
272         'host/win/entry_point.cc',
273       ],
274       'msvs_settings': {
275         'VCManifestTool': {
276           'AdditionalManifestFiles': [
277             'host/win/dpi_aware.manifest',
278           ],
279         },
280         'VCLinkerTool': {
281           'EnableUAC': 'true',
282           # Add 'level="requireAdministrator" uiAccess="true"' to
283           # the manifest only for the official builds because it requires
284           # the binary to be signed to work.
285           'conditions': [
286             ['buildtype == "Official"', {
287               'UACExecutionLevel': 2,
288               'UACUIAccess': 'true',
289             }],
290           ],
291           'EntryPointSymbol': 'HostEntryPoint',
292           'IgnoreAllDefaultLibraries': 'true',
293           'SubSystem': '2', # /SUBSYSTEM:WINDOWS
294         },
295       },
296     },  # end of target 'remoting_desktop'
297     {
298       'target_name': 'remoting_me2me_host',
299       'product_name': 'remoting_host',
300       'type': 'executable',
301       'variables': { 'enable_wexit_time_destructors': 1, },
302       'defines': [
303         'BINARY=BINARY_HOST_ME2ME',
304       ],
305       'dependencies': [
306         'remoting_core',
307         'remoting_windows_resources',
308       ],
309       'sources': [
310         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
311         'host/win/entry_point.cc',
312       ],
313       'msvs_settings': {
314         'VCManifestTool': {
315           'AdditionalManifestFiles': [
316             'host/win/dpi_aware.manifest',
317           ],
318         },
319         'VCLinkerTool': {
320           'EntryPointSymbol': 'HostEntryPoint',
321           'IgnoreAllDefaultLibraries': 'true',
322           'OutputFile': '$(OutDir)\\remoting_host.exe',
323           'SubSystem': '2', # /SUBSYSTEM:WINDOWS
324         },
325       },
326     },  # end of target 'remoting_me2me_host'
327     {
328       'target_name': 'remoting_me2me_native_messaging_host',
329       'type': 'executable',
330       'product_name': 'remoting_native_messaging_host',
331       'variables': { 'enable_wexit_time_destructors': 1, },
332       'defines' : [
333         'BINARY=BINARY_NATIVE_MESSAGING_HOST',
334       ],
335       'dependencies': [
336         'remoting_core',
337         'remoting_windows_resources',
338       ],
339       'sources': [
340         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
341         'host/setup/me2me_native_messaging_host_entry_point.cc',
342       ],
343       'msvs_settings': {
344         'VCLinkerTool': {
345           'IgnoreAllDefaultLibraries': 'true',
346           'SubSystem': '1', # /SUBSYSTEM:CONSOLE
347         },
348       },
349     },  # end of target 'remoting_me2me_native_messaging_host'
350     {
351       'target_name': 'remoting_it2me_native_messaging_host',
352       'type': 'executable',
353       'product_name': 'remote_assistance_host',
354       'variables': { 'enable_wexit_time_destructors': 1, },
355       'dependencies': [
356         'remoting_core',
357         'remoting_windows_resources',
358       ],
359       'sources': [
360         '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
361         'host/it2me/it2me_native_messaging_host_entry_point.cc',
362       ],
363       'defines' : [
364         'BINARY=BINARY_REMOTE_ASSISTANCE_HOST',
365       ],
366       'msvs_settings': {
367         'VCManifestTool': {
368           'EmbedManifest': 'true',
369           'AdditionalManifestFiles': [
370             'host/win/common-controls.manifest',
371             'host/win/dpi_aware.manifest',
372           ],
373         },
374         'VCLinkerTool': {
375           'IgnoreAllDefaultLibraries': 'true',
376           'SubSystem': '1', # /SUBSYSTEM:CONSOLE
377           'AdditionalDependencies': [
378             'comctl32.lib',
379           ],
380         },
381       },
382     },  # end of target 'remoting_it2me_native_messaging_host'
383     {
384       'target_name': 'remoting_host_messages',
385       'type': 'none',
386       'dependencies': [
387         'remoting_resources',
388       ],
389       'hard_dependency': 1,
390       'direct_dependent_settings': {
391         'include_dirs': [
392           '<(SHARED_INTERMEDIATE_DIR)',
393         ],
394       },
395       'sources': [
396         'host/win/host_messages.mc.jinja2'
397       ],
398       'rules': [
399         {
400           'rule_name': 'localize',
401           'extension': 'jinja2',
402           'outputs': [
403             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/remoting_host_messages.mc',
404           ],
405           'action': [
406             'python', '<(remoting_localize_path)',
407             '--locale_dir', '<(webapp_locale_dir)',
408             '--template', '<(RULE_INPUT_PATH)',
409             '--output', '<@(_outputs)',
410             '--encoding', 'utf-16',
411             '<@(remoting_locales)',
412           ],
413           'message': 'Localizing the event log messages'
414         },
415       ],
416     },  # end of target 'remoting_host_messages'
418     # Generates localized resources for the Windows binaries.
419     # The substitution strings are taken from:
420     #   - build/util/LASTCHANGE - the last source code revision. There is
421     #       no explicit dependency on this file to avoid rebuilding the host
422     #       after unrelated changes.
423     #   - chrome/VERSION - the major, build & patch versions.
424     #   - remoting/VERSION - the chromoting patch version (and overrides
425     #       for chrome/VERSION).
426     #   - translated webapp strings
427     {
428       'target_name': 'remoting_windows_resources',
429       'type': 'none',
430       'dependencies': [
431         'remoting_resources',
432       ],
433       'hard_dependency': 1,
434       'direct_dependent_settings': {
435         'include_dirs': [
436           '<(SHARED_INTERMEDIATE_DIR)',
437         ],
438       },
439       'sources': [
440         'host/win/core.rc.jinja2',
441         'host/win/version.rc.jinja2',
442       ],
443       'rules': [
444         {
445           'rule_name': 'version',
446           'extension': 'jinja2',
447           'variables': {
448             'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
449           },
450           'inputs': [
451             '<(chrome_version_path)',
452             '<(remoting_version_path)',
453           ],
454           'outputs': [
455             '<(SHARED_INTERMEDIATE_DIR)/remoting/<(RULE_INPUT_ROOT)',
456           ],
457           'action': [
458             'python', '<(remoting_localize_path)',
459             '--variables', '<(chrome_version_path)',
460             # |remoting_version_path| must be after |chrome_version_path|
461             # because it can contain overrides for the version numbers.
462             '--variables', '<(remoting_version_path)',
463             '--variables', '<(lastchange_path)',
464             '--locale_dir', '<(webapp_locale_dir)',
465             '--template', '<(RULE_INPUT_PATH)',
466             '--output', '<@(_outputs)',
467             '--encoding', 'utf-16',
468             '<@(remoting_locales)',
469           ],
470           'message': 'Localizing the version information'
471         },
472       ],
473     },  # end of target 'remoting_windows_resources'
474   ],  # end of 'targets'
476   'conditions': [
477     # The host installation is generated only if WiX is available. If
478     # component build is used the produced installation will not work due to
479     # missing DLLs. We build it anyway to make sure the GYP scripts are executed
480     # by the bots.
481     ['wix_exists == "True" and sas_dll_exists == "True"', {
482       'targets': [
483         {
484           'target_name': 'remoting_host_installation',
485           'type': 'none',
486           'dependencies': [
487             'remoting_me2me_host_archive',
488           ],
489           'sources': [
490             '<(PRODUCT_DIR)/remoting-me2me-host-<(OS).zip',
491           ],
492           'outputs': [
493             '<(PRODUCT_DIR)/chromoting.msi',
494           ],
495           'rules': [
496             {
497               'rule_name': 'zip2msi',
498               'extension': 'zip',
499               'inputs': [
500                 'tools/zip2msi.py',
501               ],
502               'outputs': [
503                 '<(PRODUCT_DIR)/chromoting.msi',
504               ],
505               'action': [
506                 'python', 'tools/zip2msi.py',
507                 '--wix_path', '<(wix_path)',
508                 '--intermediate_dir', '<(INTERMEDIATE_DIR)/installation',
509                 '--target_arch', '<(target_arch)',
510                 '<(RULE_INPUT_PATH)',
511                 '<@(_outputs)',
512               ],
513               'message': 'Generating <@(_outputs)',
514             },
515           ],
516         },  # end of target 'remoting_host_installation'
518         {
519           'target_name': 'remoting_me2me_host_archive',
520           'type': 'none',
521           'dependencies': [
522             '<(icu_gyp_path):icudata',
523             'remoting_core',
524             'remoting_desktop',
525             'remoting_it2me_native_messaging_host',
526             'remoting_me2me_host',
527             'remoting_me2me_native_messaging_host',
528             'remoting_native_messaging_manifests',
529           ],
530           'compiled_inputs': [
531             '<(PRODUCT_DIR)/remote_assistance_host.exe',
532             '<(PRODUCT_DIR)/remoting_core.dll',
533             '<(PRODUCT_DIR)/remoting_desktop.exe',
534             '<(PRODUCT_DIR)/remoting_host.exe',
535             '<(PRODUCT_DIR)/remoting_native_messaging_host.exe',
536           ],
537           'compiled_inputs_dst': [
538             'files/remote_assistance_host.exe',
539             'files/remoting_core.dll',
540             'files/remoting_desktop.exe',
541             'files/remoting_host.exe',
542             'files/remoting_native_messaging_host.exe',
543           ],
544           'conditions': [
545             ['buildtype == "Official"', {
546               'defs': [
547                 'OFFICIAL_BUILD=1',
548               ],
549             }, {  # else buildtype != "Official"
550               'defs': [
551                 'OFFICIAL_BUILD=0',
552               ],
553             }],
554           ],
555           'defs': [
556             'BRANDING=<(branding)',
557             'DAEMON_CONTROLLER_CLSID={<(daemon_controller_clsid)}',
558             'RDP_DESKTOP_SESSION_CLSID={<(rdp_desktop_session_clsid)}',
559             'VERSION=<(version_full)',
560           ],
561           'generated_files': [
562             '<@(_compiled_inputs)',
563             '<(sas_dll_path)/sas.dll',
564             '<(PRODUCT_DIR)/remoting/com.google.chrome.remote_assistance.json',
565             '<(PRODUCT_DIR)/remoting/com.google.chrome.remote_desktop.json',
566             'resources/chromoting.ico',
567             '<(PRODUCT_DIR)/icudtl.dat',
568           ],
569           'generated_files_dst': [
570             '<@(_compiled_inputs_dst)',
571             'files/sas.dll',
572             'files/com.google.chrome.remote_assistance.json',
573             'files/com.google.chrome.remote_desktop.json',
574             'files/chromoting.ico',
575             'files/icudtl.dat',
576           ],
577           'zip_path': '<(PRODUCT_DIR)/remoting-me2me-host-<(OS).zip',
578           'outputs': [
579             '<(_zip_path)',
580           ],
581           'actions': [
582             {
583               'action_name': 'Zip installer files for signing',
584               'temp_dir': '<(INTERMEDIATE_DIR)/installation',
585               'source_files': [
586                 '<@(remoting_host_installer_win_files)',
587               ],
588               'inputs': [
589                 '<@(_compiled_inputs)',
590                 '<(sas_dll_path)/sas.dll',
591                 '<@(_source_files)',
592                 'host/installer/build-installer-archive.py',
593                 'resources/chromoting.ico',
594               ],
595               'outputs': [
596                 '<(_zip_path)',
597               ],
598               'action': [
599                 'python', 'host/installer/build-installer-archive.py',
600                 '<(_temp_dir)',
601                 '<(_zip_path)',
602                 '--source-file-roots', '<@(remoting_host_installer_win_roots)',
603                 '--source-files', '<@(_source_files)',
604                 '--generated-files', '<@(_generated_files)',
605                 '--generated-files-dst', '<@(_generated_files_dst)',
606                 '--defs', '<@(_defs)',
607               ],
608             },
609           ],  # actions
610         }, # end of target 'remoting_me2me_host_archive'
611       ],  # end of 'targets'
612     }, {
613       # Dummy targets for when Wix is not available.
614       'targets': [
615         {
616           'target_name': 'remoting_host_installation',
617           'type': 'none',
618         },
620         {
621           'target_name': 'remoting_me2me_host_archive',
622           'type': 'none',
623         },
624       ],  # end of 'targets'
625     }],  # 'wix_exists == "True" and sas_dll_exists == "True"'
627   ],  # end of 'conditions'