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':
75 if CONFIG['OS_TARGET'] == 'WINNT':
76 EXPORTS.vpx += files['WIN_AARCH64_EXPORTS']
77 SOURCES += files['WIN_AARCH64_SOURCES']
78 ASFLAGS += [ '-I%s/media/libvpx/config/win/aarch64/' % TOPSRCDIR ]
79 LOCAL_INCLUDES += [ '/media/libvpx/config/win/aarch64/' ]
80 elif CONFIG['OS_TARGET'] == 'Darwin':
81 EXPORTS.vpx += files['MAC_ARM64_EXPORTS']
82 SOURCES += files['MAC_ARM64_SOURCES']
83 ASFLAGS += [ '-I%s/media/libvpx/config/mac/arm64/' % TOPSRCDIR ]
84 LOCAL_INCLUDES += [ '/media/libvpx/config/mac/arm64/' ]
85 else: # Android, Linux, BSDs, etc.
86 EXPORTS.vpx += files['LINUX_ARM64_EXPORTS']
87 SOURCES += files['LINUX_ARM64_SOURCES']
88 ASFLAGS += [ '-I%s/media/libvpx/config/linux/arm64/' % TOPSRCDIR ]
89 LOCAL_INCLUDES += [ '/media/libvpx/config/linux/arm64/' ]
91 # Generic C-only configuration
92 EXPORTS.vpx += files['GENERIC_EXPORTS']
93 SOURCES += files['GENERIC_SOURCES']
94 ASFLAGS += [ '-I%s/media/libvpx/config/generic/' % TOPSRCDIR ]
95 LOCAL_INCLUDES += [ '/media/libvpx/config/generic/' ]
97 # We allow warnings for third-party code that can be updated from upstream.
98 AllowCompilerWarnings()
100 FINAL_LIBRARY = 'gkcodecs'
103 DEFINES['HAVE_CONFIG_H'] = 'vpx_config.h'
105 if CONFIG['OS_TARGET'] == 'Android':
106 # Older versions of the Android NDK don't pre-define anything to indicate
107 # the OS they're on, so do it for them.
108 DEFINES['__linux__'] = True
111 '%%%s/sources/android/cpufeatures/cpu-features.c' % CONFIG['ANDROID_NDK'],
117 SOURCES[f].flags += ['-mmmx']
119 SOURCES[f].flags += CONFIG['SSE2_FLAGS']
121 SOURCES[f].flags += ['-mssse3']
123 SOURCES[f].flags += ['-msse4.1']
125 SOURCES[f].flags += ['-mavx']
127 SOURCES[f].flags += ['-mavx2']
128 if 'neon_dotprod.c' in f:
129 SOURCES[f].flags += ['-march=armv8.2-a+dotprod']
130 if 'neon_i8mm.c' in f:
131 SOURCES[f].flags += ['-march=armv8.2-a+dotprod+i8mm']
133 SOURCES[f].flags += ['-march=armv8.2-a+dotprod+i8mm+sve']
135 SOURCES[f].flags += ['-march=armv9-a+sve2']
137 # Suppress warnings in third-party code.
140 '-Wno-unused-function', # so many of these warnings; just ignore them
142 if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
144 '-Wno-unreachable-code',
145 '-Wno-unneeded-internal-declaration',
148 ASFLAGS += CONFIG['VPX_ASFLAGS']
151 '-I%s/media/libvpx/libvpx/' % TOPSRCDIR,
155 '/media/libvpx/config', # vpx_version.h
156 '/media/libvpx/libvpx',
159 if CONFIG['OS_TARGET'] == 'Android':