Roll WebRTC 9013:9030, Libjingle 9009:9029
[chromium-blink-merge.git] / chromecast / chromecast.gyp
blobfbc60676355bc95e178163bc61f05daeb8413179
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     'android_support_v13_target%':
8         '../third_party/android_tools/android_tools.gyp:android_support_v13_javalib',
9     'cast_build_release': 'internal/build/cast_build_release',
10     'cast_is_debug_build%': 0,
11     # Refers to enum CastProductType in components/metrics/proto/cast_logs.proto
12     'cast_product_type%': 0,  # CAST_PRODUCT_TYPE_UNKNOWN
13     'chromium_code': 1,
14     'chromecast_branding%': 'Chromium',
15     'disable_display%': 0,
16     'enable_default_cast_graphics%': 1,
17     'ozone_platform_cast%': 0,
18     'use_chromecast_webui%': 0,
19   },
20   'includes': [
21     'chromecast_tests.gypi',
22   ],
23   'target_defaults': {
24     'include_dirs': [
25       '..',  # Root of Chromium checkout
26     ],
27     'conditions': [
28       ['disable_display==1', {
29         'defines': ['DISABLE_DISPLAY'],
30       }],
31     ],
32   },
33   'targets': [
34     # Public API target for OEM partners to replace shlibs.
35     {
36       'target_name': 'cast_public_api',
37       'type': '<(component)',
38       'sources': [
39         'public/cast_egl_platform.h',
40         'public/cast_egl_platform_shlib.h',
41         'public/chromecast_export.h',
42         'public/graphics_properties_shlib.h'
43       ],
44     },
45     # TODO(gunsch): Remove this fake target once it's either added or no
46     # longer referenced from internal code.
47     {'target_name': 'cast_media_audio', 'type': 'none'},
49     {
50       'target_name': 'cast_base',
51       'type': '<(component)',
52       'dependencies': [
53         '../base/base.gyp:base',
54       ],
55       'sources': [
56         'base/cast_paths.cc',
57         'base/cast_paths.h',
58         'base/metrics/cast_histograms.h',
59         'base/metrics/cast_metrics_helper.cc',
60         'base/metrics/cast_metrics_helper.h',
61         'base/metrics/grouped_histogram.cc',
62         'base/metrics/grouped_histogram.h'
63       ],
64     },  # end of target 'cast_base'
65     {
66       'target_name': 'cast_crash_client',
67       'type': '<(component)',
68       'dependencies': [
69         '../breakpad/breakpad.gyp:breakpad_client',
70         '../components/components.gyp:crash_component',
71       ],
72       'sources': [
73         'crash/cast_crash_keys.cc',
74         'crash/cast_crash_keys.h',
75         'crash/cast_crash_reporter_client.cc',
76         'crash/cast_crash_reporter_client.h',
77       ],
78       'conditions': [
79         ['chromecast_branding=="Chrome"', {
80           'dependencies': [
81             'internal/chromecast_internal.gyp:crash_internal',
82           ],
83         }, {
84           'sources': [
85             'crash/cast_crash_reporter_client_simple.cc',
86           ],
87         }],
88       ]
89     },  # end of target 'cast_crash_client'
90     {
91       'target_name': 'cast_net',
92       'type': '<(component)',
93       'sources': [
94         'net/connectivity_checker.cc',
95         'net/connectivity_checker.h',
96         'net/net_switches.cc',
97         'net/net_switches.h',
98       ],
99     },
100     {
101       'target_name': 'cast_shell_resources',
102       'type': 'none',
103       'variables': {
104         'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chromecast',
105       },
106       'actions': [
107         {
108           'action_name': 'cast_shell_resources',
109           'variables': {
110             'grit_grd_file': 'app/resources/shell_resources.grd',
111             'grit_resource_ids': 'app/resources/resource_ids',
112           },
113           'includes': [ '../build/grit_action.gypi' ],
114         },
115       ],
116       'includes': [ '../build/grit_target.gypi' ],
117     },
118     {
119       'target_name': 'cast_shell_pak',
120       'type': 'none',
121       'dependencies': [
122         'cast_shell_resources',
123         '../content/app/resources/content_resources.gyp:content_resources',
124         '../content/app/strings/content_strings.gyp:content_strings',
125         '../net/net.gyp:net_resources',
126         '../third_party/WebKit/public/blink_resources.gyp:blink_resources',
127         '../ui/resources/ui_resources.gyp:ui_resources',
128         '../ui/strings/ui_strings.gyp:ui_strings',
129       ],
130       'actions': [
131         {
132           'action_name': 'repack_cast_shell_pak',
133           'variables': {
134             'pak_inputs': [
135               '<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_resources.pak',
136               '<(SHARED_INTERMEDIATE_DIR)/blink/public/resources/blink_image_resources_100_percent.pak',
137               '<(SHARED_INTERMEDIATE_DIR)/chromecast/shell_resources.pak',
138               '<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak',
139               '<(SHARED_INTERMEDIATE_DIR)/content/app/resources/content_resources_100_percent.pak',
140               '<(SHARED_INTERMEDIATE_DIR)/content/app/strings/content_strings_en-US.pak',
141               '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
142               '<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_resources_100_percent.pak',
143               '<(SHARED_INTERMEDIATE_DIR)/ui/resources/webui_resources.pak',
144               '<(SHARED_INTERMEDIATE_DIR)/ui/strings/app_locale_settings_en-US.pak',
145               '<(SHARED_INTERMEDIATE_DIR)/ui/strings/ui_strings_en-US.pak',
146             ],
147             'conditions': [
148               ['chromecast_branding=="Chrome" and use_chromecast_webui==1', {
149                 'pak_inputs': [
150                   '<(SHARED_INTERMEDIATE_DIR)/chromecast/app_resources.pak',
151                   '<(SHARED_INTERMEDIATE_DIR)/chromecast/cast_webui_resources.pak',
152                 ],
153               }],
154             ],
155             'pak_output': '<(PRODUCT_DIR)/assets/cast_shell.pak',
156           },
157           'includes': [ '../build/repack_action.gypi' ],
158         },
159       ],
160       'conditions': [
161         ['chromecast_branding=="Chrome" and use_chromecast_webui==1', {
162           'dependencies': [
163             'internal/chromecast_resources.gyp:chromecast_app_resources',
164             'internal/chromecast_resources.gyp:chromecast_webui_resources',
165           ],
166         }],
167       ],
168     },  # end of target 'cast_shell_pak'
169     # This target contains all content-embedder implementation that is
170     # non-platform-specific.
171     {
172       'target_name': 'cast_shell_common',
173       'type': '<(component)',
174       'dependencies': [
175         'cast_base',
176         'cast_crash_client',
177         'cast_net',
178         'cast_shell_pak',
179         'cast_shell_resources',
180         'cast_version_header',
181         'chromecast_locales.gyp:chromecast_locales_pak',
182         'chromecast_locales.gyp:chromecast_settings',
183         'media/media.gyp:media_base',
184         '../base/base.gyp:base',
185         '../components/components.gyp:breakpad_host',
186         '../components/components.gyp:cdm_renderer',
187         '../components/components.gyp:component_metrics_proto',
188         '../components/components.gyp:crash_component',
189         '../components/components.gyp:network_hints_browser',
190         '../components/components.gyp:network_hints_renderer',
191         '../components/components.gyp:metrics',
192         '../components/components.gyp:metrics_gpu',
193         '../components/components.gyp:metrics_net',
194         '../components/components.gyp:metrics_profiler',
195         '../content/content.gyp:content',
196         '../content/content.gyp:content_app_both',
197         '../skia/skia.gyp:skia',
198         '../third_party/WebKit/public/blink.gyp:blink',
199         '../third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h',
200       ],
201       'sources': [
202         'app/cast_main_delegate.cc',
203         'app/cast_main_delegate.h',
204         'browser/cast_browser_context.cc',
205         'browser/cast_browser_context.h',
206         'browser/cast_browser_main_parts.cc',
207         'browser/cast_browser_main_parts.h',
208         'browser/cast_browser_process.cc',
209         'browser/cast_browser_process.h',
210         'browser/cast_content_browser_client.cc',
211         'browser/cast_content_browser_client.h',
212         'browser/cast_content_window.cc',
213         'browser/cast_content_window.h',
214         'browser/cast_download_manager_delegate.cc',
215         'browser/cast_download_manager_delegate.h',
216         'browser/cast_http_user_agent_settings.cc',
217         'browser/cast_http_user_agent_settings.h',
218         'browser/cast_network_delegate.cc',
219         'browser/cast_network_delegate.h',
220         'browser/cast_permission_manager.cc',
221         'browser/cast_permission_manager.h',
222         'browser/cast_quota_permission_context.cc',
223         'browser/cast_quota_permission_context.h',
224         'browser/cast_resource_dispatcher_host_delegate.cc',
225         'browser/cast_resource_dispatcher_host_delegate.h',
226         'browser/devtools/cast_dev_tools_delegate.cc',
227         'browser/devtools/cast_dev_tools_delegate.h',
228         'browser/devtools/remote_debugging_server.cc',
229         'browser/devtools/remote_debugging_server.h',
230         'browser/geolocation/cast_access_token_store.cc',
231         'browser/geolocation/cast_access_token_store.h',
232         'browser/metrics/cast_metrics_prefs.cc',
233         'browser/metrics/cast_metrics_prefs.h',
234         'browser/metrics/cast_metrics_service_client.cc',
235         'browser/metrics/cast_metrics_service_client.h',
236         'browser/metrics/cast_stability_metrics_provider.cc',
237         'browser/metrics/cast_stability_metrics_provider.h',
238         'browser/metrics/platform_metrics_providers.h',
239         'browser/pref_service_helper.cc',
240         'browser/pref_service_helper.h',
241         'browser/service/cast_service.cc',
242         'browser/service/cast_service.h',
243         'browser/url_request_context_factory.cc',
244         'browser/url_request_context_factory.h',
245         'common/cast_content_client.cc',
246         'common/cast_content_client.h',
247         'common/cast_resource_delegate.cc',
248         'common/cast_resource_delegate.h',
249         'common/chromecast_switches.cc',
250         'common/chromecast_switches.h',
251         'common/media/cast_messages.h',
252         'common/media/cast_message_generator.cc',
253         'common/media/cast_message_generator.h',
254         'common/platform_client_auth.h',
255         'common/pref_names.cc',
256         'common/pref_names.h',
257         'renderer/cast_content_renderer_client.cc',
258         'renderer/cast_content_renderer_client.h',
259         'renderer/cast_media_load_deferrer.cc',
260         'renderer/cast_media_load_deferrer.h',
261         'renderer/cast_render_process_observer.cc',
262         'renderer/cast_render_process_observer.h',
263         'renderer/key_systems_cast.cc',
264         'renderer/key_systems_cast.h',
265         'renderer/media/capabilities_message_filter.cc',
266         'renderer/media/capabilities_message_filter.h',
267       ],
268       'conditions': [
269         ['chromecast_branding=="Chrome"', {
270           'dependencies': [
271             'internal/chromecast_internal.gyp:cast_shell_internal',
272           ],
273         }, {
274           'sources': [
275             'browser/cast_content_browser_client_simple.cc',
276             'browser/cast_network_delegate_simple.cc',
277             'browser/devtools/remote_debugging_server_simple.cc',
278             'browser/metrics/platform_metrics_providers_simple.cc',
279             'browser/pref_service_helper_simple.cc',
280             'common/platform_client_auth_simple.cc',
281             'renderer/cast_content_renderer_client_simple.cc',
282             'renderer/key_systems_cast_simple.cc',
283           ],
284           'conditions': [
285             ['OS=="android"', {
286               'sources': [
287                 'browser/service/cast_service_android.cc',
288                 'browser/service/cast_service_android.h',
289               ],
290             }, {
291               'sources': [
292                 'browser/media/cast_browser_cdm_factory_simple.cc',
293                 'browser/service/cast_service_simple.cc',
294                 'browser/service/cast_service_simple.h',
295               ],
296             }],
297           ],
298         }],
299         # ExternalMetrics not necessary on Android and (as of this writing) uses
300         # non-portable filesystem operations. Also webcrypto is not used on
301         # Android either.
302         ['OS=="linux"', {
303           'sources': [
304             'browser/metrics/external_metrics.cc',
305             'browser/metrics/external_metrics.h',
306           ],
307           'dependencies': [
308             '../components/components.gyp:metrics_serialization',
309           ],
310         }],
311       ],
312     },
313     {
314       'target_name': 'cast_version_header',
315       'type': 'none',
316       'direct_dependent_settings': {
317         'include_dirs': [
318           '<(SHARED_INTERMEDIATE_DIR)',
319         ],
320       },
321       'actions': [
322         {
323           'action_name': 'version_header',
324           'message': 'Generating version header file: <@(_outputs)',
325           'inputs': [
326             '<(version_path)',
327             'common/version.h.in',
328           ],
329           'outputs': [
330             '<(SHARED_INTERMEDIATE_DIR)/chromecast/common/version.h',
331           ],
332           'action': [
333             'python',
334             '<(version_py_path)',
335             '-e', 'VERSION_FULL="<(version_full)"',
336             # CAST_BUILD_INCREMENTAL is taken from buildbot if available;
337             # otherwise, a dev string is used.
338             '-e', 'CAST_BUILD_INCREMENTAL="<!(echo ${CAST_BUILD_INCREMENTAL:="<!(date +%Y%m%d.%H%M%S)"})"',
339             # CAST_BUILD_RELEASE is taken from cast_build_release file if exist;
340             # otherwise, a dev string is used.
341             '-e', 'CAST_BUILD_RELEASE="<!(if test -f <(cast_build_release); then cat <(cast_build_release); else echo eng.${USER}; fi)"',
342             '-e', 'CAST_IS_DEBUG_BUILD=1 if "<(CONFIGURATION_NAME)" == "Debug" or <(cast_is_debug_build) == 1 else 0',
343             '-e', 'CAST_PRODUCT_TYPE=<(cast_product_type)',
344             'common/version.h.in',
345             '<@(_outputs)',
346           ],
347           'includes': [
348             '../build/util/version.gypi',
349           ],
350         },
351       ],
352     },
353   ],  # end of targets
355   # Targets for Android receiver.
356   'conditions': [
357     ['OS=="android"', {
358       'targets': [
359         {
360           'target_name': 'cast_shell_icudata',
361           'type': 'none',
362           'dependencies': [
363             '../third_party/icu/icu.gyp:icudata',
364             '../v8/tools/gyp/v8.gyp:v8_external_snapshot',
365           ],
366           'copies': [{
367             'destination': '<(PRODUCT_DIR)/assets',
368             'files': [
369               '<(PRODUCT_DIR)/icudtl.dat',
370               '<(PRODUCT_DIR)/natives_blob.bin',
371               '<(PRODUCT_DIR)/snapshot_blob.bin',
372             ],
373           }],
374         },
375         {
376           'target_name': 'libcast_shell_android',
377           'type': 'shared_library',
378           'dependencies': [
379             'cast_jni_headers',
380             'cast_shell_common',
381             'cast_shell_icudata',
382             'cast_shell_pak',
383             'cast_version_header',
384             '../base/base.gyp:base',
385             '../breakpad/breakpad.gyp:breakpad_client',
386             '../components/components.gyp:breakpad_host',
387             '../components/components.gyp:crash_component',
388             '../content/content.gyp:content',
389             '../skia/skia.gyp:skia',
390             '../ui/gfx/gfx.gyp:gfx',
391             '../ui/gl/gl.gyp:gl',
392           ],
393           'include_dirs': [
394             '../breakpad/src',
395           ],
396           'sources': [
397             'android/cast_jni_registrar.cc',
398             'android/cast_jni_registrar.h',
399             'android/chromecast_config_android.cc',
400             'android/chromecast_config_android.h',
401             'android/platform_jni_loader.h',
402             'app/android/cast_jni_loader.cc',
403             'browser/android/cast_window_android.cc',
404             'browser/android/cast_window_android.h',
405             'browser/android/cast_window_manager.cc',
406             'browser/android/cast_window_manager.h',
407             'browser/android/external_video_surface_container_impl.cc',
408             'browser/android/external_video_surface_container_impl.h',
409             'crash/android/cast_crash_reporter_client_android.cc',
410             'crash/android/cast_crash_reporter_client_android.h',
411             'crash/android/crash_handler.cc',
412             'crash/android/crash_handler.h',
413           ],
414           'conditions': [
415             ['chromecast_branding=="Chrome"', {
416               'dependencies': [
417                 'internal/chromecast_internal.gyp:cast_shell_android_internal'
418               ],
419             }, {
420               'sources': [
421                 'android/chromecast_config_android_stub.cc',
422                 'android/platform_jni_loader_stub.cc',
423               ],
424             }]
425           ],
426         },  # end of target 'libcast_shell_android'
427         {
428           'target_name': 'cast_shell_java',
429           'type': 'none',
430           'dependencies': [
431             '<(android_support_v13_target)',
432             '../base/base.gyp:base_java',
433             '../content/content.gyp:content_java',
434             '../media/media.gyp:media_java',
435             '../net/net.gyp:net_java',
436             '../ui/android/ui_android.gyp:ui_java',
437           ],
438           'variables': {
439             'has_java_resources': 1,
440             'java_in_dir': 'browser/android/apk',
441             'resource_dir': 'browser/android/apk/res',
442             'R_package': 'org.chromium.chromecast.shell',
443           },
444           'includes': ['../build/java.gypi'],
445         },  # end of target 'cast_shell_java'
446         {
447           'target_name': 'cast_shell_manifest',
448           'type': 'none',
449           'variables': {
450             'jinja_inputs': ['browser/android/apk/AndroidManifest.xml.jinja2'],
451             'jinja_output': '<(SHARED_INTERMEDIATE_DIR)/cast_shell_manifest/AndroidManifest.xml',
452           },
453           'includes': [ '../build/android/jinja_template.gypi' ],
454         },
455         {
456           'target_name': 'cast_shell_apk',
457           'type': 'none',
458           'dependencies': [
459             'cast_shell_java',
460             'libcast_shell_android',
461           ],
462           'variables': {
463             'apk_name': 'CastShell',
464             'manifest_package_name': 'org.chromium.chromecast.shell',
465             # Note(gunsch): there are no Java files in the android/ directory.
466             # Unfortunately, the java_apk.gypi target rigidly insists on having
467             # a java_in_dir directory, but complains about duplicate classes
468             # from the common cast_shell_java target (shared with internal APK)
469             # if the actual Java path is used.
470             # This will hopefully be removable after the great GN migration.
471             'java_in_dir': 'android',
472             'android_manifest_path': '<(SHARED_INTERMEDIATE_DIR)/cast_shell_manifest/AndroidManifest.xml',
473             'package_name': 'org.chromium.chromecast.shell',
474             'native_lib_target': 'libcast_shell_android',
475             'asset_location': '<(PRODUCT_DIR)/assets',
476             'additional_input_paths': ['<(PRODUCT_DIR)/assets/cast_shell.pak'],
477           },
478           'includes': [ '../build/java_apk.gypi' ],
479         },
480         {
481           'target_name': 'cast_jni_headers',
482           'type': 'none',
483           'sources': [
484             'browser/android/apk/src/org/chromium/chromecast/shell/CastCrashHandler.java',
485             'browser/android/apk/src/org/chromium/chromecast/shell/CastWindowAndroid.java',
486             'browser/android/apk/src/org/chromium/chromecast/shell/CastWindowManager.java',
487             'browser/android/apk/src/org/chromium/chromecast/shell/ExternalVideoSurfaceContainer.java',
488           ],
489           'direct_dependent_settings': {
490             'include_dirs': [
491               '<(SHARED_INTERMEDIATE_DIR)/chromecast',
492             ],
493           },
494           'variables': {
495             'jni_gen_package': 'chromecast',
496           },
497           'includes': [ '../build/jni_generator.gypi' ],
498         },
499       ],  # end of targets
500     }, {  # OS != "android"
501       'targets': [
502         {
503           'target_name': 'cast_shell_media',
504           'type': '<(component)',
505           'dependencies': [
506             'media/media.gyp:cast_media',
507             '../content/content.gyp:content',
508             '../ipc/ipc.gyp:ipc',
509             '../media/media.gyp:media',
510           ],
511           'sources': [
512             'browser/media/cast_browser_cdm_factory.cc',
513             'browser/media/cast_browser_cdm_factory.h',
514             'browser/media/cma_message_filter_host.cc',
515             'browser/media/cma_message_filter_host.h',
516             'browser/media/cma_message_loop.cc',
517             'browser/media/cma_message_loop.h',
518             'browser/media/media_pipeline_host.cc',
519             'browser/media/media_pipeline_host.h',
520             'common/media/cma_ipc_common.h',
521             'common/media/cma_messages.h',
522             'common/media/cma_message_generator.cc',
523             'common/media/cma_message_generator.h',
524             'common/media/cma_param_traits.cc',
525             'common/media/cma_param_traits.h',
526             'common/media/shared_memory_chunk.cc',
527             'common/media/shared_memory_chunk.h',
528             'renderer/media/audio_pipeline_proxy.cc',
529             'renderer/media/audio_pipeline_proxy.h',
530             'renderer/media/chromecast_media_renderer_factory.cc',
531             'renderer/media/chromecast_media_renderer_factory.h',
532             'renderer/media/cma_message_filter_proxy.cc',
533             'renderer/media/cma_message_filter_proxy.h',
534             'renderer/media/media_channel_proxy.cc',
535             'renderer/media/media_channel_proxy.h',
536             'renderer/media/media_pipeline_proxy.cc',
537             'renderer/media/media_pipeline_proxy.h',
538             'renderer/media/video_pipeline_proxy.cc',
539             'renderer/media/video_pipeline_proxy.h',
540           ],
541         },  # end of target 'cast_shell_media'
542         # This target contains all of the primary code of |cast_shell|, except
543         # for |main|. This allows end-to-end tests using |cast_shell|.
544         # This also includes all targets that cannot be built on Android.
545         {
546           'target_name': 'cast_shell_core',
547           'type': '<(component)',
548           'dependencies': [
549             'cast_shell_media',
550             'cast_shell_common',
551             'media/media.gyp:cast_media',
552             '../ui/aura/aura.gyp:aura_test_support',
553           ],
554           'conditions': [
555             ['chromecast_branding=="Chrome"', {
556               'dependencies': [
557                 'internal/chromecast_internal.gyp:cast_gfx_internal',
558               ],
559             }, {
560               'dependencies': [
561                 '../ui/ozone/ozone.gyp:eglplatform_shim_x11',
562               ],
563             }],
564           ],
565         },
566         {
567           'target_name': 'cast_shell',
568           'type': 'executable',
569           'dependencies': [
570             'cast_shell_core',
571           ],
572           'sources': [
573             'app/cast_main.cc',
574           ],
575           # TODO(dougsteed): remove when Chromecast moves to boringssl.
576           # Allow the cast shell to find the NSS module in the same directory.
577           'ldflags': [
578             '-Wl,-rpath=\$$ORIGIN'
579           ],
580         },
581       ],  # end of targets
582     }],
583     ['enable_default_cast_graphics==1', {
584       'targets': [
585         {
586           'target_name': 'libcast_graphics_1.0',
587           'type': 'shared_library',
588           'dependencies': [
589             'cast_public_api'
590           ],
591           'sources': [
592             'graphics/cast_egl_platform_default.cc',
593             'graphics/graphics_properties_default.cc'
594           ],
595         }
596       ]
597     }],
598   ],  # end of conditions