Optimize CommandBufferHelper::GetSpace().
[chromium-blink-merge.git] / remoting / remoting_host_win.gypi
blob87b64a61cfdf6a64228b8501e51a262d7b432aba
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   },
16   'conditions': [
17     ['OS=="win"', {
18       'targets': [
19         {
20           'target_name': 'remoting_breakpad_tester',
21           'type': 'executable',
22           'variables': { 'enable_wexit_time_destructors': 1, },
23           'dependencies': [
24             '../base/base.gyp:base',
25             'remoting_host',
26           ],
27           'sources': [
28             'tools/breakpad_tester_win.cc',
29           ],
30         },  # end of target 'remoting_breakpad_tester'
31         {
32           'target_name': 'remoting_lib_idl',
33           'type': 'static_library',
34           'sources': [
35             'host/win/chromoting_lib_idl.templ',
36             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.h',
37             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.idl',
38             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib_i.c',
39           ],
40           # This target exports a hard dependency because dependent targets may
41           # include chromoting_lib.h, a generated header.
42           'hard_dependency': 1,
43           'msvs_settings': {
44             'VCMIDLTool': {
45               'OutputDirectory': '<(SHARED_INTERMEDIATE_DIR)/remoting/host',
46             },
47           },
48           'direct_dependent_settings': {
49             'include_dirs': [
50               '<(SHARED_INTERMEDIATE_DIR)',
51             ],
52           },
53           'rules': [
54             {
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         },  # end of target 'remoting_lib_ps'
94         # Regenerates 'chromoting_lib.rc' (used to embed 'chromoting_lib.tlb'
95         # into remoting_core.dll's resources) every time
96         # 'chromoting_lib_idl.templ' changes. Making remoting_core depend on
97         # both this and 'remoting_lib_idl' targets ensures that the resorces
98         # are rebuilt every time the type library is updated. GYP alone is
99         # not smart enough to figure out this dependency on its own.
100         {
101           'target_name': 'remoting_lib_rc',
102           'type': 'none',
103           'sources': [
104             'host/win/chromoting_lib_idl.templ',
105           ],
106           'hard_dependency': 1,
107           'direct_dependent_settings': {
108             'include_dirs': [
109               '<(SHARED_INTERMEDIATE_DIR)',
110             ],
111           },
112           'rules': [
113             {
114               'rule_name': 'generate_rc',
115               'extension': 'templ',
116               'outputs': [
117                 '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.rc',
118               ],
119               'action': [
120                 'echo 1 typelib "remoting/host/chromoting_lib.tlb" > <@(_outputs)',
121               ],
122               'message': 'Generating <@(_outputs)',
123             },
124           ],
125         },  # end of target 'remoting_lib_rc'
126         # The only difference between |remoting_console.exe| and
127         # |remoting_host.exe| is that the former is a console application.
128         # |remoting_console.exe| is used for debugging purposes.
129         {
130           'target_name': 'remoting_console',
131           'type': 'executable',
132           'variables': { 'enable_wexit_time_destructors': 1, },
133           'defines': [
134             'BINARY=BINARY_HOST_ME2ME',
135           ],
136           'dependencies': [
137             'remoting_core',
138             'remoting_windows_resources',
139           ],
140           'sources': [
141             '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
142             'host/win/entry_point.cc',
143           ],
144           'msvs_settings': {
145             'VCManifestTool': {
146               'AdditionalManifestFiles': [
147                 'host/win/dpi_aware.manifest',
148               ],
149             },
150             'VCLinkerTool': {
151               'EntryPointSymbol': 'HostEntryPoint',
152               'IgnoreAllDefaultLibraries': 'true',
153               'SubSystem': '1', # /SUBSYSTEM:CONSOLE
154             },
155           },
156         },  # end of target 'remoting_console'
157         {
158           'target_name': 'remoting_core',
159           'type': 'shared_library',
160           'variables': { 'enable_wexit_time_destructors': 1, },
161           'defines' : [
162             '_ATL_APARTMENT_THREADED',
163             '_ATL_CSTRING_EXPLICIT_CONSTRUCTORS',
164             '_ATL_NO_AUTOMATIC_NAMESPACE',
165             '_ATL_NO_EXCEPTIONS',
166             'BINARY=BINARY_CORE',
167             'DAEMON_CONTROLLER_CLSID="{<(daemon_controller_clsid)}"',
168             'RDP_DESKTOP_SESSION_CLSID="{<(rdp_desktop_session_clsid)}"',
169             'HOST_IMPLEMENTATION',
170             'ISOLATION_AWARE_ENABLED=1',
171             'STRICT',
172             'VERSION=<(version_full)',
173           ],
174           'dependencies': [
175             '../base/base.gyp:base',
176             '../base/base.gyp:base_static',
177             '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
178             '../ipc/ipc.gyp:ipc',
179             '../net/net.gyp:net',
180             '../third_party/webrtc/modules/modules.gyp:desktop_capture',
181             'remoting_base',
182             'remoting_breakpad',
183             'remoting_host',
184             'remoting_host_setup_base',
185             'remoting_lib_idl',
186             'remoting_lib_ps',
187             'remoting_lib_rc',
188             'remoting_me2me_host_static',
189             'remoting_native_messaging_base',
190             'remoting_protocol',
191             'remoting_windows_resources',
192           ],
193           'sources': [
194             '<(SHARED_INTERMEDIATE_DIR)/remoting/core.rc',
195             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/chromoting_lib.rc',
196             '<(SHARED_INTERMEDIATE_DIR)/remoting/host/remoting_host_messages.rc',
197             '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
198             'host/desktop_process_main.cc',
199             'host/host_main.cc',
200             'host/host_main.h',
201             'host/ipc_constants.cc',
202             'host/ipc_constants.h',
203             'host/remoting_me2me_host.cc',
204             'host/sas_injector.h',
205             'host/sas_injector_win.cc',
206             'host/setup/me2me_native_messaging_host_main.cc',
207             'host/verify_config_window_win.cc',
208             'host/verify_config_window_win.h',
209             'host/win/chromoting_module.cc',
210             'host/win/chromoting_module.h',
211             'host/win/core.cc',
212             'host/win/core_resource.h',
213             'host/win/elevated_controller.cc',
214             'host/win/elevated_controller.h',
215             'host/win/host_service.cc',
216             'host/win/host_service.h',
217             'host/win/omaha.cc',
218             'host/win/omaha.h',
219             'host/win/rdp_desktop_session.cc',
220             'host/win/rdp_desktop_session.h',
221             'host/win/unprivileged_process_delegate.cc',
222             'host/win/unprivileged_process_delegate.h',
223             'host/win/worker_process_launcher.cc',
224             'host/win/worker_process_launcher.h',
225             'host/win/wts_session_process_delegate.cc',
226             'host/win/wts_session_process_delegate.h',
227             'host/worker_process_ipc_delegate.h',
228           ],
229           'msvs_settings': {
230             'VCManifestTool': {
231               'EmbedManifest': 'true',
232               'AdditionalManifestFiles': [
233                 'host/win/common-controls.manifest',
234               ],
235             },
236             'VCLinkerTool': {
237               'AdditionalDependencies': [
238                 'comctl32.lib',
239                 'rpcns4.lib',
240                 'rpcrt4.lib',
241                 'uuid.lib',
242                 'wtsapi32.lib',
243               ],
244               'AdditionalOptions': [
245                 # Export the proxy/stub entry points. Note that the generated
246                 # routines have 'Ps' prefix to avoid conflicts with our own
247                 # DllMain().
248                 '/EXPORT:DllGetClassObject=PsDllGetClassObject,PRIVATE',
249                 '/EXPORT:DllCanUnloadNow=PsDllCanUnloadNow,PRIVATE',
250                 '/EXPORT:DllRegisterServer=PsDllRegisterServer,PRIVATE',
251                 '/EXPORT:DllUnregisterServer=PsDllUnregisterServer,PRIVATE',
252               ],
253             },
254           },
255         },  # end of target 'remoting_core'
256         {
257           'target_name': 'remoting_desktop',
258           'type': 'executable',
259           'variables': { 'enable_wexit_time_destructors': 1, },
260           'defines': [
261             'BINARY=BINARY_DESKTOP',
262           ],
263           'dependencies': [
264             'remoting_core',
265             'remoting_windows_resources',
266           ],
267           'sources': [
268             '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
269             'host/win/entry_point.cc',
270           ],
271           'msvs_settings': {
272             'VCManifestTool': {
273               'AdditionalManifestFiles': [
274                 'host/win/dpi_aware.manifest',
275               ],
276             },
277             'VCLinkerTool': {
278               'EnableUAC': 'true',
279               # Add 'level="requireAdministrator" uiAccess="true"' to
280               # the manifest only for the official builds because it requires
281               # the binary to be signed to work.
282               'conditions': [
283                 ['buildtype == "Official"', {
284                   'UACExecutionLevel': 2,
285                   'UACUIAccess': 'true',
286                 }],
287               ],
288               'EntryPointSymbol': 'HostEntryPoint',
289               'IgnoreAllDefaultLibraries': 'true',
290               'SubSystem': '2', # /SUBSYSTEM:WINDOWS
291             },
292           },
293         },  # end of target 'remoting_desktop'
294         {
295           'target_name': 'remoting_host_exe',
296           'product_name': 'remoting_host',
297           'type': 'executable',
298           'variables': { 'enable_wexit_time_destructors': 1, },
299           'defines': [
300             'BINARY=BINARY_HOST_ME2ME',
301           ],
302           'dependencies': [
303             'remoting_core',
304             'remoting_windows_resources',
305           ],
306           'sources': [
307             '<(SHARED_INTERMEDIATE_DIR)/remoting/version.rc',
308             'host/win/entry_point.cc',
309           ],
310           'msvs_settings': {
311             'VCManifestTool': {
312               'AdditionalManifestFiles': [
313                 'host/win/dpi_aware.manifest',
314               ],
315             },
316             'VCLinkerTool': {
317               'EntryPointSymbol': 'HostEntryPoint',
318               'IgnoreAllDefaultLibraries': 'true',
319               'ImportLibrary': '$(OutDir)\\lib\\remoting_host_exe.lib',
320               'OutputFile': '$(OutDir)\\remoting_host.exe',
321               'SubSystem': '2', # /SUBSYSTEM:WINDOWS
322             },
323           },
324         },  # end of target 'remoting_host_exe'
325         {
326           'target_name': 'remoting_host_messages',
327           'type': 'none',
328           'dependencies': [
329             'remoting_resources',
330           ],
331           'hard_dependency': 1,
332           'direct_dependent_settings': {
333             'include_dirs': [
334               '<(SHARED_INTERMEDIATE_DIR)',
335             ],
336           },
337           'sources': [
338             'host/win/host_messages.mc.jinja2'
339           ],
340           'rules': [
341             {
342               'rule_name': 'localize',
343               'extension': 'jinja2',
344               'outputs': [
345                 '<(SHARED_INTERMEDIATE_DIR)/remoting/host/remoting_host_messages.mc',
346               ],
347               'action': [
348                 'python', '<(remoting_localize_path)',
349                 '--locale_dir', '<(webapp_locale_dir)',
350                 '--template', '<(RULE_INPUT_PATH)',
351                 '--output', '<@(_outputs)',
352                 '--encoding', 'utf-16',
353                 '<@(remoting_locales)',
354               ],
355               'message': 'Localizing the event log messages'
356             },
357           ],
358         },  # end of target 'remoting_host_messages'
360         # Generates localized resources for the Windows binaries.
361         # The substitution strings are taken from:
362         #   - build/util/LASTCHANGE - the last source code revision. There is
363         #       no explicit dependency on this file to avoid rebuilding the host
364         #       after unrelated changes.
365         #   - chrome/VERSION - the major, build & patch versions.
366         #   - remoting/VERSION - the chromoting patch version (and overrides
367         #       for chrome/VERSION).
368         #   - translated webapp strings
369         {
370           'target_name': 'remoting_windows_resources',
371           'type': 'none',
372           'dependencies': [
373             'remoting_resources',
374           ],
375           'hard_dependency': 1,
376           'direct_dependent_settings': {
377             'include_dirs': [
378               '<(SHARED_INTERMEDIATE_DIR)',
379             ],
380           },
381           'sources': [
382             'host/win/core.rc.jinja2',
383             'host/win/version.rc.jinja2',
384           ],
385           'rules': [
386             {
387               'rule_name': 'version',
388               'extension': 'jinja2',
389               'variables': {
390                 'lastchange_path': '<(DEPTH)/build/util/LASTCHANGE',
391               },
392               'inputs': [
393                 '<(chrome_version_path)',
394                 '<(remoting_version_path)',
395                 '<(RULE_INPUT_PATH)',
396               ],
397               'outputs': [
398                 '<(SHARED_INTERMEDIATE_DIR)/remoting/<(RULE_INPUT_ROOT)',
399               ],
400               'action': [
401                 'python', '<(remoting_localize_path)',
402                 '--variables', '<(chrome_version_path)',
403                 # |remoting_version_path| must be after |chrome_version_path|
404                 # because it can contain overrides for the version numbers.
405                 '--variables', '<(remoting_version_path)',
406                 '--variables', '<(lastchange_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 version information'
414             },
415           ],
416         },  # end of target 'remoting_windows_resources'
417       ],  # end of 'targets'
418     }],  # 'OS=="win"'
420     # The host installation is generated only if WiX is available. If
421     # component build is used the produced installation will not work due to
422     # missing DLLs. We build it anyway to make sure the GYP scripts are executed
423     # by the bots.
424     ['OS == "win" and wix_exists == "True" and sas_dll_exists == "True"', {
425       'targets': [
426         {
427           'target_name': 'remoting_host_installation',
428           'type': 'none',
429           'dependencies': [
430             'remoting_me2me_host_archive',
431           ],
432           'sources': [
433             '<(PRODUCT_DIR)/remoting-me2me-host-<(OS).zip',
434           ],
435           'outputs': [
436             '<(PRODUCT_DIR)/chromoting.msi',
437           ],
438           'rules': [
439             {
440               'rule_name': 'zip2msi',
441               'extension': 'zip',
442               'inputs': [
443                 'tools/zip2msi.py',
444               ],
445               'outputs': [
446                 '<(PRODUCT_DIR)/chromoting.msi',
447               ],
448               'action': [
449                 'python', 'tools/zip2msi.py',
450                 '--wix_path', '<(wix_path)',
451                 '--intermediate_dir', '<(INTERMEDIATE_DIR)/installation',
452                 '<(RULE_INPUT_PATH)',
453                 '<@(_outputs)',
454               ],
455               'message': 'Generating <@(_outputs)',
456             },
457           ],
458         },  # end of target 'remoting_host_installation'
460         {
461           'target_name': 'remoting_me2me_host_archive',
462           'type': 'none',
463           'dependencies': [
464             '<(icu_gyp_path):icudata',
465             'remoting_core',
466             'remoting_desktop',
467             'remoting_host_exe',
468             'remoting_native_messaging_manifests',
469           ],
470           'compiled_inputs': [
471             '<(PRODUCT_DIR)/remoting_core.dll',
472             '<(PRODUCT_DIR)/remoting_desktop.exe',
473             '<(PRODUCT_DIR)/remoting_host.exe',
474           ],
475           'compiled_inputs_dst': [
476             'files/remoting_core.dll',
477             'files/remoting_desktop.exe',
478             'files/remoting_host.exe',
479           ],
480           'conditions': [
481             ['buildtype == "Official"', {
482               'defs': [
483                 'OFFICIAL_BUILD=1',
484               ],
485             }, {  # else buildtype != "Official"
486               'defs': [
487                 'OFFICIAL_BUILD=0',
488               ],
489             }],
490           ],
491           'defs': [
492             'BRANDING=<(branding)',
493             'DAEMON_CONTROLLER_CLSID={<(daemon_controller_clsid)}',
494             'RDP_DESKTOP_SESSION_CLSID={<(rdp_desktop_session_clsid)}',
495             'VERSION=<(version_full)',
496           ],
497           'generated_files': [
498             '<@(_compiled_inputs)',
499             '<(sas_dll_path)/sas.dll',
500             '<(PRODUCT_DIR)/remoting/com.google.chrome.remote_desktop.json',
501             'resources/chromoting.ico',
502             '<(PRODUCT_DIR)/icudtl.dat',
503           ],
504           'generated_files_dst': [
505             '<@(_compiled_inputs_dst)',
506             'files/sas.dll',
507             'files/com.google.chrome.remote_desktop.json',
508             'files/chromoting.ico',
509             'files/icudtl.dat',
510           ],
511           'zip_path': '<(PRODUCT_DIR)/remoting-me2me-host-<(OS).zip',
512           'outputs': [
513             '<(_zip_path)',
514           ],
515           'actions': [
516             {
517               'action_name': 'Zip installer files for signing',
518               'temp_dir': '<(INTERMEDIATE_DIR)/installation',
519               'source_files': [
520                 '<@(remoting_host_installer_win_files)',
521               ],
522               'inputs': [
523                 '<@(_compiled_inputs)',
524                 '<(sas_dll_path)/sas.dll',
525                 '<@(_source_files)',
526                 'host/installer/build-installer-archive.py',
527                 'resources/chromoting.ico',
528               ],
529               'outputs': [
530                 '<(_zip_path)',
531               ],
532               'action': [
533                 'python', 'host/installer/build-installer-archive.py',
534                 '<(_temp_dir)',
535                 '<(_zip_path)',
536                 '--source-file-roots', '<@(remoting_host_installer_win_roots)',
537                 '--source-files', '<@(_source_files)',
538                 '--generated-files', '<@(_generated_files)',
539                 '--generated-files-dst', '<@(_generated_files_dst)',
540                 '--defs', '<@(_defs)',
541               ],
542             },
543           ],  # actions
544         }, # end of target 'remoting_me2me_host_archive'
545       ],  # end of 'targets'
546     }],  # '<(wix_path) != ""'
548   ],  # end of 'conditions'