gecko-dev/media/libdav1d/moz.build

184 строки
6.0 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/.
Library('dav1d')
LOCAL_INCLUDES += [
'/third_party/dav1d',
'/third_party/dav1d/include',
'/third_party/dav1d/include/dav1d',
'/third_party/dav1d/src',
]
EXPORTS.dav1d += [
'config.h',
'version.h',
]
# entrypoint source files
SOURCES += [
'../../third_party/dav1d/src/lib.c',
'../../third_party/dav1d/src/thread_task.c',
]
# Enable ASM on Linux for now.
if CONFIG['OS_TARGET'] == 'Linux' and (CONFIG['CPU_ARCH'] in ('x86', 'x86_64')):
# Default stack aligment is 16 bytes
DIRS += ['asm']
if CONFIG['CPU_ARCH'] == 'x86_64':
# Update stack aligment to 32 bytes
if CONFIG['CC_TYPE'] == 'clang':
CFLAGS += ['-mstack-alignment=32']
SOURCES['../../third_party/dav1d/src/lib.c'].flags += ['-mstackrealign']
SOURCES['../../third_party/dav1d/src/thread_task.c'].flags += ['-mstackrealign']
elif CONFIG['CC_TYPE'] == 'gcc':
CFLAGS += ['-mpreferred-stack-boundary=5']
SOURCES['../../third_party/dav1d/src/lib.c'].flags += ['-mincoming-stack-boundary=4']
SOURCES['../../third_party/dav1d/src/thread_task.c'].flags += ['-mincoming-stack-boundary=4']
# common sources
SOURCES += [
'../../third_party/dav1d/src/cdf.c',
'../../third_party/dav1d/src/cpu.c',
'../../third_party/dav1d/src/data.c',
'../../third_party/dav1d/src/decode.c',
'../../third_party/dav1d/src/dequant_tables.c',
'../../third_party/dav1d/src/getbits.c',
'../../third_party/dav1d/src/intra_edge.c',
'../../third_party/dav1d/src/lf_mask.c',
'../../third_party/dav1d/src/msac.c',
'../../third_party/dav1d/src/obu.c',
'../../third_party/dav1d/src/picture.c',
'../../third_party/dav1d/src/qm.c',
'../../third_party/dav1d/src/ref.c',
'../../third_party/dav1d/src/ref_mvs.c',
'../../third_party/dav1d/src/scan.c',
'../../third_party/dav1d/src/tables.c',
'../../third_party/dav1d/src/warpmv.c',
'../../third_party/dav1d/src/wedge.c',
]
# includes src
EXPORTS.dav1d.src += [
'../../third_party/dav1d/src/cdf.h',
'../../third_party/dav1d/src/cpu.h',
'../../third_party/dav1d/src/ctx.h',
'../../third_party/dav1d/src/data.h',
'../../third_party/dav1d/src/decode.h',
'../../third_party/dav1d/src/dequant_tables.h',
'../../third_party/dav1d/src/film_grain.h',
'../../third_party/dav1d/src/getbits.h',
'../../third_party/dav1d/src/intra_edge.h',
'../../third_party/dav1d/src/lf_mask.h',
'../../third_party/dav1d/src/msac.h',
'../../third_party/dav1d/src/obu.h',
'../../third_party/dav1d/src/picture.h',
'../../third_party/dav1d/src/qm.h',
'../../third_party/dav1d/src/ref.h',
'../../third_party/dav1d/src/ref_mvs.h',
'../../third_party/dav1d/src/scan.h',
'../../third_party/dav1d/src/tables.h',
'../../third_party/dav1d/src/thread.h',
'../../third_party/dav1d/src/warpmv.h',
'../../third_party/dav1d/src/wedge.h',
]
# common BITDEPTH 8, 16
relative_path = '../../third_party/dav1d/src/'
bitdepth_basenames = [
'cdef_apply_tmpl.c',
'cdef_tmpl.c',
'film_grain_tmpl.c',
'ipred_prepare_tmpl.c',
'ipred_tmpl.c',
'itx_tmpl.c',
'lf_apply_tmpl.c',
'loopfilter_tmpl.c',
'looprestoration_tmpl.c',
'lr_apply_tmpl.c',
'mc_tmpl.c',
'recon_tmpl.c'
]
GENERATED_FILES += [
'16bd_%s' % p for p in bitdepth_basenames
]
for f in bitdepth_basenames:
a = GENERATED_FILES['16bd_%s' % f]
a.script = 'generate_source.py:add_define'
a.inputs = [relative_path + f]
a.flags = ['BITDEPTH', '16']
GENERATED_FILES += [
'8bd_%s' % p for p in bitdepth_basenames
]
for f in bitdepth_basenames:
a = GENERATED_FILES['8bd_%s' % f]
a.script = 'generate_source.py:add_define'
a.inputs = [relative_path + f]
a.flags = ['BITDEPTH', '8']
SOURCES += [
'!%s' % p for p in GENERATED_FILES if p.endswith('.c')
]
EXPORTS.dav1d.src += [
'../../third_party/dav1d/src/cdef.h',
'../../third_party/dav1d/src/cdef_apply.h',
'../../third_party/dav1d/src/ipred.h',
'../../third_party/dav1d/src/ipred_prepare.h',
'../../third_party/dav1d/src/itx.h',
'../../third_party/dav1d/src/lf_apply.h',
'../../third_party/dav1d/src/loopfilter.h',
'../../third_party/dav1d/src/looprestoration.h',
'../../third_party/dav1d/src/lr_apply.h',
'../../third_party/dav1d/src/mc.h',
'../../third_party/dav1d/src/recon.h',
]
# include/common
EXPORTS.dav1d += [
'../../third_party/dav1d/include/common/attributes.h',
'../../third_party/dav1d/include/common/bitdepth.h',
'../../third_party/dav1d/include/common/dump.h',
'../../third_party/dav1d/include/common/intops.h',
'../../third_party/dav1d/include/common/mem.h',
'../../third_party/dav1d/include/common/validate.h',
]
# include/dav1d
EXPORTS.dav1d += [
'../../third_party/dav1d/include/dav1d/common.h',
'../../third_party/dav1d/include/dav1d/data.h',
'../../third_party/dav1d/include/dav1d/dav1d.h',
'../../third_party/dav1d/include/dav1d/headers.h',
'../../third_party/dav1d/include/dav1d/picture.h',
]
if CONFIG['OS_TARGET'] == 'WINNT':
RCFILE = 'dav1d.rc'
SOURCES += [
'../../third_party/dav1d/src/win32/thread.c'
]
if CONFIG['CC_TYPE'] == 'msvc':
LOCAL_INCLUDES += ['../../third_party/dav1d/include/compat/msvc/']
EXPORTS.dav1d += ['../../third_party/dav1d/include/compat/msvc/stdatomic.h']
if CONFIG['CC_TYPE'] == 'gcc':
LOCAL_INCLUDES += ['../../third_party/dav1d/include/compat/gcc/']
EXPORTS.dav1d += ['../../third_party/dav1d/include/compat/gcc/stdatomic.h']
FINAL_LIBRARY = 'gkmedias'
# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()
# And furthermore, don't show warnings.
DisableCompilerWarnings()