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',
20 ['OS=="android" and ((target_arch=="arm" or target_arch=="armv7") and arm_neon==0)', {
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" or target_arch=="armv7") and arm_neon==0 and OS=="android"', {
53 # When building for targets which may not have NEON (but may!), include
54 # support for neon and hide it behind Android cpu-features.
55 'includes': ['libvpx_srcs_arm_neon_cpu_detect_intrinsics.gypi', ],
57 [ '(target_arch != "arm" and target_arch != "armv7") and target_arch != "mipsel"', {
60 # This libvpx target contains both encoder and decoder.
61 # Encoder is configured to be realtime only.
62 'target_name': 'libvpx',
63 'type': 'static_library',
65 'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
66 'OS_CATEGORY%': '<(OS_CATEGORY)',
69 '-I', 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
70 '-I', 'source/config',
71 '-I', '<(libvpx_source)',
72 '-I', '<(shared_generated_dir)', # Generated assembly offsets
76 'gen_asm_offsets_vp8',
79 '../yasm/yasm_compile.gypi'
82 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
85 '<(libvpx_source)/vp8/common',
86 '<(libvpx_source)/vp8/decoder',
87 '<(libvpx_source)/vp8/encoder',
88 '<(shared_generated_dir)', # Provides vpx_rtcd.h.
90 'direct_dependent_settings': {
95 # VS2010 does not correctly incrementally link obj files generated
96 # from asm files. This flag disables UseLibraryDependencyInputs to
98 'msvs_2010_disable_uldi_when_referenced': 1,
100 ['target_arch=="ia32"', {
102 'libvpx_srcs_x86.gypi',
105 'libvpx_intrinsics_mmx',
106 'libvpx_intrinsics_sse2',
107 # Currently no sse3 intrinsic functions
108 #'libvpx_intrinsics_sse3',
109 'libvpx_intrinsics_ssse3',
110 # Currently no sse4_1 intrinsic functions
111 #'libvpx_intrinsics_sse4_1',
112 # Currently no avx intrinsic functions
113 #'libvpx_intrinsics_avx',
114 # Add avx2 support when VS2013 lands: crbug.com/328981
115 #'libvpx_intrinsics_avx2',
118 ['target_arch=="x64"', {
120 'libvpx_srcs_x86_64.gypi',
123 'libvpx_intrinsics_mmx',
124 'libvpx_intrinsics_sse2',
125 # Currently no sse3 intrinsic functions
126 #'libvpx_intrinsics_sse3',
127 'libvpx_intrinsics_ssse3',
128 # Currently no sse4_1 intrinsic functions
129 #'libvpx_intrinsics_sse4_1',
130 # Currently no avx intrinsic functions
131 #'libvpx_intrinsics_avx',
132 # Add avx2 support when VS2013 lands: crbug.com/328981
133 #'libvpx_intrinsics_avx2',
139 # libvpx heavily relies on implicit enum casting.
141 # libvpx does `if ((a == b))` in some places.
142 '-Wno-parentheses-equality',
147 '-Wno-parentheses-equality',
151 # ChromeOS needs these files for animated WebM avatars.
153 '<(libvpx_source)/third_party/libmkv/EbmlIDs.h',
154 '<(libvpx_source)/third_party/libmkv/EbmlWriter.c',
155 '<(libvpx_source)/third_party/libmkv/EbmlWriter.h',
163 # 'libvpx' target for mips builds.
164 [ 'target_arch=="mipsel" ', {
167 # This libvpx target contains both encoder and decoder.
168 # Encoder is configured to be realtime only.
169 'target_name': 'libvpx',
170 'type': 'static_library',
172 'shared_generated_dir':
173 '<(SHARED_INTERMEDIATE_DIR)/third_party/libvpx',
176 'libvpx_srcs_mips.gypi',
179 '-EL -static -mips32',
182 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
185 '<(libvpx_source)/vp8/common',
186 '<(libvpx_source)/vp8/decoder',
187 '<(libvpx_source)/vp8/encoder',
189 'direct_dependent_settings': {
195 'source/config/<(OS_CATEGORY)/<(target_arch_full)/vpx_config.c',
201 # 'libvpx' target for ARM builds.
202 [ '(target_arch=="arm" or target_arch=="armv7") ', {
205 # This libvpx target contains both encoder and decoder.
206 # Encoder is configured to be realtime only.
207 'target_name': 'libvpx',
208 'type': 'static_library',
210 'gen_asm_offsets_vp8',
211 'gen_asm_offsets_vpx_scale',
214 # Copy the script to the output folder so that we can use it with
217 'destination': '<(shared_generated_dir)',
219 '<(ads2gas_script_path)',
220 '<(ads2gas_script_include)',
224 # Rule to convert .asm files to .S files.
227 'rule_name': 'convert_asm',
230 '<(shared_generated_dir)/<(ads2gas_script)',
231 '<(shared_generated_dir)/thumb.pm',
234 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).S',
239 'cat <(RULE_INPUT_PATH) | perl <(shared_generated_dir)/<(ads2gas_script) -chromium > <(shared_generated_dir)/<(RULE_INPUT_ROOT).S',
241 'process_outputs_as_sources': 1,
242 'message': 'Convert libvpx asm file for ARM <(RULE_INPUT_PATH)',
250 'ads2gas_script%': 'ads2gas_apple.pl',
252 'ads2gas_script%': 'ads2gas.pl',
256 'ads2gas_script%': '<(ads2gas_script)',
257 # Location of the assembly conversion script.
258 'ads2gas_script_path': '<(libvpx_source)/build/make/<(ads2gas_script)',
259 'ads2gas_script_include': '<(libvpx_source)/build/make/thumb.pm',
261 # We need to explicitly tell the assembler to look for
262 # .include directive files from the place where they're
265 '-Wa,-I,<!(pwd)/source/config/<(OS_CATEGORY)/<(target_arch_full)',
266 '-Wa,-I,<!(pwd)/source/config',
267 '-Wa,-I,<(shared_generated_dir)',
271 '-I<!(pwd)/source/config/<(OS_CATEGORY)/<(target_arch_full)',
272 '-I<!(pwd)/source/config',
273 '-I<(shared_generated_dir)',
277 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
281 'direct_dependent_settings': {
287 # Libvpx optimizations for ARMv6 or ARMv7 without NEON.
292 'libvpx_srcs_arm_neon_cpu_detect.gypi',
295 'libvpx_intrinsics_neon',
302 'libvpx_srcs_arm.gypi',
307 # Libvpx optimizations for ARMv7 with NEON.
310 'libvpx_srcs_arm_neon.gypi',
313 ['OS == "android"', {
315 '../../build/android/cpufeatures.gypi',
319 # ChromeOS needs these files for animated WebM avatars.
321 '<(libvpx_source)/third_party/libmkv/EbmlIDs.h',
322 '<(libvpx_source)/third_party/libmkv/EbmlWriter.c',
323 '<(libvpx_source)/third_party/libmkv/EbmlWriter.h',
333 # A tool that runs on host to extract integers from object file.
334 'target_name': 'libvpx_obj_int_extract',
335 'type': 'executable',
336 'toolsets': ['host'],
338 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
343 '<(libvpx_source)/build/make/obj_int_extract.c',
347 # A library that contains assembly offsets needed.
348 'target_name': 'libvpx_asm_offsets_vp8',
349 'type': 'static_library',
350 'android_unmangled_name': 1,
351 'hard_dependency': 1,
353 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
359 'cflags!': [ '-fsanitize=address' ],
360 'xcode_settings': { 'OTHER_CFLAGS!': [ '-fsanitize=address' ] },
361 'ldflags!': [ '-fsanitize=address' ],
365 '<(libvpx_source)/vp8/encoder/vp8_asm_enc_offsets.c',
369 # A library that contains assembly offsets needed.
370 # TODO(fgalligan): Merge libvpx_asm_offsets_vpx_scale into
371 # libvpx_asm_offsets.
372 'target_name': 'libvpx_asm_offsets_vpx_scale',
373 'type': 'static_library',
374 'android_unmangled_name': 1,
375 'hard_dependency': 1,
377 'source/config/<(OS_CATEGORY)/<(target_arch_full)',
383 'cflags!': [ '-faddress-sanitizer', '-fsanitize=address', ],
385 'OTHER_CFLAGS!': [ '-faddress-sanitizer','-fsanitize=address' ],
387 'ldflags!': [ '-faddress-sanitizer', '-fsanitize=address', ],
391 '<(libvpx_source)/vpx_scale/vpx_scale_asm_offsets.c',
395 # A target that takes assembly offsets library and generate the
396 # corresponding assembly files.
397 # This target is a hard dependency because the generated .asm files
398 # are needed all assembly optimized files in libvpx.
399 'target_name': 'gen_asm_offsets_vp8',
401 'hard_dependency': 1,
403 'libvpx_asm_offsets_vp8',
404 'libvpx_obj_int_extract#host',
407 'lib_intermediate_name' : '',
409 'output_dir': '<(shared_generated_dir)',
411 ['android_webview_build==1', {
412 'lib_intermediate_name' : '<(android_src)/$(call intermediates-dir-for, STATIC_LIBRARIES, libvpx_asm_offsets_vp8)/libvpx_asm_offsets_vp8.a',
414 ['(target_arch=="arm" or target_arch=="armv7")', {
415 'output_format': 'gas',
417 'output_format': 'rvds',
424 'ninja_obj_dir': '<(PRODUCT_DIR)/obj/third_party/libvpx/<(libvpx_source)/vp8',
428 'action_name': 'copy_enc_offsets_obj',
429 'inputs': [ 'copy_obj.py' ],
430 'outputs': [ '<(INTERMEDIATE_DIR)/vp8_asm_enc_offsets.obj' ],
433 '<(DEPTH)/third_party/libvpx/copy_obj.py',
434 '-d', '<@(_outputs)',
435 '-s', '<(PRODUCT_DIR)/obj/libvpx_asm_offsets_vp8/vp8_asm_enc_offsets.obj',
436 '-s', '<(ninja_obj_dir)/encoder/libvpx_asm_offsets_vp8.vp8_asm_enc_offsets.obj',
437 '-s', '<(PRODUCT_DIR)/obj/Source/WebKit/chromium/third_party/libvpx/<(libvpx_source)/vp8/encoder/libvpx_asm_offsets_vp8.vp8_asm_enc_offsets.obj',
439 'process_output_as_sources': 1,
443 '<(INTERMEDIATE_DIR)/vp8_asm_enc_offsets.obj',
447 'unpack_lib_search_path_list': [
448 '-a', '<(PRODUCT_DIR)/libvpx_asm_offsets_vp8.a',
449 '-a', '<(LIB_DIR)/third_party/libvpx/libvpx_asm_offsets_vp8.a',
450 '-a', '<(LIB_DIR)/Source/WebKit/chromium/third_party/libvpx/libvpx_asm_offsets_vp8.a',
451 '-a', '<(lib_intermediate_name)',
453 'unpack_lib_output_dir':'<(INTERMEDIATE_DIR)',
454 'unpack_lib_name':'vp8_asm_enc_offsets.o'
456 'includes': ['unpack_lib_posix.gypi'],
457 # Need this otherwise gyp won't run the rule on them.
459 '<(INTERMEDIATE_DIR)/vp8_asm_enc_offsets.o',
463 'includes': ['obj_int_extract.gypi'],
466 # A target that takes assembly offsets library and generate the
467 # corresponding assembly files.
468 # This target is a hard dependency because the generated .asm files
469 # are needed all assembly optimized files in libvpx.
470 'target_name': 'gen_asm_offsets_vpx_scale',
472 'hard_dependency': 1,
474 'libvpx_asm_offsets_vpx_scale',
475 'libvpx_obj_int_extract#host',
478 'lib_intermediate_name' : '',
480 'output_dir': '<(shared_generated_dir)',
482 ['android_webview_build==1', {
483 'lib_intermediate_name' : '<(android_src)/$(call intermediates-dir-for, STATIC_LIBRARIES, libvpx_asm_offsets_vpx_scale)/libvpx_asm_offsets_vpx_scale.a',
485 ['(target_arch=="arm" or target_arch=="armv7")', {
486 'output_format': 'gas',
488 'output_format': 'rvds',
495 'ninja_obj_dir': '<(PRODUCT_DIR)/obj/third_party/libvpx/<(libvpx_source)/vpx_scale',
499 'action_name': 'copy_enc_offsets_obj',
500 'inputs': [ 'copy_obj.py' ],
501 'outputs': [ '<(INTERMEDIATE_DIR)/vpx_scale_asm_offsets.obj' ],
504 '<(DEPTH)/third_party/libvpx/copy_obj.py',
505 '-d', '<@(_outputs)',
506 '-s', '<(PRODUCT_DIR)/obj/libvpx_asm_offsets_vpx_scale/vpx_scale_asm_offsets.obj',
507 '-s', '<(ninja_obj_dir)/encoder/libvpx_asm_offsets_vpx_scale.vpx_scale_asm_offsets.obj',
508 '-s', '<(PRODUCT_DIR)/obj/Source/WebKit/chromium/third_party/libvpx/<(libvpx_source)/vpx_scale/libvpx_asm_offsets_vpx_scale.vpx_scale_asm_offsets.obj',
510 'process_output_as_sources': 1,
514 '<(INTERMEDIATE_DIR)/vpx_scale_asm_offsets.obj',
518 'unpack_lib_search_path_list': [
519 '-a', '<(PRODUCT_DIR)/libvpx_asm_offsets_vpx_scale.a',
520 '-a', '<(LIB_DIR)/third_party/libvpx/libvpx_asm_offsets_vpx_scale.a',
521 '-a', '<(LIB_DIR)/Source/WebKit/chromium/third_party/libvpx/libvpx_asm_offsets_vpx_scale.a',
522 '-a', '<(lib_intermediate_name)',
524 'unpack_lib_output_dir':'<(INTERMEDIATE_DIR)',
525 'unpack_lib_name':'vpx_scale_asm_offsets.o'
527 'includes': ['unpack_lib_posix.gypi'],
528 # Need this otherwise gyp won't run the rule on them.
530 '<(INTERMEDIATE_DIR)/vpx_scale_asm_offsets.o',
534 'includes': ['obj_int_extract.gypi'],