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/.
6
7# Add assembler flags and includes
8if CONFIG['CPU_ARCH'] != 'aarch64':
9    ASFLAGS += CONFIG['FFVPX_ASFLAGS']
10    ASFLAGS += ['-I%s/media/ffvpx/' % TOPSRCDIR]
11    ASFLAGS += ['-I%s/media/ffvpx/libavcodec/x86/' % TOPSRCDIR]
12    ASFLAGS += ['-I%s/media/ffvpx/libavutil/x86/' % TOPSRCDIR]
13
14if CONFIG['FFVPX_ASFLAGS']:
15    if CONFIG['FFVPX_USE_NASM']:
16        USE_NASM = True
17
18    if CONFIG['OS_ARCH'] == 'WINNT':
19       # Fix inline symbols and math defines for windows.
20        DEFINES['_USE_MATH_DEFINES'] = True
21        DEFINES['inline'] = "__inline"
22
23LOCAL_INCLUDES += ['/media/ffvpx']
24
25# We allow warnings for third-party code that can be updated from upstream.
26AllowCompilerWarnings()
27
28# Suppress warnings in third-party code.
29CFLAGS += [
30    '-Wno-parentheses',
31    '-Wno-pointer-sign',
32    '-Wno-sign-compare',
33    '-Wno-switch',
34    '-Wno-type-limits',
35    '-Wno-unused-function',
36    # XXX This does not seem to have any effect on some versions of GCC.
37    '-Wno-deprecated-declarations',
38]
39if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
40    CFLAGS += [
41        '-Wno-absolute-value',
42        '-Wno-incompatible-pointer-types',
43        '-Wno-string-conversion',
44        '-Wno-visibility',
45    ]
46    if CONFIG['CC_TYPE'] == 'clang-cl':
47        CFLAGS += [
48            '-Wno-inconsistent-dllimport',
49            '-Wno-macro-redefined', # 'WIN32_LEAN_AND_MEAN' macro redefined
50        ]
51else:
52    CFLAGS += [
53        '-Wno-discarded-qualifiers',
54        '-Wno-maybe-uninitialized',
55    ]
56if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
57    # Force visibility of cpu and av_log symbols.
58    CFLAGS += ['-include', 'libavutil_visibility.h']
59if CONFIG['CC_TYPE'] == 'clang-cl':
60    LOCAL_INCLUDES += ['/media/ffvpx/compat/atomics/win32']
61DEFINES['HAVE_AV_CONFIG_H'] = True
62
63if CONFIG['MOZ_DEBUG']:
64    # Enable all assertions in debug builds.
65    DEFINES['ASSERT_LEVEL'] = 2
66elif not CONFIG['RELEASE_OR_BETA']:
67    # Enable fast assertions in opt builds of Nightly and Aurora.
68    DEFINES['ASSERT_LEVEL'] = 1
69
70# Add libFuzzer configuration directives
71include('/tools/fuzzing/libfuzzer-config.mozbuild')
72