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