Add ENABLE_MEDIA_ROUTER define to builds other than Android and iOS.
[chromium-blink-merge.git] / third_party / widevine / cdm / widevine_cdm.gyp
blob7161160333fa5b2cb8d3fcdb40550b934843bbc0
1 # Copyright (c) 2012 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     # Allow widevinecdmadapter to be built in Chromium.
8     'variables': {
9       'enable_widevine%': 0,
10     },
11     'enable_widevine%': '<(enable_widevine)',
12     'widevine_cdm_version_h_file%': 'widevine_cdm_version.h',
13     'widevine_cdm_binary_files%': [],
14     'conditions': [
15       [ 'branding == "Chrome"', {
16         'conditions': [
17           [ 'chromeos == 1', {
18             'widevine_cdm_version_h_file%':
19                 'chromeos/<(target_arch)/widevine_cdm_version.h',
20             'widevine_cdm_binary_files%': [
21               'chromeos/<(target_arch)/libwidevinecdm.so',
22             ],
23           }],
24           [ 'OS == "linux" and chromeos == 0', {
25             'widevine_cdm_version_h_file%':
26                 'linux/<(target_arch)/widevine_cdm_version.h',
27             'widevine_cdm_binary_files%': [
28               'linux/<(target_arch)/libwidevinecdm.so',
29             ],
30           }],
31           [ 'OS == "mac"', {
32             'widevine_cdm_version_h_file%':
33                 'mac/<(target_arch)/widevine_cdm_version.h',
34             'widevine_cdm_binary_files%': [
35               'mac/<(target_arch)/libwidevinecdm.dylib',
36             ],
37           }],
38           [ 'OS == "win"', {
39             'widevine_cdm_version_h_file%':
40                 'win/<(target_arch)/widevine_cdm_version.h',
41             'widevine_cdm_binary_files%': [
42               'win/<(target_arch)/widevinecdm.dll',
43               'win/<(target_arch)/widevinecdm.dll.lib',
44             ],
45           }],
46         ],
47       }],
48       [ 'OS == "android"', {
49         'widevine_cdm_version_h_file%':
50             'android/widevine_cdm_version.h',
51       }],
52       [ 'branding != "Chrome" and OS != "android" and enable_widevine == 1', {
53         # If enable_widevine==1 then create a dummy widevinecdm. On Win/Mac
54         # the component updater will get the latest version and use it.
55         # Other systems are not currently supported.
56         'widevine_cdm_version_h_file%':
57             'stub/widevine_cdm_version.h',
58       }],
59     ],
60   },
61   'includes': [
62     '../../../build/util/version.gypi',
63   ],
65   # Always provide a target, so we can put the logic about whether there's
66   # anything to be done in this file (instead of a higher-level .gyp file).
67   'targets': [
68     {
69       # GN version: //third_party/widevine/cdm:adapter_resources
70       'target_name': 'widevinecdmadapter_resources',
71       'type': 'none',
72       'conditions': [
73         ['branding == "Chrome"', {
74           'variables': {
75             'branding_path': '../../../chrome/app/theme/google_chrome/BRANDING',
76           },
77         }, { # else branding!="Chrome"
78           'variables': {
79             'branding_path': '../../../chrome/app/theme/chromium/BRANDING',
80           },
81         }],
82       ],
83       'variables': {
84         'output_dir': '.',
85         'template_input_path': '../../../chrome/app/chrome_version.rc.version',
86         'extra_variable_files_arguments': [ '-f', 'BRANDING' ],
87         'extra_variable_files': [ 'BRANDING' ], # NOTE: matches that above
88       },
89       'sources': [
90         'widevinecdmadapter.ver',
91       ],
92       'includes': [
93         '../../../chrome/version_resource_rules.gypi',
94       ],
95     },
96     {
97       # GN version: //third_party/widevine/cdm:adapter
98       'target_name': 'widevinecdmadapter',
99       'type': 'none',
100       'conditions': [
101         [ '(branding == "Chrome" or enable_widevine == 1) and enable_pepper_cdms == 1', {
102           'dependencies': [
103             '<(DEPTH)/ppapi/ppapi.gyp:ppapi_cpp',
104             '<(DEPTH)/media/media_cdm_adapter.gyp:cdmadapter',
105             'widevine_cdm_version_h',
106             'widevinecdm',
107             'widevinecdmadapter_resources',
108           ],
109           'sources': [
110             '<(SHARED_INTERMEDIATE_DIR)/widevinecdmadapter_version.rc',
111           ],
112           'conditions': [
113             [ 'os_posix == 1 and OS != "mac"', {
114               'libraries': [
115                 '-lrt',
116                 # Copied/created by widevinecdm.
117                 '<(PRODUCT_DIR)/libwidevinecdm.so',
118               ],
119             }],
120             [ 'OS == "win"', {
121               'libraries': [
122                 # Copied/created by widevinecdm.
123                 '<(PRODUCT_DIR)/widevinecdm.dll.lib',
124               ],
125             }],
126             [ 'OS == "mac"', {
127               'libraries': [
128                 # Copied/created by widevinecdm.
129                 '<(PRODUCT_DIR)/libwidevinecdm.dylib',
130               ],
131             }],
132           ],
133         }],
134       ],
135     },
136     {
137       # GN version: //third_party/widevine/cdm:version_h
138       'target_name': 'widevine_cdm_version_h',
139       'type': 'none',
140       'copies': [{
141         'destination': '<(SHARED_INTERMEDIATE_DIR)',
142         'files': [ '<(widevine_cdm_version_h_file)' ],
143       }],
144     },
145     {
146       # GN version: //third_party/widevine/cdm:binaries
147       'target_name': 'widevinecdm',
148       'type': 'none',
149       'conditions': [
150         [ 'branding == "Chrome"', {
151           'conditions': [
152             [ 'OS=="mac"', {
153               'xcode_settings': {
154                 'COPY_PHASE_STRIP': 'NO',
155               }
156             }],
157           ],
158           'copies': [{
159             # TODO(ddorwin): Do we need a sub-directory? We either need a
160             # sub-directory or to rename manifest.json before we can copy it.
161             'destination': '<(PRODUCT_DIR)',
162             'files': [ '<@(widevine_cdm_binary_files)' ],
163           }],
164         }],
165         [ 'branding != "Chrome" and enable_widevine == 1', {
166           'conditions': [
167             ['os_posix == 1 and OS != "mac"', {
168               'type': 'loadable_module',
169               # Note that this causes the binary to be put in PRODUCT_DIR
170               # instead of lib/. This matches what happens in the copy step
171               # above.
172             }],
173             ['OS == "mac" or OS == "win"', {
174               'type': 'shared_library',
175             }],
176             ['OS == "mac"', {
177               'xcode_settings': {
178                 'DYLIB_INSTALL_NAME_BASE': '@loader_path',
179               },
180             }],
181           ],
182           'defines': ['CDM_IMPLEMENTATION'],
183           'dependencies': [
184             '<(DEPTH)/base/base.gyp:base',
185           ],
186           'sources': [
187             '<(DEPTH)/media/cdm/stub/stub_cdm.cc',
188             '<(DEPTH)/media/cdm/stub/stub_cdm.h',
189           ],
190         }],
191       ],
192     },
193     {
194       'target_name': 'widevine_test_license_server',
195       'type': 'none',
196       'conditions': [
197         [ 'branding == "Chrome" and OS == "linux"', {
198           'dependencies': [
199             '<(DEPTH)/third_party/widevine/test/license_server/license_server.gyp:test_license_server',
200           ],
201         }],
202       ],
203     },
204   ],