summaryrefslogtreecommitdiffstats
path: root/media/libaom/moz.build
blob: db3f9ca6eca4c0d60a1e45b10f17dbd530f70e4e (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
119
120
121
122
123
124
125
# -*- 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')

# Linux, Mac and Win share file lists for x86* but not configurations.
if CONFIG['CPU_ARCH'] == 'x86_64':
    EXPORTS.aom += files['X64_EXPORTS']
    SOURCES += files['X64_SOURCES']
    USE_NASM = True
    if CONFIG['OS_TARGET'] == 'WINNT':
        ASFLAGS += [ '-I%s/media/libaom/config/win/x64/' % TOPSRCDIR ]
        LOCAL_INCLUDES += [ '/media/libaom/config/win/x64/' ]
        EXPORTS.aom += [ 'config/win/x64/config/aom_config.h' ]
        # This code is not included in our PGO profile, and pointlessly
        # PGO-optimizing it slows down our builds a lot.
        NO_PGO = True
    elif CONFIG['OS_TARGET'] == 'Darwin':
        ASFLAGS += [ '-I%s/media/libaom/config/mac/x64/' % TOPSRCDIR ]
        LOCAL_INCLUDES += [ '/media/libaom/config/mac/x64/' ]
        EXPORTS.aom += [ 'config/mac/x64/config/aom_config.h' ]
    else: # Android, Linux, BSDs, etc.
        ASFLAGS += [ '-I%s/media/libaom/config/linux/x64/' % TOPSRCDIR ]
        LOCAL_INCLUDES += [ '/media/libaom/config/linux/x64/' ]
        EXPORTS.aom += [ 'config/linux/x64/config/aom_config.h' ]
elif CONFIG['CPU_ARCH'] == 'x86':
    EXPORTS.aom += files['IA32_EXPORTS']
    SOURCES += files['IA32_SOURCES']
    USE_NASM = True
    if CONFIG['OS_TARGET'] == 'WINNT':
        ASFLAGS += [ '-I%s/media/libaom/config/win/ia32/' % TOPSRCDIR ]
        LOCAL_INCLUDES += [ '/media/libaom/config/win/ia32/' ]
        EXPORTS.aom += [ 'config/win/ia32/config/aom_config.h' ]
        NO_PGO = True # Compiler OOMs, bug 1445922
    else: # Android, Linux, BSDs, etc.
        ASFLAGS += [ '-I%s/media/libaom/config/linux/ia32/' % TOPSRCDIR ]
        LOCAL_INCLUDES += [ '/media/libaom/config/linux/ia32/' ]
        EXPORTS.aom += [ 'config/linux/ia32/config/aom_config.h' ]
elif CONFIG['CPU_ARCH'] == 'arm':
    EXPORTS.aom += files['ARM_EXPORTS']
    ASFLAGS += [
        '-I%s/media/libaom/config/linux/arm/' % TOPSRCDIR,
        '-I%s/libaom' % OBJDIR,
    ]
    LOCAL_INCLUDES += [ '/media/libaom/config/linux/arm/' ]
    EXPORTS.aom += [ 'config/linux/arm/config/aom_config.h' ]

    SOURCES += files['ARM_SOURCES']

    for f in SOURCES:
        if f.endswith('neon.c'):
            SOURCES[f].flags += CONFIG['NEON_FLAGS']

    if CONFIG['OS_TARGET'] == 'Android':
        # For cpu-features.h
        LOCAL_INCLUDES += [
            '%%%s/sources/android/cpufeatures' % CONFIG['ANDROID_NDK'],
        ]
else:
    # Generic C-only configuration
    EXPORTS.aom += files['GENERIC_EXPORTS']
    SOURCES += files['GENERIC_SOURCES']
    ASFLAGS += [ '-I%s/media/libaom/config/generic/' % TOPSRCDIR ]
    LOCAL_INCLUDES += [ '/media/libaom/config/generic/' ]
    EXPORTS.aom += [ 'config/generic/config/aom_config.h' ]

# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()

FINAL_LIBRARY = 'gkmedias'

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

for f in SOURCES:
    if f.endswith('sse2.c'):
        SOURCES[f].flags += CONFIG['SSE2_FLAGS']
    elif f.endswith('ssse3.c'):
        SOURCES[f].flags += ['-mssse3']
    elif f.endswith('sse4.c'):
        SOURCES[f].flags += ['-msse4.1']
    elif f.endswith('sse42.c'):
        SOURCES[f].flags += ['-msse4.2']
    elif f.endswith('avx.c'):
        SOURCES[f].flags += ['-mavx']
    elif f.endswith('avx2.c'):
        SOURCES[f].flags += ['-mavx2']

# 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/third_party/aom/' % TOPSRCDIR,
]

LOCAL_INCLUDES += [
    '/media/libaom/config', # aom_version.h
    '/third_party/aom',
]

if CONFIG['OS_TARGET'] == 'Linux':
    # For fuzzing, We only support building on Linux currently.
    include('/tools/fuzzing/libfuzzer-config.mozbuild')
    if CONFIG['FUZZING_INTERFACES']:
        TEST_DIRS += [
            'test/fuzztest'
    ]