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',
16 ['(target_arch=="arm" or target_arch=="armv7") and arm_neon==1', {
17 'target_arch_full': 'arm-neon',
21 'target_arch_full': 'arm-neon-cpu-detect',
23 'target_arch_full': '<(target_arch)',
28 ['os_posix == 1 and OS != "mac"', {
29 'OS_CATEGORY%': 'linux',
31 'OS_CATEGORY%': '<(OS)',
35 # Location of the intermediate output.
36 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
39 'target_conditions': [
40 ['<(libvpx_build_vp9)==0', {
41 'sources/': [ ['exclude', '(^|/)vp9/'], ],
46 ['target_arch=="ia32"', {
47 'includes': ['libvpx_srcs_x86_intrinsics.gypi', ],
49 ['target_arch=="x64"', {
50 'includes': ['libvpx_srcs_x86_64_intrinsics.gypi', ],
52 [ '(target_arch != "arm" and target_arch != "armv7") and target_arch != "mipsel"', {
55 # This libvpx target contains both encoder and decoder.
56 # Encoder is configured to be realtime only.
57 'target_name': 'libvpx',
58 'type': 'static_library',
60 'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
61 'OS_CATEGORY%': '<(OS_CATEGORY)',
64 '-I', 'source/config/<(OS_CATEGORY)/<(target_arch)',
65 '-I', 'source/config',
66 '-I', '<(libvpx_source)',
67 '-I', '<(shared_generated_dir)', # Generated assembly offsets
71 'gen_asm_offsets_vp8',
74 '../yasm/yasm_compile.gypi'
77 'source/config/<(OS_CATEGORY)/<(target_arch)',
80 '<(libvpx_source)/vp8/common',
81 '<(libvpx_source)/vp8/decoder',
82 '<(libvpx_source)/vp8/encoder',
83 '<(shared_generated_dir)', # Provides vpx_rtcd.h.
85 'direct_dependent_settings': {
90 # VS2010 does not correctly incrementally link obj files generated
91 # from asm files. This flag disables UseLibraryDependencyInputs to
93 'msvs_2010_disable_uldi_when_referenced': 1,
95 ['target_arch=="ia32"', {
97 'libvpx_srcs_x86.gypi',
100 'libvpx_intrinsics_mmx',
101 'libvpx_intrinsics_sse2',
102 # Currently no sse3 intrinsic functions
103 #'libvpx_intrinsics_sse3',
104 'libvpx_intrinsics_ssse3',
105 # Currently no sse4_1 intrinsic functions
106 #'libvpx_intrinsics_sse4_1',
109 ['target_arch=="x64"', {
111 'libvpx_srcs_x86_64.gypi',
114 'libvpx_intrinsics_mmx',
115 'libvpx_intrinsics_sse2',
116 # Currently no sse3 intrinsic functions
117 #'libvpx_intrinsics_sse3',
118 'libvpx_intrinsics_ssse3',
119 # Currently no sse4_1 intrinsic functions
120 #'libvpx_intrinsics_sse4_1',
126 # libvpx heavily relies on implicit enum casting.
128 # libvpx does `if ((a == b))` in some places.
129 '-Wno-parentheses-equality',
134 '-Wno-parentheses-equality',
138 # ChromeOS needs these files for animated WebM avatars.
140 '<(libvpx_source)/third_party/libmkv/EbmlIDs.h',
141 '<(libvpx_source)/third_party/libmkv/EbmlWriter.c',
142 '<(libvpx_source)/third_party/libmkv/EbmlWriter.h',
150 # 'libvpx' target for mips builds.
151 [ 'target_arch=="mipsel" ', {
154 # This libvpx target contains both encoder and decoder.
155 # Encoder is configured to be realtime only.
156 'target_name': 'libvpx',
157 'type': 'static_library',
159 'shared_generated_dir':
160 '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
163 'libvpx_srcs_mips.gypi',
166 '-EL -static -mips32',
169 'source/config/<(OS_CATEGORY)/<(target_arch)',
172 '<(libvpx_source)/vp8/common',
173 '<(libvpx_source)/vp8/decoder',
174 '<(libvpx_source)/vp8/encoder',
176 'direct_dependent_settings': {
182 'source/config/<(OS_CATEGORY)/<(target_arch)/vpx_config.c',
188 # 'libvpx' target for ARM builds.
189 [ '(target_arch=="arm" or target_arch=="armv7") ', {
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 'gen_asm_offsets_vp8',
198 'gen_asm_offsets_vpx_scale',
201 # Copy the script to the output folder so that we can use it with
204 'destination': '<(shared_generated_dir)',
206 '<(ads2gas_script_path)',
207 '<(ads2gas_script_include)',
211 # Rule to convert .asm files to .S files.
214 'rule_name': 'convert_asm',
217 '<(shared_generated_dir)/<(ads2gas_script)',
218 '<(shared_generated_dir)/thumb.pm',
221 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).S',
226 'cat <(RULE_INPUT_PATH) | perl <(shared_generated_dir)/<(ads2gas_script) > <(shared_generated_dir)/<(RULE_INPUT_ROOT).S',
228 'process_outputs_as_sources': 1,
229 'message': 'Convert libvpx asm file for ARM <(RULE_INPUT_PATH).',
237 'ads2gas_script%': 'ads2gas_apple.pl',
239 'ads2gas_script%': 'ads2gas.pl',
243 'ads2gas_script%': '<(ads2gas_script)',
244 # Location of the assembly conversion script.
245 'ads2gas_script_path': '<(libvpx_source)/build/make/<(ads2gas_script)',
246 'ads2gas_script_include': '<(libvpx_source)/build/make/thumb.pm',
248 # We need to explicitly tell the assembler to look for
249 # .include directive files from the place where they're
252 '-Wa,-I,<!(pwd)/source/config/<(OS_CATEGORY)/<(target_arch_full)',
253 '-Wa,-I,<!(pwd)/source/config',
254 '-Wa,-I,<(shared_generated_dir)',
258 '-I<!(pwd)/source/config/<(OS_CATEGORY)/<(target_arch_full)',
259 '-I<!(pwd)/source/config',
260 '-I<(shared_generated_dir)',
264 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
268 'direct_dependent_settings': {
274 # Libvpx optimizations for ARMv6 or ARMv7 without NEON.
279 'libvpx_srcs_arm_neon_cpu_detect.gypi',
286 'libvpx_srcs_arm.gypi',
291 # Libvpx optimizations for ARMv7 with NEON.
294 'libvpx_srcs_arm_neon.gypi',
297 ['OS == "android"', {
299 '<(android_ndk_include)',
300 '<(android_ndk_root)/sources/android/cpufeatures',
304 # ChromeOS needs these files for animated WebM avatars.
306 '<(libvpx_source)/third_party/libmkv/EbmlIDs.h',
307 '<(libvpx_source)/third_party/libmkv/EbmlWriter.c',
308 '<(libvpx_source)/third_party/libmkv/EbmlWriter.h',
318 # A tool that runs on host to extract integers from object file.
319 'target_name': 'libvpx_obj_int_extract',
320 'type': 'executable',
321 'toolsets': ['host'],
323 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
328 '<(libvpx_source)/build/make/obj_int_extract.c',
332 # A library that contains assembly offsets needed.
333 'target_name': 'libvpx_asm_offsets_vp8',
334 'type': 'static_library',
335 'hard_dependency': 1,
337 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
343 'cflags!': [ '-fsanitize=address' ],
344 'xcode_settings': { 'OTHER_CFLAGS!': [ '-fsanitize=address' ] },
345 'ldflags!': [ '-fsanitize=address' ],
349 '<(libvpx_source)/vp8/encoder/vp8_asm_enc_offsets.c',
353 # A library that contains assembly offsets needed.
354 # TODO(fgalligan): Merge libvpx_asm_offsets_vpx_scale into
355 # libvpx_asm_offsets.
356 'target_name': 'libvpx_asm_offsets_vpx_scale',
357 'type': 'static_library',
358 'hard_dependency': 1,
360 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
366 'cflags!': [ '-faddress-sanitizer', '-fsanitize=address', ],
368 'OTHER_CFLAGS!': [ '-faddress-sanitizer','-fsanitize=address' ],
370 'ldflags!': [ '-faddress-sanitizer', '-fsanitize=address', ],
374 '<(libvpx_source)/vpx_scale/vpx_scale_asm_offsets.c',
378 # A target that takes assembly offsets library and generate the
379 # corresponding assembly files.
380 # This target is a hard dependency because the generated .asm files
381 # are needed all assembly optimized files in libvpx.
382 'target_name': 'gen_asm_offsets_vp8',
384 'hard_dependency': 1,
386 'libvpx_asm_offsets_vp8',
387 'libvpx_obj_int_extract#host',
392 'ninja_obj_dir': '<(PRODUCT_DIR)/obj/third_party/libvpx/<(libvpx_source)/vp8',
396 'action_name': 'copy_enc_offsets_obj',
397 'inputs': [ 'copy_obj.sh' ],
398 'outputs': [ '<(INTERMEDIATE_DIR)/vp8_asm_enc_offsets.obj' ],
400 '<(DEPTH)/third_party/libvpx/copy_obj.sh',
401 '-d', '<@(_outputs)',
402 '-s', '<(PRODUCT_DIR)/obj/libvpx_asm_offsets_vp8/vp8_asm_enc_offsets.obj',
403 '-s', '<(ninja_obj_dir)/encoder/libvpx_asm_offsets_vp8.vp8_asm_enc_offsets.obj',
404 '-s', '<(PRODUCT_DIR)/obj/Source/WebKit/chromium/third_party/libvpx/<(libvpx_source)/vp8/encoder/libvpx_asm_offsets_vp8.vp8_asm_enc_offsets.obj',
406 'process_output_as_sources': 1,
407 'msvs_cygwin_shell': 1,
411 '<(INTERMEDIATE_DIR)/vp8_asm_enc_offsets.obj',
416 # Take archived .a file and unpack it unto .o files.
417 'action_name': 'unpack_lib_posix',
419 'unpack_lib_posix.sh',
422 '<(INTERMEDIATE_DIR)/vp8_asm_enc_offsets.o',
425 '<(DEPTH)/third_party/libvpx/unpack_lib_posix.sh',
426 '-d', '<(INTERMEDIATE_DIR)',
427 '-a', '<(PRODUCT_DIR)/libvpx_asm_offsets_vp8.a',
428 '-a', '<(LIB_DIR)/third_party/libvpx/libvpx_asm_offsets_vp8.a',
429 '-a', '<(LIB_DIR)/Source/WebKit/chromium/third_party/libvpx/libvpx_asm_offsets_vp8.a',
430 '-f', 'vp8_asm_enc_offsets.o',
432 'process_output_as_sources': 1,
433 'msvs_cygwin_shell': 1,
436 # Need this otherwise gyp won't run the rule on them.
438 '<(INTERMEDIATE_DIR)/vp8_asm_enc_offsets.o',
444 # Rule to extract integer values for each symbol from an object file.
445 'rule_name': 'obj_int_extract',
446 'extension': '<(asm_obj_extension)',
448 '<(PRODUCT_DIR)/libvpx_obj_int_extract',
449 'obj_int_extract.sh',
452 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).asm',
456 ['(target_arch=="arm" or target_arch=="armv7")', {
459 'asm_format': 'rvds',
464 '<(DEPTH)/third_party/libvpx/obj_int_extract.sh',
465 '-e', '<(PRODUCT_DIR)/libvpx_obj_int_extract',
466 '-f', '<(asm_format)',
467 '-b', '<(RULE_INPUT_PATH)',
468 '-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).asm',
470 'message': 'Generate assembly offsets <(RULE_INPUT_PATH).',
471 'msvs_cygwin_shell': 1,
476 # A target that takes assembly offsets library and generate the
477 # corresponding assembly files.
478 # This target is a hard dependency because the generated .asm files
479 # are needed all assembly optimized files in libvpx.
480 'target_name': 'gen_asm_offsets_vpx_scale',
482 'hard_dependency': 1,
484 'libvpx_asm_offsets_vpx_scale',
485 'libvpx_obj_int_extract#host',
490 'ninja_obj_dir': '<(PRODUCT_DIR)/obj/third_party/libvpx/<(libvpx_source)/vpx_scale',
494 'action_name': 'copy_enc_offsets_obj',
495 'inputs': [ 'copy_obj.sh' ],
496 'outputs': [ '<(INTERMEDIATE_DIR)/vpx_scale_asm_offsets.obj' ],
498 '<(DEPTH)/third_party/libvpx/copy_obj.sh',
499 '-d', '<@(_outputs)',
500 '-s', '<(PRODUCT_DIR)/obj/libvpx_asm_offsets_vpx_scale/vpx_scale_asm_offsets.obj',
501 '-s', '<(ninja_obj_dir)/encoder/libvpx_asm_offsets_vpx_scale.vpx_scale_asm_offsets.obj',
502 '-s', '<(PRODUCT_DIR)/obj/Source/WebKit/chromium/third_party/libvpx/<(libvpx_source)/vpx_scale/libvpx_asm_offsets_vpx_scale.vpx_scale_asm_offsets.obj',
504 'process_output_as_sources': 1,
505 'msvs_cygwin_shell': 1,
509 '<(INTERMEDIATE_DIR)/vpx_scale_asm_offsets.obj',
514 # Take archived .a file and unpack it unto .o files.
515 'action_name': 'unpack_lib_posix',
517 'unpack_lib_posix.sh',
520 '<(INTERMEDIATE_DIR)/vpx_scale_asm_offsets.o',
523 '<(DEPTH)/third_party/libvpx/unpack_lib_posix.sh',
524 '-d', '<(INTERMEDIATE_DIR)',
525 '-a', '<(PRODUCT_DIR)/libvpx_asm_offsets_vpx_scale.a',
526 '-a', '<(LIB_DIR)/third_party/libvpx/libvpx_asm_offsets_vpx_scale.a',
527 '-a', '<(LIB_DIR)/Source/WebKit/chromium/third_party/libvpx/libvpx_asm_offsets_vpx_scale.a',
528 '-f', 'vpx_scale_asm_offsets.o',
530 'process_output_as_sources': 1,
533 # Need this otherwise gyp won't run the rule on them.
535 '<(INTERMEDIATE_DIR)/vpx_scale_asm_offsets.o',
541 # Rule to extract integer values for each symbol from an object file.
542 'rule_name': 'obj_int_extract',
543 'extension': '<(asm_obj_extension)',
545 '<(PRODUCT_DIR)/libvpx_obj_int_extract',
546 'obj_int_extract.sh',
549 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).asm',
553 ['(target_arch=="arm" or target_arch=="armv7")', {
556 'asm_format': 'rvds',
561 '<(DEPTH)/third_party/libvpx/obj_int_extract.sh',
562 '-e', '<(PRODUCT_DIR)/libvpx_obj_int_extract',
563 '-f', '<(asm_format)',
564 '-b', '<(RULE_INPUT_PATH)',
565 '-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).asm',
567 'message': 'Generate assembly offsets <(RULE_INPUT_PATH).',
568 'msvs_cygwin_shell': 1,
573 'target_name': 'simple_encoder',
574 'type': 'executable',
579 # Copy the script to the output folder so that we can use it with
582 'destination': '<(shared_generated_dir)/simple_encoder',
584 '<(libvpx_source)/examples/gen_example_code.sh',
588 # Rule to convert .txt files to .c files.
591 'rule_name': 'generate_example',
593 'inputs': [ '<(shared_generated_dir)/simple_encoder/gen_example_code.sh', ],
595 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).c',
600 '<(shared_generated_dir)/simple_encoder/gen_example_code.sh <(RULE_INPUT_PATH) > <(shared_generated_dir)/<(RULE_INPUT_ROOT).c',
602 'process_outputs_as_sources': 1,
603 'message': 'Generate libvpx example code <(RULE_INPUT_PATH).',
607 '<(libvpx_source)/examples/simple_encoder.txt',
611 'target_name': 'simple_decoder',
612 'type': 'executable',
617 # Copy the script to the output folder so that we can use it with
620 'destination': '<(shared_generated_dir)/simple_decoder',
622 '<(libvpx_source)/examples/gen_example_code.sh',
626 # Rule to convert .txt files to .c files.
629 'rule_name': 'generate_example',
631 'inputs': [ '<(shared_generated_dir)/simple_decoder/gen_example_code.sh', ],
633 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).c',
638 '<(shared_generated_dir)/simple_decoder/gen_example_code.sh <(RULE_INPUT_PATH) > <(shared_generated_dir)/<(RULE_INPUT_ROOT).c',
640 'process_outputs_as_sources': 1,
641 'message': 'Generate libvpx example code <(RULE_INPUT_PATH).',
645 '<(libvpx_source)/examples/simple_decoder.txt',