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 'libvpx_build_vp9%': 1,
7 'libvpx_source%': 'source/libvpx',
10 'asm_obj_extension': 'o',
13 'asm_obj_extension': 'obj',
17 'target_arch_full': 'generic',
20 ['(target_arch=="arm" or target_arch=="armv7") and arm_neon==1', {
21 'target_arch_full': 'arm-neon',
24 ['OS=="android" and ((target_arch=="arm" or target_arch=="armv7") and arm_neon==0)', {
25 'target_arch_full': 'arm-neon-cpu-detect',
27 'target_arch_full': '<(target_arch)',
31 ['target_arch=="arm64"', {
32 'target_arch_full': 'generic',
37 ['os_posix == 1 and OS != "mac"', {
38 'OS_CATEGORY%': 'linux',
40 'OS_CATEGORY%': '<(OS)',
44 # Location of the intermediate output.
45 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
48 'target_conditions': [
49 ['<(libvpx_build_vp9)==0', {
50 'sources/': [ ['exclude', '(^|/)vp9/'], ],
55 ['OS=="win" and buildtype=="Official"', {
56 # Do not set to 'size', as it results in an error on win64.
63 ['target_arch=="ia32"', {
64 'includes': ['libvpx_srcs_x86_intrinsics.gypi', ],
66 ['target_arch=="x64" and msan==0', {
67 'includes': ['libvpx_srcs_x86_64_intrinsics.gypi', ],
69 [ '(target_arch=="arm" or target_arch=="armv7") and arm_neon==0 and OS=="android"', {
70 # When building for targets which may not have NEON (but may!), include
71 # support for neon and hide it behind Android cpu-features.
72 'includes': ['libvpx_srcs_arm_neon_cpu_detect_intrinsics.gypi', ],
74 [ '(target_arch != "arm" and target_arch != "armv7") and target_arch != "mipsel"', {
77 # This libvpx target contains both encoder and decoder.
78 # Encoder is configured to be realtime only.
79 'target_name': 'libvpx',
80 'type': 'static_library',
82 'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
83 'OS_CATEGORY%': '<(OS_CATEGORY)',
86 '-I', 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
87 '-I', 'source/config',
88 '-I', '<(libvpx_source)',
89 '-I', '<(shared_generated_dir)', # Generated assembly offsets
93 'gen_asm_offsets_vp8',
96 '../yasm/yasm_compile.gypi'
99 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
102 '<(libvpx_source)/vp8/common',
103 '<(libvpx_source)/vp8/decoder',
104 '<(libvpx_source)/vp8/encoder',
105 '<(shared_generated_dir)', # Provides vpx_rtcd.h.
107 'direct_dependent_settings': {
112 # VS2010 does not correctly incrementally link obj files generated
113 # from asm files. This flag disables UseLibraryDependencyInputs to
114 # avoid this problem.
115 'msvs_2010_disable_uldi_when_referenced': 1,
117 ['target_arch=="ia32"', {
119 'libvpx_srcs_x86.gypi',
122 'libvpx_intrinsics_mmx',
123 'libvpx_intrinsics_sse2',
124 # Currently no sse3 intrinsic functions
125 #'libvpx_intrinsics_sse3',
126 'libvpx_intrinsics_ssse3',
127 # Currently no sse4_1 intrinsic functions
128 #'libvpx_intrinsics_sse4_1',
129 # Currently no avx intrinsic functions
130 #'libvpx_intrinsics_avx',
131 #'libvpx_intrinsics_avx2',
134 ['target_arch=="arm64"', {
135 'includes': [ 'libvpx_srcs_generic.gypi', ],
137 ['target_arch=="x64"', {
140 'includes': [ 'libvpx_srcs_generic.gypi', ],
143 'libvpx_srcs_x86_64.gypi',
144 'libvpx_srcs_nacl.gypi',
147 'libvpx_intrinsics_mmx',
148 'libvpx_intrinsics_sse2',
149 # Currently no sse3 intrinsic functions
150 #'libvpx_intrinsics_sse3',
151 'libvpx_intrinsics_ssse3',
152 # Currently no sse4_1 intrinsic functions
153 #'libvpx_intrinsics_sse4_1',
154 # Currently no avx intrinsic functions
155 #'libvpx_intrinsics_avx',
156 #'libvpx_intrinsics_avx2',
164 # libvpx heavily relies on implicit enum casting.
166 # libvpx does `if ((a == b))` in some places.
167 '-Wno-parentheses-equality',
172 '-Wno-parentheses-equality',
176 # ChromeOS needs these files for animated WebM avatars.
178 '<(libvpx_source)/third_party/libmkv/EbmlIDs.h',
179 '<(libvpx_source)/third_party/libmkv/EbmlWriter.c',
180 '<(libvpx_source)/third_party/libmkv/EbmlWriter.h',
188 # 'libvpx' target for mips builds.
189 [ 'target_arch=="mipsel" ', {
192 # This libvpx target contains both encoder and decoder.
193 # Encoder is configured to be realtime only.
194 'target_name': 'libvpx',
195 'type': 'static_library',
197 'shared_generated_dir':
198 '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
201 'libvpx_srcs_mips.gypi',
204 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
207 '<(libvpx_source)/vp8/common',
208 '<(libvpx_source)/vp8/decoder',
209 '<(libvpx_source)/vp8/encoder',
211 'direct_dependent_settings': {
217 'source/config/<(OS_CATEGORY)/<(target_arch_full)/vpx_config.c',
223 # 'libvpx' target for ARM builds.
224 [ '(target_arch=="arm" or target_arch=="armv7") ', {
227 # This libvpx target contains both encoder and decoder.
228 # Encoder is configured to be realtime only.
229 'target_name': 'libvpx',
230 'type': 'static_library',
232 'gen_asm_offsets_vp8',
233 'gen_asm_offsets_vpx_scale',
236 # Copy the script to the output folder so that we can use it with
239 'destination': '<(shared_generated_dir)',
241 '<(ads2gas_script_path)',
242 '<(ads2gas_script_include)',
246 # Rule to convert .asm files to .S files.
249 'rule_name': 'convert_asm',
252 '<(shared_generated_dir)/<(ads2gas_script)',
253 '<(shared_generated_dir)/thumb.pm',
256 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).S',
261 'cat <(RULE_INPUT_PATH) | perl <(shared_generated_dir)/<(ads2gas_script) -chromium > <(shared_generated_dir)/<(RULE_INPUT_ROOT).S',
263 'process_outputs_as_sources': 1,
264 'message': 'Convert libvpx asm file for ARM <(RULE_INPUT_PATH)',
272 'ads2gas_script%': 'ads2gas_apple.pl',
274 'ads2gas_script%': 'ads2gas.pl',
278 'ads2gas_script%': '<(ads2gas_script)',
279 # Location of the assembly conversion script.
280 'ads2gas_script_path': '<(libvpx_source)/build/make/<(ads2gas_script)',
281 'ads2gas_script_include': '<(libvpx_source)/build/make/thumb.pm',
283 # We need to explicitly tell the assembler to look for
284 # .include directive files from the place where they're
287 '-Wa,-I,<!(pwd)/source/config/<(OS_CATEGORY)/<(target_arch_full)',
288 '-Wa,-I,<!(pwd)/source/config',
289 '-Wa,-I,<(shared_generated_dir)',
293 '-I<!(pwd)/source/config/<(OS_CATEGORY)/<(target_arch_full)',
294 '-I<!(pwd)/source/config',
295 '-I<(shared_generated_dir)',
299 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
303 'direct_dependent_settings': {
309 # Libvpx optimizations for ARMv6 or ARMv7 without NEON.
314 'libvpx_srcs_arm_neon_cpu_detect.gypi',
317 'libvpx_intrinsics_neon',
324 'libvpx_srcs_arm.gypi',
329 # Libvpx optimizations for ARMv7 with NEON.
332 'libvpx_srcs_arm_neon.gypi',
335 ['OS == "android"', {
337 '../../build/android/cpufeatures.gypi',
341 # ChromeOS needs these files for animated WebM avatars.
343 '<(libvpx_source)/third_party/libmkv/EbmlIDs.h',
344 '<(libvpx_source)/third_party/libmkv/EbmlWriter.c',
345 '<(libvpx_source)/third_party/libmkv/EbmlWriter.h',
351 # Breaks at least boolhuff_armv5te:token_high_bit_not_set_ev.
352 '-fstack-protector-all', # Implies -fstack-protector
363 # A tool that runs on host to extract integers from object file.
364 'target_name': 'libvpx_obj_int_extract',
365 'type': 'executable',
366 'toolsets': ['host'],
368 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
373 '<(libvpx_source)/build/make/obj_int_extract.c',
376 ['android_webview_build==1', {
377 'defines': [ 'FORCE_PARSE_ELF' ],
378 'include_dirs': [ 'include' ],
383 # A library that contains assembly offsets needed.
384 'target_name': 'libvpx_asm_offsets_vp8',
385 'type': 'static_library',
386 'android_unmangled_name': 1,
387 'hard_dependency': 1,
389 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
395 'cflags!': [ '-fsanitize=address' ],
396 'xcode_settings': { 'OTHER_CFLAGS!': [ '-fsanitize=address' ] },
397 'ldflags!': [ '-fsanitize=address' ],
401 'VCCLCompilerTool': {
402 # Clang uses -fdata-sections when function level linking is
403 # enabled, but libvpx_obj_int_extract expects all data to
404 # reside in the same section on Windows.
405 'EnableFunctionLevelLinking': 'false',
411 '<(libvpx_source)/vp8/encoder/vp8_asm_enc_offsets.c',
415 # A library that contains assembly offsets needed.
416 # TODO(fgalligan): Merge libvpx_asm_offsets_vpx_scale into
417 # libvpx_asm_offsets.
418 'target_name': 'libvpx_asm_offsets_vpx_scale',
419 'type': 'static_library',
420 'android_unmangled_name': 1,
421 'hard_dependency': 1,
423 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
429 'cflags!': [ '-faddress-sanitizer', '-fsanitize=address', ],
431 'OTHER_CFLAGS!': [ '-faddress-sanitizer','-fsanitize=address' ],
433 'ldflags!': [ '-faddress-sanitizer', '-fsanitize=address', ],
437 '<(libvpx_source)/vpx_scale/vpx_scale_asm_offsets.c',
441 # A target that takes assembly offsets library and generate the
442 # corresponding assembly files.
443 # This target is a hard dependency because the generated .asm files
444 # are needed all assembly optimized files in libvpx.
445 'target_name': 'gen_asm_offsets_vp8',
447 'hard_dependency': 1,
449 'libvpx_asm_offsets_vp8',
450 'libvpx_obj_int_extract#host',
453 'lib_intermediate_name' : '',
455 'output_dir': '<(shared_generated_dir)',
457 ['android_webview_build==1', {
458 # pass the empty string for 3rd and 4th arguments of
459 # intermediates-dir-for macro.
460 'lib_intermediate_name' : '$(realpath $(call intermediates-dir-for, STATIC_LIBRARIES, libvpx_asm_offsets_vp8,,, $(GYP_VAR_PREFIX)))/libvpx_asm_offsets_vp8.a',
462 ['(target_arch=="arm" or target_arch=="armv7")', {
463 'output_format': 'gas',
465 'output_format': 'rvds',
472 'ninja_obj_dir': '<(PRODUCT_DIR)/obj/third_party/libvpx/<(libvpx_source)/vp8',
476 'action_name': 'copy_enc_offsets_obj',
477 'inputs': [ 'copy_obj.py' ],
478 'outputs': [ '<(INTERMEDIATE_DIR)/vp8_asm_enc_offsets.obj' ],
481 '<(DEPTH)/third_party/libvpx/copy_obj.py',
482 '-d', '<@(_outputs)',
483 '-s', '<(PRODUCT_DIR)/obj/libvpx_asm_offsets_vp8/vp8_asm_enc_offsets.obj',
484 '-s', '<(ninja_obj_dir)/encoder/libvpx_asm_offsets_vp8.vp8_asm_enc_offsets.obj',
485 '-s', '<(PRODUCT_DIR)/obj/Source/WebKit/chromium/third_party/libvpx/<(libvpx_source)/vp8/encoder/libvpx_asm_offsets_vp8.vp8_asm_enc_offsets.obj',
487 'process_output_as_sources': 1,
491 '<(INTERMEDIATE_DIR)/vp8_asm_enc_offsets.obj',
495 'unpack_lib_search_path_list': [
496 '-a', '<(PRODUCT_DIR)/libvpx_asm_offsets_vp8.a',
497 '-a', '<(LIB_DIR)/third_party/libvpx/libvpx_asm_offsets_vp8.a',
498 '-a', '<(LIB_DIR)/Source/WebKit/chromium/third_party/libvpx/libvpx_asm_offsets_vp8.a',
499 '-a', '<(lib_intermediate_name)',
501 'unpack_lib_output_dir':'<(INTERMEDIATE_DIR)',
502 'unpack_lib_name':'vp8_asm_enc_offsets.o'
504 'includes': ['unpack_lib_posix.gypi'],
505 # Need this otherwise gyp won't run the rule on them.
507 '<(INTERMEDIATE_DIR)/vp8_asm_enc_offsets.o',
511 'includes': ['obj_int_extract.gypi'],
514 # A target that takes assembly offsets library and generate the
515 # corresponding assembly files.
516 # This target is a hard dependency because the generated .asm files
517 # are needed all assembly optimized files in libvpx.
518 'target_name': 'gen_asm_offsets_vpx_scale',
520 'hard_dependency': 1,
522 'libvpx_asm_offsets_vpx_scale',
523 'libvpx_obj_int_extract#host',
526 'lib_intermediate_name' : '',
528 'output_dir': '<(shared_generated_dir)',
530 ['android_webview_build==1', {
531 # pass the empty string for 3rd and 4th arguments of
532 # intermediates-dir-for macro.
533 'lib_intermediate_name' : '<(android_src)/$(call intermediates-dir-for, STATIC_LIBRARIES, libvpx_asm_offsets_vpx_scale,,, $(GYP_VAR_PREFIX))/libvpx_asm_offsets_vpx_scale.a',
535 ['(target_arch=="arm" or target_arch=="armv7")', {
536 'output_format': 'gas',
538 'output_format': 'rvds',
545 'ninja_obj_dir': '<(PRODUCT_DIR)/obj/third_party/libvpx/<(libvpx_source)/vpx_scale',
549 'action_name': 'copy_enc_offsets_obj',
550 'inputs': [ 'copy_obj.py' ],
551 'outputs': [ '<(INTERMEDIATE_DIR)/vpx_scale_asm_offsets.obj' ],
554 '<(DEPTH)/third_party/libvpx/copy_obj.py',
555 '-d', '<@(_outputs)',
556 '-s', '<(PRODUCT_DIR)/obj/libvpx_asm_offsets_vpx_scale/vpx_scale_asm_offsets.obj',
557 '-s', '<(ninja_obj_dir)/encoder/libvpx_asm_offsets_vpx_scale.vpx_scale_asm_offsets.obj',
558 '-s', '<(PRODUCT_DIR)/obj/Source/WebKit/chromium/third_party/libvpx/<(libvpx_source)/vpx_scale/libvpx_asm_offsets_vpx_scale.vpx_scale_asm_offsets.obj',
560 'process_output_as_sources': 1,
564 '<(INTERMEDIATE_DIR)/vpx_scale_asm_offsets.obj',
568 'unpack_lib_search_path_list': [
569 '-a', '<(PRODUCT_DIR)/libvpx_asm_offsets_vpx_scale.a',
570 '-a', '<(LIB_DIR)/third_party/libvpx/libvpx_asm_offsets_vpx_scale.a',
571 '-a', '<(LIB_DIR)/Source/WebKit/chromium/third_party/libvpx/libvpx_asm_offsets_vpx_scale.a',
572 '-a', '<(lib_intermediate_name)',
574 'unpack_lib_output_dir':'<(INTERMEDIATE_DIR)',
575 'unpack_lib_name':'vpx_scale_asm_offsets.o'
577 'includes': ['unpack_lib_posix.gypi'],
578 # Need this otherwise gyp won't run the rule on them.
580 '<(INTERMEDIATE_DIR)/vpx_scale_asm_offsets.o',
584 'includes': ['obj_int_extract.gypi'],