1 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 include('sources.mozbuild')
9 EXPORTS.vpx += files['EXPORTS']
11 if CONFIG['VPX_NEED_OBJ_INT_EXTRACT']:
13 'build/make/obj_int_extract.c',
16 HostProgram('host_obj_int_extract')
18 # Unify fewer files together to reduce the chance of name collision
19 FILES_PER_UNIFIED_FILE = 8
21 SOURCES += files['SOURCES']
22 UNIFIED_SOURCES += files['UNIFIED_SOURCES']
24 if CONFIG['MOZ_VPX_ERROR_CONCEALMENT']:
25 SOURCES += files['ERROR_CONCEALMENT']
27 if CONFIG['VPX_X86_ASM'] and CONFIG['OS_TARGET'] == 'WINNT':
29 'vp8/encoder/vp8_asm_enc_offsets.c',
30 'vpx_scale/vpx_scale_asm_offsets.c',
32 SOURCES += offset_sources
33 # Bug 934984 - MSVC bustage when /GL is specified
34 if CONFIG['_MSC_VER']:
35 for s in offset_sources:
36 SOURCES[s].flags += ['-GL-']
38 if CONFIG['VPX_X86_ASM']:
39 SOURCES += files['X86_ASM']
41 if '64' in CONFIG['OS_TEST']:
42 SOURCES += files['X86-64_ASM']
44 # AVX2 only supported on
45 # Darwin and mingw toolchains right now
46 if CONFIG['OS_TARGET'] == 'Darwin' or (CONFIG['OS_TARGET'] == 'WINNT' and CONFIG['GNU_CC']):
47 SOURCES += files['AVX2']
49 #postproc is only enabled on x86 with asm
50 SOURCES += files['VP8_POSTPROC']
53 if CONFIG['VPX_ARM_ASM']:
54 arm_asm_files += files['ARM_ASM']
56 if CONFIG['VPX_AS_CONVERSION']:
57 GENERATED_SOURCES += [ "%s.%s" % (f, CONFIG['VPX_ASM_SUFFIX'])
58 for f in sorted(arm_asm_files) if f.endswith('.asm')
61 f for f in sorted(arm_asm_files) if not f.endswith('.asm')
64 SOURCES += sorted(arm_asm_files)
67 if f.endswith('.c') and 'neon' in f:
68 SOURCES[f].flags += ['-march=armv7-a', '-mthumb', '-mfloat-abi=softfp', '-mfpu=neon']
70 # boolhuff_armv5te.asm defines the same functions as boolhuff.c instead of
71 # using RTCD, so we have to make sure we only add one of the two.
72 if 'vp8/encoder/arm/armv5te/boolhuff_armv5te.asm' not in arm_asm_files:
74 'vp8/encoder/boolhuff.c',
77 MSVC_ENABLE_PGO = True
79 if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
80 NO_VISIBILITY_FLAGS = True
82 FINAL_LIBRARY = 'gkmedias'
84 DEFINES['HAVE_CONFIG_H'] = 'vpx_config.h'
86 if CONFIG['OS_TARGET'] == 'Android':
87 # Older versions of the Android NDK don't pre-define anything to indicate
88 # the OS they're on, so do it for them.
89 DEFINES['__linux__'] = True
91 if not CONFIG['MOZ_WEBRTC']:
93 '%s/sources/android/cpufeatures/cpu-features.c' % CONFIG['ANDROID_NDK'],
96 if CONFIG['CLANG_CL'] or not CONFIG['_MSC_VER']:
100 SOURCES[f].flags += CONFIG['SSE2_FLAGS']
102 SOURCES[f].flags += ['-mssse3']
104 SOURCES[f].flags += ['-msse4.1']
106 SOURCES[f].flags += ['-mavx2']
108 # Suppress warnings in third-party code.
110 CFLAGS += ['-Wno-sign-compare']