Bug 1735675 [wpt PR 31220] - Port Indexeddb delete-range test to WPT tests, a=testonly
[gecko.git] / media / libopus / moz.build
blob37be53beb68502d42a6d16daefb5800866b514b5
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/.
7 with Files('*'):
8     BUG_COMPONENT = ('Core', 'Audio/Video')
10 EXPORTS.opus += [
11     'include/opus.h',
12     'include/opus_defines.h',
13     'include/opus_multistream.h',
14     'include/opus_types.h',
17 # We allow warnings for third-party code that can be updated from upstream.
18 AllowCompilerWarnings()
20 FINAL_LIBRARY = 'gkmedias'
22 DEFINES['OPUS_BUILD'] = True
23 DEFINES['OPUS_VERSION'] = '"v1.3-rc-19-g5cbd7d5f-mozilla"'
24 DEFINES['USE_ALLOCA'] = True
25 DEFINES['ENABLE_HARDENING'] = True
27 # Don't export symbols
28 DEFINES['OPUS_EXPORT'] = ''
30 if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']:
31     DEFINES['OPUS_ARM_ASM'] = True
32     DEFINES['OPUS_ARM_EXTERNAL_ASM'] = True
33     DEFINES['OPUS_ARM_INLINE_ASM'] = True
34     if int(CONFIG['ARM_ARCH']) >= 6:
35         DEFINES['OPUS_ARM_INLINE_EDSP'] = True
36         DEFINES['OPUS_ARM_MAY_HAVE_EDSP'] = True
37         DEFINES['OPUS_ARM_MAY_HAVE_MEDIA'] = True
38         DEFINES['OPUS_ARM_MAY_HAVE_NEON'] = True
40 if CONFIG['MOZ_DEBUG']:
41     DEFINES['ENABLE_ASSERTIONS'] = True
43 if CONFIG['OS_ARCH'] in ('Linux', 'Darwin', 'DragonFly', 'FreeBSD',
44                          'NetBSD', 'OpenBSD'):
45     DEFINES['HAVE_LRINTF'] = True
47 if CONFIG['OS_ARCH'] == 'WINNT':
48     DEFINES['inline'] = '__inline'
49     if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
50         DEFINES['HAVE_LRINTF'] = True
52 if CONFIG['OS_ARCH'] == 'AIX':
53     DEFINES['alloca'] = '__alloca'
55 if CONFIG['OS_ARCH'] == 'SunOS':
56     DEFINES['HAVE_ALLOCA_H'] = True
58 if not CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
59     DEFINES['FIXED_POINT'] = 1
60     DEFINES['DISABLE_FLOAT_API'] = True
62 LOCAL_INCLUDES += [
63     'celt',
64     'include',
65     'silk',
66     'silk/fixed',
67     'silk/float',
68     'src',
71 # sources.mozbuild is generated from gen-sources.py when a new libopus is
72 # imported.
73 include('sources.mozbuild')
75 UNIFIED_SOURCES += celt_sources
76 UNIFIED_SOURCES += silk_sources
77 UNIFIED_SOURCES += opus_sources
78 SOURCES += opus_nonunified_sources
80 if CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
81     UNIFIED_SOURCES += silk_sources_float
82     UNIFIED_SOURCES += opus_sources_float
83 else:
84     UNIFIED_SOURCES += silk_sources_fixed
86 if CONFIG['CPU_ARCH'] in ('x86', 'x86_64'):
87     DEFINES['OPUS_HAVE_RTCD'] = True
88     DEFINES['OPUS_X86_MAY_HAVE_SSE'] = True
89     DEFINES['OPUS_X86_MAY_HAVE_SSE2'] = True
90     DEFINES['OPUS_X86_MAY_HAVE_SSE4_1'] = True
91     DEFINES['OPUS_X86_MAY_HAVE_AVX'] = True
92     SOURCES += celt_sources_sse
93     SOURCES += celt_sources_sse2
94     SOURCES += celt_sources_sse4_1
95     SOURCES += silk_sources_sse4_1
96     if not CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
97         SOURCES += silk_sources_fixed_sse4_1
98     for f in SOURCES:
99         if f in celt_sources_sse:
100             SOURCES[f].flags += CONFIG['SSE_FLAGS']
101         if f in celt_sources_sse2:
102             SOURCES[f].flags += CONFIG['SSE2_FLAGS']
103         if f in celt_sources_sse4_1 or \
104            f in silk_sources_sse4_1 or \
105            f in silk_sources_fixed_sse4_1:
106             SOURCES[f].flags += ['-msse4.1']
108 if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']:
109     SOURCES += celt_sources_arm
110     SOURCES += [
111         '!celt_pitch_xcorr_arm-gnu.s'
112     ]
113     # -Os is significantly slower, enable -O3 unless optimization is disabled
114     if CONFIG['MOZ_OPTIMIZE']:
115         CFLAGS += [
116             '-O3',
117         ]
118         CXXFLAGS += [
119             '-O3',
120         ]
121     # These flags are a lie; they're just used to enable the requisite
122     # opcodes; actual arch detection is done at runtime.
123     ASFLAGS += [
124         '-march=armv7-a',
125     ]
126     ASFLAGS += CONFIG['NEON_FLAGS']
128 if CONFIG['CPU_ARCH'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang', 'gcc'):
129     DEFINES['OPUS_ARM_PRESUME_AARCH64_NEON_INTR'] = True
130     DEFINES['OPUS_ARM_PRESUME_NEON'] = True
131     DEFINES['OPUS_ARM_PRESUME_NEON_INTR'] = True
132     SOURCES += celt_sources_arm_neon_intr
133     SOURCES += silk_sources_arm_neon_intr
134     if CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
135         DEFINES['OPUS_ARM_MAY_HAVE_NEON'] = True
136         DEFINES['OPUS_ARM_MAY_HAVE_NEON_INTR'] = True
137     else:
138         SOURCES += silk_sources_fixed_arm_neon_intr
140 # Suppress warnings in third-party code.
141 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
142     if CONFIG['CC_TYPE'] == 'clang':
143         CFLAGS += ['-Wno-#pragma-messages']
145 # Add libFuzzer configuration directives
146 include('/tools/fuzzing/libfuzzer-config.mozbuild')