Roll src/third_party/WebKit a3b4a2e:7441784 (svn 202551:202552)
[chromium-blink-merge.git] / third_party / libvpx_new / libvpx.gyp
blob16751610847133f3ae06943160887a51f6106cad
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.
5   'variables': {
6     'libvpx_build_vp9%': 1,
7     'libvpx_source%': 'source/libvpx',
8     # Disable LTO for neon targets
9     # crbug.com/408997
10     'use_lto%': 0,
11     'conditions': [
12       ['os_posix==1', {
13         'asm_obj_extension': 'o',
14       }],
15       ['OS=="win"', {
16         'asm_obj_extension': 'obj',
17       }],
19       ['msan==1', {
20         'target_arch_full': 'generic',
21       }, {
22         'conditions': [
23           ['(target_arch=="arm" or target_arch=="armv7") and arm_neon==1', {
24             'target_arch_full': 'arm-neon',
25           }, {
26             'conditions': [
27               ['OS=="android" and ((target_arch=="arm" or target_arch=="armv7") and arm_neon==0)', {
28                 'target_arch_full': 'arm-neon-cpu-detect',
29               }, {
30                'target_arch_full': '<(target_arch)',
31               }],
32             ],
33           }],
34           ['target_arch=="arm64"', {
35             'target_arch_full': 'arm64',
36           }],
37         ],
38       }],
40       ['os_posix == 1 and OS != "mac"', {
41         'OS_CATEGORY%': 'linux',
42       }, {
43         'OS_CATEGORY%': '<(OS)',
44       }],
45     ],
47     # Location of the intermediate output.
48     'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
49   },
50   'target_defaults': {
51     'target_conditions': [
52       ['<(libvpx_build_vp9)==0', {
53         'sources/': [ ['exclude', '(^|/)vp9/'], ],
54       }],
55     ],
56     'variables': {
57       'conditions': [
58         ['OS=="win" and buildtype=="Official"', {
59           # Do not set to 'size', as it results in an error on win64.
60           'optimize' :'speed',
61         }],
62       ],
63       'clang_warning_flags': [
64         # libvpx heavily relies on implicit enum casting.
65         '-Wno-conversion',
66         # libvpx does `if ((a == b))` in some places.
67         '-Wno-parentheses-equality',
68         # libvpx has many static functions in header, which trigger this warning
69         '-Wno-unused-function',
70       ],
71       'clang_warning_flags_unset': [
72         # libvpx does assert(!"foo"); in some places.
73         '-Wstring-conversion',
74       ],
75     },
76   },
77   'conditions': [
78     ['target_arch=="ia32"', {
79       'includes': ['libvpx_srcs_x86_intrinsics.gypi', ],
80     }],
81     ['target_arch=="x64" and msan==0', {
82       'includes': ['libvpx_srcs_x86_64_intrinsics.gypi', ],
83     }],
84     [ '(target_arch=="arm" or target_arch=="armv7") and arm_neon==0 and OS=="android"', {
85       # When building for targets which may not have NEON (but may!), include
86       # support for neon and hide it behind Android cpu-features.
87       'includes': ['libvpx_srcs_arm_neon_cpu_detect_intrinsics.gypi', ],
88     }],
89     [ '(target_arch != "arm" and target_arch != "armv7") and \
90        (target_arch != "mipsel" and target_arch != "mips64el")', {
91       'targets': [
92         {
93           # This libvpx target contains both encoder and decoder.
94           # Encoder is configured to be realtime only.
95           'target_name': 'libvpx_new',
96           'type': 'static_library',
97           'variables': {
98             'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
99             'OS_CATEGORY%': '<(OS_CATEGORY)',
100             'yasm_flags': [
101               '-D', 'CHROMIUM',
102               '-I', 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
103               '-I', 'source/config',
104               '-I', '<(libvpx_source)',
105             ],
106             # yasm only gets the flags we define. It doesn't inherit any of the
107             # really useful defines that come with a gcc invocation. In this
108             # case, we rely on __ANDROID__ to set 'rand' to 'lrand48'.
109             # Previously we used the builtin _rand but that's gone away.
110             'conditions': [
111               ['OS=="android"', {
112                 'yasm_flags': [
113                   '-D', '__ANDROID__',
114                 ],
115               }],
116             ],
117           },
118           'includes': [
119             '../yasm/yasm_compile.gypi'
120           ],
121           'include_dirs': [
122             'source/config/<(OS_CATEGORY)/<(target_arch_full)',
123             'source/config',
124             '<(libvpx_source)',
125             '<(libvpx_source)/vp8/common',
126             '<(libvpx_source)/vp8/decoder',
127             '<(libvpx_source)/vp8/encoder',
128             '<(shared_generated_dir)', # Provides vpx_rtcd.h.
129           ],
130           'direct_dependent_settings': {
131             'include_dirs': [
132               '<(libvpx_source)',
133             ],
134           },
135           # VS2010 does not correctly incrementally link obj files generated
136           # from asm files. This flag disables UseLibraryDependencyInputs to
137           # avoid this problem.
138           'msvs_2010_disable_uldi_when_referenced': 1,
139           'conditions': [
140             ['target_arch=="ia32"', {
141               'includes': [
142                 'libvpx_srcs_x86.gypi',
143               ],
144               'dependencies': [
145                 'libvpx_intrinsics_mmx',
146                 'libvpx_intrinsics_sse2',
147                 # Currently no sse3 intrinsic functions
148                 #'libvpx_intrinsics_sse3',
149                 'libvpx_intrinsics_ssse3',
150                 'libvpx_intrinsics_sse4_1',
151                 # Currently no avx intrinsic functions
152                 #'libvpx_intrinsics_avx',
153                 'libvpx_intrinsics_avx2',
154               ],
155             }],
156             ['target_arch=="arm64"', {
157               'includes': [ 'libvpx_srcs_arm64.gypi', ],
158             }],
159             ['target_arch=="x64"', {
160               'conditions': [
161                 ['msan==1', {
162                   'includes': [ 'libvpx_srcs_generic.gypi', ],
163                 }, {
164                   'includes': [
165                     'libvpx_srcs_x86_64.gypi',
166                   ],
167                   'dependencies': [
168                     'libvpx_intrinsics_mmx',
169                     'libvpx_intrinsics_sse2',
170                     # Currently no sse3 intrinsic functions
171                     #'libvpx_intrinsics_sse3',
172                     'libvpx_intrinsics_ssse3',
173                     'libvpx_intrinsics_sse4_1',
174                     # Currently no avx intrinsic functions
175                     #'libvpx_intrinsics_avx',
176                     'libvpx_intrinsics_avx2',
177                   ],
178                 }],
179               ],
180             }],
181           ],
182         },
183       ],
184     },
185     ],
186     # 'libvpx' target for mipsel and mips64el builds.
187     [ 'target_arch=="mipsel" or target_arch=="mips64el"', {
188       'targets': [
189         {
190           # This libvpx target contains both encoder and decoder.
191           # Encoder is configured to be realtime only.
192           'target_name': 'libvpx_new',
193           'type': 'static_library',
194           'variables': {
195             'shared_generated_dir':
196               '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
197           },
198           'includes': [
199             'libvpx_srcs_mips.gypi',
200           ],
201           'include_dirs': [
202             'source/config/<(OS_CATEGORY)/<(target_arch_full)',
203             'source/config',
204             '<(libvpx_source)',
205             '<(libvpx_source)/vp8/common',
206             '<(libvpx_source)/vp8/decoder',
207             '<(libvpx_source)/vp8/encoder',
208           ],
209           'direct_dependent_settings': {
210             'include_dirs': [
211               '<(libvpx_source)',
212             ],
213           },
214           'sources': [
215             'source/config/<(OS_CATEGORY)/<(target_arch_full)/vpx_config.c',
216           ],
217         },
218       ],
219     },
220     ],
221     # 'libvpx' target for ARM builds.
222     [ '(target_arch=="arm" or target_arch=="armv7") ', {
223       'targets': [
224         {
225           # This libvpx target contains both encoder and decoder.
226           # Encoder is configured to be realtime only.
227           'target_name': 'libvpx_new',
228           'type': 'static_library',
230           'includes': [ 'ads2gas.gypi', ],
232           'xcode_settings': {
233             'OTHER_CFLAGS': [
234               '-I<!(pwd)/source/config/<(OS_CATEGORY)/<(target_arch_full)',
235               '-I<!(pwd)/source/config',
236               '-I<(shared_generated_dir)',
237             ],
238           },
239           'include_dirs': [
240             'source/config/<(OS_CATEGORY)/<(target_arch_full)',
241             'source/config',
242             '<(libvpx_source)',
243           ],
244           'direct_dependent_settings': {
245             'include_dirs': [
246               '<(libvpx_source)',
247             ],
248           },
249           'conditions': [
250             # Libvpx optimizations for ARMv6 or ARMv7 without NEON.
251             ['arm_neon==0', {
252               'conditions': [
253                 ['OS=="android"', {
254                   'includes': [
255                     'libvpx_srcs_arm_neon_cpu_detect.gypi',
256                   ],
257                   'dependencies': [
258                     'libvpx_intrinsics_neon',
259                   ],
260                 }, {
261                   'includes': [
262                     'libvpx_srcs_arm.gypi',
263                   ],
264                 }],
265               ],
266             }],
267             # Libvpx optimizations for ARMv7 with NEON.
268             ['arm_neon==1', {
269               'includes': [
270                 'libvpx_srcs_arm_neon.gypi',
271               ],
272             }],
273             ['OS == "android"', {
274               'dependencies': [
275                 '../../build/android/ndk.gyp:cpu_features',
276               ],
277             }],
278             ['OS == "ios"', {
279               'xcode_settings': {
280                 'OTHER_CFLAGS!': [
281                   # Breaks at least boolhuff_armv5te:token_high_bit_not_set_ev.
282                   '-fstack-protector-all',  # Implies -fstack-protector
283                 ],
284               },
285             }],
286           ],
287         },
288       ],
289     }],
290   ],