mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
593de4f5fe
This patch introduces platform configurations for macOS/arm64 to our libvpx library. It also updates the moz.build file to ensure the correct building of the code generated by these configurations. Note that the mac/arm64 configuration here doesn't apply realtime-only feature like other arm64 platforms. The realtime-related settings (e.g., lag_in_frames) will be set if needed. Differential Revision: https://phabricator.services.mozilla.com/D209085
164 lines
5.9 KiB
Python
164 lines
5.9 KiB
Python
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
|
# vim: set filetype=python:
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
with Files('*'):
|
|
BUG_COMPONENT = ('Core', 'Audio/Video')
|
|
|
|
include('sources.mozbuild')
|
|
|
|
if CONFIG['VPX_USE_NASM']:
|
|
USE_NASM = True
|
|
|
|
# Linux, Mac and Win share file lists for x86* but not configurations.
|
|
if CONFIG['TARGET_CPU'] == 'x86_64':
|
|
if CONFIG['OS_TARGET'] == 'WINNT':
|
|
EXPORTS.vpx += files['WIN_X64_EXPORTS']
|
|
SOURCES += files['WIN_X64_SOURCES']
|
|
ASFLAGS += [ '-I%s/media/libvpx/config/win/x64/' % TOPSRCDIR ]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/win/x64/' ]
|
|
elif CONFIG['OS_TARGET'] == 'Darwin':
|
|
EXPORTS.vpx += files['MAC_X64_EXPORTS']
|
|
SOURCES += files['MAC_X64_SOURCES']
|
|
ASFLAGS += [ '-I%s/media/libvpx/config/mac/x64/' % TOPSRCDIR ]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/mac/x64/' ]
|
|
else: # Android, Linux, BSDs, etc.
|
|
EXPORTS.vpx += files['LINUX_X64_EXPORTS']
|
|
SOURCES += files['LINUX_X64_SOURCES']
|
|
ASFLAGS += [ '-I%s/media/libvpx/config/linux/x64/' % TOPSRCDIR ]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/linux/x64/' ]
|
|
elif CONFIG['TARGET_CPU'] == 'x86':
|
|
if CONFIG['OS_TARGET'] == 'WINNT':
|
|
EXPORTS.vpx += files['WIN_IA32_EXPORTS']
|
|
SOURCES += files['WIN_IA32_SOURCES']
|
|
ASFLAGS += [ '-I%s/media/libvpx/config/win/ia32/' % TOPSRCDIR ]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/win/ia32/' ]
|
|
elif CONFIG['OS_TARGET'] == 'Darwin':
|
|
EXPORTS.vpx += files['MAC_IA32_EXPORTS']
|
|
SOURCES += files['MAC_IA32_SOURCES']
|
|
ASFLAGS += [ '-I%s/media/libvpx/config/mac/ia32/' % TOPSRCDIR ]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/mac/ia32/' ]
|
|
else: # Android, Linux, BSDs, etc.
|
|
EXPORTS.vpx += files['LINUX_IA32_EXPORTS']
|
|
SOURCES += files['LINUX_IA32_SOURCES']
|
|
ASFLAGS += [ '-I%s/media/libvpx/config/linux/ia32/' % TOPSRCDIR ]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/linux/ia32/' ]
|
|
elif CONFIG['TARGET_CPU'] == 'arm':
|
|
EXPORTS.vpx += files['LINUX_ARM_EXPORTS']
|
|
ASFLAGS += [
|
|
'-I%s/media/libvpx/config/linux/arm/' % TOPSRCDIR,
|
|
'-I%s/libvpx' % OBJDIR,
|
|
]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/linux/arm/' ]
|
|
|
|
arm_asm_files = files['LINUX_ARM_SOURCES']
|
|
|
|
if CONFIG['GNU_AS']:
|
|
SOURCES += sorted([
|
|
"!%s.S" % f if f.endswith('.asm') else f for f in arm_asm_files
|
|
])
|
|
else:
|
|
SOURCES += sorted(arm_asm_files)
|
|
|
|
for f in SOURCES:
|
|
if f.endswith('.c') and 'neon' in f:
|
|
SOURCES[f].flags += CONFIG['VPX_ASFLAGS']
|
|
|
|
if CONFIG['OS_TARGET'] == 'Android':
|
|
# For cpu-features.h
|
|
LOCAL_INCLUDES += [
|
|
'%%%s/sources/android/cpufeatures' % CONFIG['ANDROID_NDK'],
|
|
]
|
|
elif CONFIG['TARGET_CPU'] == 'aarch64':
|
|
if CONFIG['OS_TARGET'] == 'WINNT':
|
|
EXPORTS.vpx += files['WIN_AARCH64_EXPORTS']
|
|
SOURCES += files['WIN_AARCH64_SOURCES']
|
|
ASFLAGS += [ '-I%s/media/libvpx/config/win/aarch64/' % TOPSRCDIR ]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/win/aarch64/' ]
|
|
elif CONFIG['OS_TARGET'] == 'Darwin':
|
|
EXPORTS.vpx += files['MAC_ARM64_EXPORTS']
|
|
SOURCES += files['MAC_ARM64_SOURCES']
|
|
ASFLAGS += [ '-I%s/media/libvpx/config/mac/arm64/' % TOPSRCDIR ]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/mac/arm64/' ]
|
|
else: # Android, Linux, BSDs, etc.
|
|
EXPORTS.vpx += files['LINUX_ARM64_EXPORTS']
|
|
SOURCES += files['LINUX_ARM64_SOURCES']
|
|
ASFLAGS += [ '-I%s/media/libvpx/config/linux/arm64/' % TOPSRCDIR ]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/linux/arm64/' ]
|
|
else:
|
|
# Generic C-only configuration
|
|
EXPORTS.vpx += files['GENERIC_EXPORTS']
|
|
SOURCES += files['GENERIC_SOURCES']
|
|
ASFLAGS += [ '-I%s/media/libvpx/config/generic/' % TOPSRCDIR ]
|
|
LOCAL_INCLUDES += [ '/media/libvpx/config/generic/' ]
|
|
|
|
# We allow warnings for third-party code that can be updated from upstream.
|
|
AllowCompilerWarnings()
|
|
|
|
FINAL_LIBRARY = 'gkcodecs'
|
|
NoVisibilityFlags()
|
|
|
|
DEFINES['HAVE_CONFIG_H'] = 'vpx_config.h'
|
|
|
|
if CONFIG['OS_TARGET'] == 'Android':
|
|
# Older versions of the Android NDK don't pre-define anything to indicate
|
|
# the OS they're on, so do it for them.
|
|
DEFINES['__linux__'] = True
|
|
|
|
SOURCES += [
|
|
'%%%s/sources/android/cpufeatures/cpu-features.c' % CONFIG['ANDROID_NDK'],
|
|
]
|
|
|
|
for f in SOURCES:
|
|
if f.endswith('.c'):
|
|
if 'mmx.c' in f:
|
|
SOURCES[f].flags += ['-mmmx']
|
|
if 'sse2.c' in f:
|
|
SOURCES[f].flags += CONFIG['SSE2_FLAGS']
|
|
if 'ssse3.c' in f:
|
|
SOURCES[f].flags += ['-mssse3']
|
|
if 'sse4.c' in f:
|
|
SOURCES[f].flags += ['-msse4.1']
|
|
if 'avx.c' in f:
|
|
SOURCES[f].flags += ['-mavx']
|
|
if 'avx2.c' in f:
|
|
SOURCES[f].flags += ['-mavx2']
|
|
if 'neon_dotprod.c' in f:
|
|
SOURCES[f].flags += ['-march=armv8.2-a+dotprod']
|
|
if 'neon_i8mm.c' in f:
|
|
SOURCES[f].flags += ['-march=armv8.2-a+dotprod+i8mm']
|
|
if 'sve.c' in f:
|
|
SOURCES[f].flags += ['-march=armv8.2-a+dotprod+i8mm+sve']
|
|
if 'sve2.c' in f:
|
|
SOURCES[f].flags += ['-march=armv9-a+sve2']
|
|
|
|
# Suppress warnings in third-party code.
|
|
CFLAGS += [
|
|
'-Wno-sign-compare',
|
|
'-Wno-unused-function', # so many of these warnings; just ignore them
|
|
]
|
|
if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
|
|
CFLAGS += [
|
|
'-Wno-unreachable-code',
|
|
'-Wno-unneeded-internal-declaration',
|
|
]
|
|
|
|
ASFLAGS += CONFIG['VPX_ASFLAGS']
|
|
ASFLAGS += [
|
|
'-I./',
|
|
'-I%s/media/libvpx/libvpx/' % TOPSRCDIR,
|
|
]
|
|
|
|
LOCAL_INCLUDES += [
|
|
'/media/libvpx/config', # vpx_version.h
|
|
'/media/libvpx/libvpx',
|
|
]
|
|
|
|
if CONFIG['OS_TARGET'] == 'Android':
|
|
# For LIBVPX_RAND
|
|
ASFLAGS += [
|
|
'-D__ANDROID__'
|
|
]
|