summaryrefslogtreecommitdiff
path: root/media/ffvpx/ffvpxcommon.mozbuild
blob: 620158694b70df0141cd01bbc5a3c272cd2c588b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# -*- 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/.

# Add assembler flags and includes
ASFLAGS += CONFIG['FFVPX_ASFLAGS']
ASFLAGS += ['-I%s/media/ffvpx' % TOPSRCDIR]

if CONFIG['FFVPX_ASFLAGS']:
    USE_YASM = True
    if CONFIG['OS_ARCH'] == 'WINNT':
       # Fix inline symbols and math defines for windows.
        DEFINES['_USE_MATH_DEFINES'] = True
        DEFINES['inline'] = "__inline"
        # 32-bit windows need to prefix symbols with an underscore.
        if CONFIG['CPU_ARCH'] == 'x86':
            ASFLAGS += ['-DPREFIX']
            ASFLAGS += ['-Pconfig_win32.asm']
        else:
            ASFLAGS += ['-Pconfig_win64.asm']
    elif CONFIG['OS_ARCH'] == 'Darwin':
        # 32/64-bit macosx assemblers need to prefix symbols with an underscore.
        ASFLAGS += [
            '-Pconfig_darwin64.asm',
            '-DPREFIX'
        ]
    else:
        # Default to unix, similar to how ASFLAGS setup works in configure.in
        ASFLAGS += ['-Pconfig_unix64.asm']
    # default disabled components
    ASFLAGS += ['-Pdefaults_disabled.asm']

LOCAL_INCLUDES += ['/media/ffvpx']

# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True
# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
    CFLAGS += [
        '-Wno-parentheses',
        '-Wno-pointer-sign',
        '-Wno-sign-compare',
        '-Wno-switch',
        '-Wno-type-limits',
        '-Wno-unused-function',
        # XXX This does not seem to have any effect on some versions of GCC.
        '-Wno-deprecated-declarations',
    ]
    if CONFIG['CLANG_CXX']:
        CFLAGS += [
            '-Wno-incompatible-pointer-types-discards-qualifiers',
            '-Wno-string-conversion',
            '-Wno-visibility',
            # Workaround for https://bugs.llvm.org/show_bug.cgi?id=26828#c4 :
            '-ffreestanding',
        ]
    else:
        CFLAGS += [
            '-Wno-discarded-qualifiers',
            '-Wno-maybe-uninitialized',
        ]
    # Force visibility of cpu and av_log symbols.
    CFLAGS += ['-include', 'libavutil_visibility.h']
elif CONFIG['_MSC_VER']:
    CFLAGS += [
        '-wd4090', # 'return' : different 'const' qualifiers
        '-wd4018', # '>' : signed/unsigned mismatch
        '-wd4305', # 'initializing' : truncation from '__int64' to 'double'
        '-wd4554', # '>>' : check operator precedence for possible error
        '-wd4307', # '+' : integral constant overflow'
        '-wd4028', # formal parameter 1 different from declaration
        '-wd4056', # overflow in floating-point constant arithmetic
        '-wd4756', # overflow in constant arithmetic
        '-wd4005', #'WIN32_LEAN_AND_MEAN' : macro redefinition
        '-wd4054', # 'type cast' : from function pointer 'FARPROC' to data pointer 'void *'
        '-wd4189', # local variable is initialized but not referenced
        '-wd4133', # 'function' : incompatible types - from 'AVSampleFormat *' to 'int *'
        '-wd4221', # nonstandard extension used
        '-wd4206', # nonstandard extension used
        '-wd4702', # unreachable code
        '-wd4101', # unreferenced local variable
        '-wd4245', # conversion from 'int' to 'uint32_t', signed/unsigned mismatch
        '-wd4703', # potentially uninitialized local pointer
        '-wd4293', # '<<' : shift count negative or too big, undefined behavior
        '-wd4334', # '<<' : result of 32-bit shift implicitly converted to 64 bits
        '-wd4996', # The compiler encountered a deprecated declaration.
        # from FFmpeg configure
        '-wd4244', '-wd4127', '-wd4018', '-wd4389', '-wd4146', '-wd4701',
        '-wd4057', '-wd4204', '-wd4706', '-wd4305', '-wd4152', '-wd4324',
        '-we4013', '-wd4100', '-wd4214', '-wd4307', '-wd4273', '-wd4554',
    ]
    LOCAL_INCLUDES += ['/media/ffvpx/compat/atomics/win32']

DEFINES['HAVE_AV_CONFIG_H'] = True

if CONFIG['MOZ_DEBUG']:
    # Enable all assertions in debug builds.
    DEFINES['ASSERT_LEVEL'] = 2
elif not CONFIG['RELEASE_OR_BETA']:
    # Enable fast assertions in opt builds of Nightly and Aurora.
    DEFINES['ASSERT_LEVEL'] = 1

# clang-cl's <intrin.h> doesn't work the same as MSVC's.  For details, see:
#
# http://lists.llvm.org/pipermail/cfe-dev/2016-September/050943.html
#
# As a temporary workaround while upstream decides how to address this,
# we enable modules to make <intrin.h> more MSVC-compatible.
if CONFIG['CLANG_CL']:
    CFLAGS += [
        '-Xclang',
        '-fmodules',
        '-Xclang',
        '-fmodules-cache-path=' + TOPOBJDIR + '/media/ffpvx',
        '-fbuiltin-module-map',
    ]