1 # -*- Mode: python; 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/.
8 BUG_COMPONENT = ('Core', 'Audio/Video')
10 include('sources.mozbuild')
12 if CONFIG['VPX_USE_NASM']:
15 # Linux, Mac and Win share file lists for x86* but not configurations.
16 if CONFIG['TARGET_CPU'] == 'x86_64':
17 if CONFIG['OS_TARGET'] == 'WINNT':
18 EXPORTS.vpx += files['WIN_X64_EXPORTS']
19 SOURCES += files['WIN_X64_SOURCES']
20 ASFLAGS += [ '-I%s/media/libvpx/config/win/x64/' % TOPSRCDIR ]
21 LOCAL_INCLUDES += [ '/media/libvpx/config/win/x64/' ]
22 elif CONFIG['OS_TARGET'] == 'Darwin':
23 EXPORTS.vpx += files['MAC_X64_EXPORTS']
24 SOURCES += files['MAC_X64_SOURCES']
25 ASFLAGS += [ '-I%s/media/libvpx/config/mac/x64/' % TOPSRCDIR ]
26 LOCAL_INCLUDES += [ '/media/libvpx/config/mac/x64/' ]
27 else: # Android, Linux, BSDs, etc.
28 EXPORTS.vpx += files['LINUX_X64_EXPORTS']
29 SOURCES += files['LINUX_X64_SOURCES']
30 ASFLAGS += [ '-I%s/media/libvpx/config/linux/x64/' % TOPSRCDIR ]
31 LOCAL_INCLUDES += [ '/media/libvpx/config/linux/x64/' ]
32 elif CONFIG['TARGET_CPU'] == 'x86':
33 if CONFIG['OS_TARGET'] == 'WINNT':
34 EXPORTS.vpx += files['WIN_IA32_EXPORTS']
35 SOURCES += files['WIN_IA32_SOURCES']
36 ASFLAGS += [ '-I%s/media/libvpx/config/win/ia32/' % TOPSRCDIR ]
37 LOCAL_INCLUDES += [ '/media/libvpx/config/win/ia32/' ]
38 elif CONFIG['OS_TARGET'] == 'Darwin':
39 EXPORTS.vpx += files['MAC_IA32_EXPORTS']
40 SOURCES += files['MAC_IA32_SOURCES']
41 ASFLAGS += [ '-I%s/media/libvpx/config/mac/ia32/' % TOPSRCDIR ]
42 LOCAL_INCLUDES += [ '/media/libvpx/config/mac/ia32/' ]
43 else: # Android, Linux, BSDs, etc.
44 EXPORTS.vpx += files['LINUX_IA32_EXPORTS']
45 SOURCES += files['LINUX_IA32_SOURCES']
46 ASFLAGS += [ '-I%s/media/libvpx/config/linux/ia32/' % TOPSRCDIR ]
47 LOCAL_INCLUDES += [ '/media/libvpx/config/linux/ia32/' ]
48 elif CONFIG['TARGET_CPU'] == 'arm':
49 EXPORTS.vpx += files['LINUX_ARM_EXPORTS']
51 '-I%s/media/libvpx/config/linux/arm/' % TOPSRCDIR,
52 '-I%s/libvpx' % OBJDIR,
54 LOCAL_INCLUDES += [ '/media/libvpx/config/linux/arm/' ]
56 arm_asm_files = files['LINUX_ARM_SOURCES']
60 "!%s.S" % f if f.endswith('.asm') else f for f in arm_asm_files
63 SOURCES += sorted(arm_asm_files)
66 if f.endswith('.c') and 'neon' in f:
67 SOURCES[f].flags += CONFIG['VPX_ASFLAGS']
69 if CONFIG['OS_TARGET'] == 'Android':
72 '%%%s/sources/android/cpufeatures' % CONFIG['ANDROID_NDK'],
74 elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['OS_TARGET'] == 'WINNT':
75 EXPORTS.vpx += files['WIN_AARCH64_EXPORTS']
76 SOURCES += files['WIN_AARCH64_SOURCES']
77 ASFLAGS += [ '-I%s/media/libvpx/config/win/aarch64/' % TOPSRCDIR ]
78 LOCAL_INCLUDES += [ '/media/libvpx/config/win/aarch64/' ]
79 elif CONFIG['TARGET_CPU'] == 'aarch64':
80 EXPORTS.vpx += files['LINUX_ARM64_EXPORTS']
81 SOURCES += files['LINUX_ARM64_SOURCES']
82 ASFLAGS += [ '-I%s/media/libvpx/config/linux/arm64/' % TOPSRCDIR ]
83 LOCAL_INCLUDES += [ '/media/libvpx/config/linux/arm64/' ]
85 # Generic C-only configuration
86 EXPORTS.vpx += files['GENERIC_EXPORTS']
87 SOURCES += files['GENERIC_SOURCES']
88 ASFLAGS += [ '-I%s/media/libvpx/config/generic/' % TOPSRCDIR ]
89 LOCAL_INCLUDES += [ '/media/libvpx/config/generic/' ]
91 # We allow warnings for third-party code that can be updated from upstream.
92 AllowCompilerWarnings()
94 FINAL_LIBRARY = 'gkcodecs'
97 DEFINES['HAVE_CONFIG_H'] = 'vpx_config.h'
99 if CONFIG['OS_TARGET'] == 'Android':
100 # Older versions of the Android NDK don't pre-define anything to indicate
101 # the OS they're on, so do it for them.
102 DEFINES['__linux__'] = True
105 '%%%s/sources/android/cpufeatures/cpu-features.c' % CONFIG['ANDROID_NDK'],
111 SOURCES[f].flags += ['-mmmx']
113 SOURCES[f].flags += CONFIG['SSE2_FLAGS']
115 SOURCES[f].flags += ['-mssse3']
117 SOURCES[f].flags += ['-msse4.1']
119 SOURCES[f].flags += ['-mavx']
121 SOURCES[f].flags += ['-mavx2']
122 if 'neon_dotprod.c' in f:
123 SOURCES[f].flags += ['-march=armv8.2-a+dotprod']
124 if 'neon_i8mm.c' in f:
125 SOURCES[f].flags += ['-march=armv8.2-a+dotprod+i8mm']
127 SOURCES[f].flags += ['-march=armv8.2-a+dotprod+i8mm+sve']
129 SOURCES[f].flags += ['-march=armv9-a+sve2']
131 # Suppress warnings in third-party code.
134 '-Wno-unused-function', # so many of these warnings; just ignore them
136 if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
138 '-Wno-unreachable-code',
139 '-Wno-unneeded-internal-declaration',
142 ASFLAGS += CONFIG['VPX_ASFLAGS']
145 '-I%s/media/libvpx/libvpx/' % TOPSRCDIR,
149 '/media/libvpx/config', # vpx_version.h
150 '/media/libvpx/libvpx',
153 if CONFIG['OS_TARGET'] == 'Android':