Split targets mixing .c and .cc sources.
The Bazel build format doesn't support having separate
lists of compilation flags for C and C++; it just has a single
copts list for cc_library:
https://bazel.build/versions/master/docs/be/c-cpp.html#cc_binary.copts
This makes it hard to convert our GN targets to Bazel when there are
compiler warnings that aren't supported for C (like -Woverloaded-virtual
being added in bugs.webrtc.org/6653).
The solution for this is to move all .c files to their own targets
and remove C++-only compiler flags during conversion.
New targets:
//webrtc/common_audio:common_audio_c
//webrtc/common_audio:common_audio_neon_c
//webrtc/modules/audio_coding:g711_c
//webrtc/modules/audio_coding:g722_c
//webrtc/modules/audio_coding:ilbc_c
//webrtc/modules/audio_coding:isac_c
//webrtc/modules/audio_coding:isac_fix_c
//webrtc/modules/audio_coding:isac_test_util
//webrtc/modules/audio_coding:pcm16b_c
//webrtc/modules/audio_coding:webrtc_opusj_c
//webrtc/modules/audio_device:mac_portaudio
//webrtc/modules/audio_procssing:audio_processing_c
//webrtc/modules/audio_procssing:audio_processing_neon_c
This CL also adds a PRESUBMIT.py check that will throw an error
if targets are mixing .c and .cc files, to preven this from regressing.
BUG=webrtc:6653
NOTRY=True
Review-Url: https://codereview.webrtc.org/2550563003
Cr-Commit-Position: refs/heads/master@{#15433}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index a973ffe..86d5c21 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -6,6 +6,7 @@
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
+import json
import os
import re
import sys
@@ -291,6 +292,35 @@
items=violating_gn_files)]
return []
+def _CheckNoMixingCAndCCSources(input_api, gn_files, output_api):
+ # Disallow mixing .c and .cc source files in the same target.
+ source_pattern = input_api.re.compile(r' +sources \+?= \[(.*?)\]',
+ re.MULTILINE | re.DOTALL)
+ file_pattern = input_api.re.compile(r'"(.*)"')
+ violating_gn_files = dict()
+ for gn_file in gn_files:
+ contents = input_api.ReadFile(gn_file)
+ for source_block_match in source_pattern.finditer(contents):
+ c_files = []
+ cc_files = []
+ for file_list_match in file_pattern.finditer(source_block_match.group(1)):
+ source_file = file_list_match.group(1)
+ if source_file.endswith('.c'):
+ c_files.append(source_file)
+ if source_file.endswith('.cc'):
+ cc_files.append(source_file)
+ if c_files and cc_files:
+ violating_gn_files[gn_file.LocalPath()] = sorted(c_files + cc_files)
+ if violating_gn_files:
+ return [output_api.PresubmitError(
+ 'GN targets cannot mix .cc and .c source files. Please create a '
+ 'separate target for each collection of sources.\n'
+ 'Mixed sources: \n'
+ '%s\n'
+ 'Violating GN files:' % json.dumps(violating_gn_files, indent=2),
+ items=violating_gn_files.keys())]
+ return []
+
def _CheckGnChanges(input_api, output_api):
source_file_filter = lambda x: input_api.FilterSourceFile(
x, white_list=(r'.+\.(gn|gni)$',))
@@ -304,6 +334,7 @@
if gn_files:
result.extend(_CheckNoRtcBaseDeps(input_api, gn_files, output_api))
result.extend(_CheckNoSourcesAbove(input_api, gn_files, output_api))
+ result.extend(_CheckNoMixingCAndCCSources(input_api, gn_files, output_api))
return result
def _CheckUnwantedDependencies(input_api, output_api):
diff --git a/webrtc/common_audio/BUILD.gn b/webrtc/common_audio/BUILD.gn
index 39702dc..5d7a9c6 100644
--- a/webrtc/common_audio/BUILD.gn
+++ b/webrtc/common_audio/BUILD.gn
@@ -28,8 +28,6 @@
"blocker.h",
"channel_buffer.cc",
"channel_buffer.h",
- "fft4g.c",
- "fft4g.h",
"fir_filter.cc",
"fir_filter.h",
"fir_filter_neon.h",
@@ -49,6 +47,65 @@
"resampler/resampler.cc",
"resampler/sinc_resampler.cc",
"resampler/sinc_resampler.h",
+ "smoothing_filter.cc",
+ "smoothing_filter.h",
+ "sparse_fir_filter.cc",
+ "sparse_fir_filter.h",
+ "vad/include/vad.h",
+ "vad/vad.cc",
+ "wav_file.cc",
+ "wav_file.h",
+ "wav_header.cc",
+ "wav_header.h",
+ "window_generator.cc",
+ "window_generator.h",
+ ]
+
+ deps = [
+ "../base:rtc_analytics",
+ "../system_wrappers",
+ ]
+ public_deps = [
+ ":common_audio_c",
+ ]
+
+ defines = []
+ if (rtc_use_openmax_dl) {
+ sources += [
+ "real_fourier_openmax.cc",
+ "real_fourier_openmax.h",
+ ]
+ defines += [ "RTC_USE_OPENMAX_DL" ]
+ if (rtc_build_openmax_dl) {
+ deps += [ "//third_party/openmax_dl/dl" ]
+ }
+ }
+
+ if (rtc_build_with_neon) {
+ deps += [ ":common_audio_neon" ]
+ }
+
+ if (is_win) {
+ cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion.
+ }
+
+ public_configs = [ ":common_audio_config" ]
+
+ if (!build_with_chromium && is_clang) {
+ # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
+ suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
+ }
+
+ if (current_cpu == "x86" || current_cpu == "x64") {
+ deps += [ ":common_audio_sse2" ]
+ }
+}
+
+rtc_source_set("common_audio_c") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
+ "fft4g.c",
+ "fft4g.h",
"ring_buffer.c",
"ring_buffer.h",
"signal_processing/auto_corr_to_refl_coef.c",
@@ -86,13 +143,7 @@
"signal_processing/splitting_filter.c",
"signal_processing/sqrt_of_one_minus_x_squared.c",
"signal_processing/vector_scaling_operations.c",
- "smoothing_filter.cc",
- "smoothing_filter.h",
- "sparse_fir_filter.cc",
- "sparse_fir_filter.h",
- "vad/include/vad.h",
"vad/include/webrtc_vad.h",
- "vad/vad.cc",
"vad/vad_core.c",
"vad/vad_core.h",
"vad/vad_filterbank.c",
@@ -102,31 +153,8 @@
"vad/vad_sp.c",
"vad/vad_sp.h",
"vad/webrtc_vad.c",
- "wav_file.cc",
- "wav_file.h",
- "wav_header.cc",
- "wav_header.h",
- "window_generator.cc",
- "window_generator.h",
]
- deps = [
- "../base:rtc_analytics",
- "../system_wrappers",
- ]
-
- defines = []
- if (rtc_use_openmax_dl) {
- sources += [
- "real_fourier_openmax.cc",
- "real_fourier_openmax.h",
- ]
- defines += [ "RTC_USE_OPENMAX_DL" ]
- if (rtc_build_openmax_dl) {
- deps += [ "//third_party/openmax_dl/dl" ]
- }
- }
-
if (current_cpu == "arm") {
sources += [
"signal_processing/complex_bit_reverse_arm.S",
@@ -140,10 +168,6 @@
}
}
- if (rtc_build_with_neon) {
- deps += [ ":common_audio_neon" ]
- }
-
if (current_cpu == "mipsel") {
sources += [
"signal_processing/complex_bit_reverse_mips.c",
@@ -176,15 +200,6 @@
}
public_configs = [ ":common_audio_config" ]
-
- if (!build_with_chromium && is_clang) {
- # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
- suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
- }
-
- if (current_cpu == "x86" || current_cpu == "x64") {
- deps += [ ":common_audio_sse2" ]
- }
}
if (current_cpu == "x86" || current_cpu == "x64") {
@@ -210,6 +225,38 @@
sources = [
"fir_filter_neon.cc",
"resampler/sinc_resampler_neon.cc",
+ ]
+
+ if (current_cpu != "arm64") {
+ # Enable compilation for the NEON instruction set. This is needed
+ # since //build/config/arm.gni only enables NEON for iOS, not Android.
+ # This provides the same functionality as webrtc/build/arm_neon.gypi.
+ suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
+ cflags = [ "-mfpu=neon" ]
+ }
+
+ # Disable LTO on NEON targets due to compiler bug.
+ # TODO(fdegans): Enable this. See crbug.com/408997.
+ if (rtc_use_lto) {
+ cflags -= [
+ "-flto",
+ "-ffat-lto-objects",
+ ]
+ }
+
+ if (!build_with_chromium && is_clang) {
+ # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
+ suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
+ }
+
+ public_deps = [
+ ":common_audio_neon_c",
+ ]
+ }
+
+ rtc_source_set("common_audio_neon_c") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
"signal_processing/cross_correlation_neon.c",
"signal_processing/downsample_fast_neon.c",
"signal_processing/min_max_operations_neon.c",
diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn
index 77a9c3e..efbf7e0 100644
--- a/webrtc/modules/audio_coding/BUILD.gn
+++ b/webrtc/modules/audio_coding/BUILD.gn
@@ -225,10 +225,6 @@
"codecs/g711/audio_decoder_pcm.h",
"codecs/g711/audio_encoder_pcm.cc",
"codecs/g711/audio_encoder_pcm.h",
- "codecs/g711/g711.c",
- "codecs/g711/g711.h",
- "codecs/g711/g711_interface.c",
- "codecs/g711/g711_interface.h",
]
public_configs = [ ":g711_config" ]
@@ -237,6 +233,19 @@
":audio_decoder_interface",
":audio_encoder_interface",
]
+ public_deps = [
+ ":g711_c",
+ ]
+}
+
+rtc_source_set("g711_c") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
+ "codecs/g711/g711.c",
+ "codecs/g711/g711.h",
+ "codecs/g711/g711_interface.c",
+ "codecs/g711/g711_interface.h",
+ ]
}
config("g722_config") {
@@ -252,11 +261,6 @@
"codecs/g722/audio_decoder_g722.h",
"codecs/g722/audio_encoder_g722.cc",
"codecs/g722/audio_encoder_g722.h",
- "codecs/g722/g722_decode.c",
- "codecs/g722/g722_enc_dec.h",
- "codecs/g722/g722_encode.c",
- "codecs/g722/g722_interface.c",
- "codecs/g722/g722_interface.h",
]
public_configs = [ ":g722_config" ]
@@ -265,6 +269,20 @@
":audio_decoder_interface",
":audio_encoder_interface",
]
+ public_deps = [
+ ":g722_c",
+ ]
+}
+
+rtc_source_set("g722_c") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
+ "codecs/g722/g722_decode.c",
+ "codecs/g722/g722_enc_dec.h",
+ "codecs/g722/g722_encode.c",
+ "codecs/g722/g722_interface.c",
+ "codecs/g722/g722_interface.h",
+ ]
}
config("ilbc_config") {
@@ -276,14 +294,32 @@
rtc_static_library("ilbc") {
sources = [
- "codecs/ilbc/abs_quant.c",
- "codecs/ilbc/abs_quant.h",
- "codecs/ilbc/abs_quant_loop.c",
- "codecs/ilbc/abs_quant_loop.h",
"codecs/ilbc/audio_decoder_ilbc.cc",
"codecs/ilbc/audio_decoder_ilbc.h",
"codecs/ilbc/audio_encoder_ilbc.cc",
"codecs/ilbc/audio_encoder_ilbc.h",
+ ]
+
+ public_configs = [ ":ilbc_config" ]
+
+ deps = [
+ ":audio_decoder_interface",
+ ":audio_encoder_interface",
+ "../../base:rtc_base_approved",
+ "../../common_audio",
+ ]
+ public_deps = [
+ ":ilbc_c",
+ ]
+}
+
+rtc_source_set("ilbc_c") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
+ "codecs/ilbc/abs_quant.c",
+ "codecs/ilbc/abs_quant.h",
+ "codecs/ilbc/abs_quant_loop.c",
+ "codecs/ilbc/abs_quant_loop.h",
"codecs/ilbc/augmented_cb_corr.c",
"codecs/ilbc/augmented_cb_corr.h",
"codecs/ilbc/bw_expand.c",
@@ -424,9 +460,6 @@
public_configs = [ ":ilbc_config" ]
deps = [
- ":audio_decoder_interface",
- ":audio_encoder_interface",
- "../../base:rtc_base_approved",
"../../common_audio",
]
}
@@ -449,6 +482,23 @@
rtc_static_library("isac") {
sources = [
+ "codecs/isac/main/source/audio_decoder_isac.cc",
+ "codecs/isac/main/source/audio_encoder_isac.cc",
+ ]
+
+ deps = [
+ ":audio_decoder_interface",
+ ":audio_encoder_interface",
+ ":isac_common",
+ ]
+ public_deps = [
+ ":isac_c",
+ ]
+}
+
+rtc_static_library("isac_c") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
"codecs/isac/main/include/audio_decoder_isac.h",
"codecs/isac/main/include/audio_encoder_isac.h",
"codecs/isac/main/include/isac.h",
@@ -456,8 +506,6 @@
"codecs/isac/main/source/arith_routines.h",
"codecs/isac/main/source/arith_routines_hist.c",
"codecs/isac/main/source/arith_routines_logist.c",
- "codecs/isac/main/source/audio_decoder_isac.cc",
- "codecs/isac/main/source/audio_encoder_isac.cc",
"codecs/isac/main/source/bandwidth_estimator.c",
"codecs/isac/main/source/bandwidth_estimator.h",
"codecs/isac/main/source/codec.h",
@@ -512,9 +560,6 @@
public_configs = [ ":isac_config" ]
deps = [
- ":audio_decoder_interface",
- ":audio_encoder_interface",
- ":isac_common",
"../..:webrtc_common",
"../../base:rtc_base_approved",
"../../common_audio",
@@ -530,6 +575,31 @@
rtc_static_library("isac_fix") {
sources = [
+ "codecs/isac/fix/source/audio_decoder_isacfix.cc",
+ "codecs/isac/fix/source/audio_encoder_isacfix.cc",
+ ]
+
+ public_configs = [ ":isac_fix_config" ]
+
+ deps = [
+ ":audio_decoder_interface",
+ ":audio_encoder_interface",
+ ":isac_common",
+ "../../common_audio",
+ "../../system_wrappers",
+ ]
+ public_deps = [
+ ":isac_fix_c",
+ ]
+
+ if (rtc_build_with_neon) {
+ deps += [ ":isac_neon" ]
+ }
+}
+
+rtc_source_set("isac_fix_c") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
"codecs/isac/fix/include/audio_decoder_isacfix.h",
"codecs/isac/fix/include/audio_encoder_isacfix.h",
"codecs/isac/fix/include/isacfix.h",
@@ -537,8 +607,6 @@
"codecs/isac/fix/source/arith_routines_hist.c",
"codecs/isac/fix/source/arith_routines_logist.c",
"codecs/isac/fix/source/arith_routins.h",
- "codecs/isac/fix/source/audio_decoder_isacfix.cc",
- "codecs/isac/fix/source/audio_encoder_isacfix.cc",
"codecs/isac/fix/source/bandwidth_estimator.c",
"codecs/isac/fix/source/bandwidth_estimator.h",
"codecs/isac/fix/source/codec.h",
@@ -582,18 +650,6 @@
public_configs = [ ":isac_fix_config" ]
- deps = [
- ":audio_decoder_interface",
- ":audio_encoder_interface",
- ":isac_common",
- "../../common_audio",
- "../../system_wrappers",
- ]
-
- if (rtc_build_with_neon) {
- deps += [ ":isac_neon" ]
- }
-
if (current_cpu == "arm" && arm_version >= 7) {
sources += [
"codecs/isac/fix/source/lattice_armv7.S",
@@ -628,6 +684,10 @@
sources -= [ "codecs/isac/fix/source/pitch_filter_c.c" ]
}
}
+
+ deps = [
+ "../../common_audio",
+ ]
}
if (rtc_build_with_neon) {
@@ -676,8 +736,6 @@
"codecs/pcm16b/audio_decoder_pcm16b.h",
"codecs/pcm16b/audio_encoder_pcm16b.cc",
"codecs/pcm16b/audio_encoder_pcm16b.h",
- "codecs/pcm16b/pcm16b.c",
- "codecs/pcm16b/pcm16b.h",
]
deps = [
@@ -685,6 +743,18 @@
":audio_encoder_interface",
":g711",
]
+ public_deps = [
+ ":pcm16b_c",
+ ]
+ public_configs = [ ":pcm16b_config" ]
+}
+
+rtc_source_set("pcm16b_c") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
+ "codecs/pcm16b/pcm16b.c",
+ "codecs/pcm16b/pcm16b.h",
+ ]
public_configs = [ ":pcm16b_config" ]
}
@@ -699,9 +769,6 @@
"codecs/opus/audio_decoder_opus.h",
"codecs/opus/audio_encoder_opus.cc",
"codecs/opus/audio_encoder_opus.h",
- "codecs/opus/opus_inst.h",
- "codecs/opus/opus_interface.c",
- "codecs/opus/opus_interface.h",
]
deps = [
@@ -711,6 +778,9 @@
"../../base:rtc_analytics",
"../../base:rtc_base_approved",
]
+ public_deps = [
+ ":webrtc_opus_c",
+ ]
defines = []
if (rtc_opus_variable_complexity) {
@@ -720,12 +790,31 @@
}
if (rtc_build_opus) {
+ public_deps += [ rtc_opus_dir ]
+ } else if (build_with_mozilla) {
+ include_dirs = [ getenv("DIST") + "/include/opus" ]
+ }
+}
+
+rtc_source_set("webrtc_opus_c") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
+ "codecs/opus/opus_inst.h",
+ "codecs/opus/opus_interface.c",
+ "codecs/opus/opus_interface.h",
+ ]
+
+ if (rtc_build_opus) {
public_deps = [
rtc_opus_dir,
]
} else if (build_with_mozilla) {
include_dirs = [ getenv("DIST") + "/include/opus" ]
}
+
+ deps = [
+ "../../base:rtc_base_approved",
+ ]
}
if (rtc_enable_protobuf) {
@@ -1568,12 +1657,18 @@
}
}
+ rtc_source_set("isac_test_util") {
+ testonly = true
+ sources = [
+ "codecs/isac/main/util/utility.c",
+ ]
+ }
+
rtc_executable("isac_test") {
testonly = true
sources = [
"codecs/isac/main/test/simpleKenny.c",
- "codecs/isac/main/util/utility.c",
]
include_dirs = [
@@ -1584,6 +1679,7 @@
deps = [
":isac",
+ ":isac_test_util",
"../../base:rtc_base_approved",
]
@@ -1620,11 +1716,11 @@
sources = [
"codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc",
- "codecs/isac/main/util/utility.c",
]
deps = [
":isac",
+ ":isac_test_util",
"../../base:rtc_base_approved",
]
@@ -1640,11 +1736,11 @@
sources = [
"codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc",
- "codecs/isac/main/util/utility.c",
]
deps = [
":isac",
+ ":isac_test_util",
]
include_dirs = [
diff --git a/webrtc/modules/audio_device/BUILD.gn b/webrtc/modules/audio_device/BUILD.gn
index 1dee943..0b210dc 100644
--- a/webrtc/modules/audio_device/BUILD.gn
+++ b/webrtc/modules/audio_device/BUILD.gn
@@ -159,10 +159,8 @@
"mac/audio_device_mac.h",
"mac/audio_mixer_manager_mac.cc",
"mac/audio_mixer_manager_mac.h",
- "mac/portaudio/pa_memorybarrier.h",
- "mac/portaudio/pa_ringbuffer.c",
- "mac/portaudio/pa_ringbuffer.h",
]
+ deps += [ ":mac_portaudio" ]
libs = [
# Needed for CoreGraphics:
"ApplicationServices.framework",
@@ -243,6 +241,15 @@
}
}
+rtc_source_set("mac_portaudio") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
+ "mac/portaudio/pa_memorybarrier.h",
+ "mac/portaudio/pa_ringbuffer.c",
+ "mac/portaudio/pa_ringbuffer.h",
+ ]
+}
+
config("mock_audio_device_config") {
if (is_win) {
cflags = [
diff --git a/webrtc/modules/audio_processing/BUILD.gn b/webrtc/modules/audio_processing/BUILD.gn
index 36c7667..5ba9f3e 100644
--- a/webrtc/modules/audio_processing/BUILD.gn
+++ b/webrtc/modules/audio_processing/BUILD.gn
@@ -35,11 +35,6 @@
"agc/agc_manager_direct.cc",
"agc/agc_manager_direct.h",
"agc/gain_map_internal.h",
- "agc/legacy/analog_agc.c",
- "agc/legacy/analog_agc.h",
- "agc/legacy/digital_agc.c",
- "agc/legacy/digital_agc.h",
- "agc/legacy/gain_control.h",
"agc/loudness_histogram.cc",
"agc/loudness_histogram.h",
"agc/utility.cc",
@@ -168,6 +163,9 @@
"../../audio/utility:audio_frame_operations",
"../audio_coding:isac",
]
+ public_deps = [
+ ":audio_processing_c",
+ ]
if (apm_debug_dump) {
defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
@@ -198,28 +196,8 @@
if (rtc_prefer_fixed_point) {
defines += [ "WEBRTC_NS_FIXED" ]
- sources += [
- "ns/noise_suppression_x.c",
- "ns/noise_suppression_x.h",
- "ns/nsx_core.c",
- "ns/nsx_core.h",
- "ns/nsx_defines.h",
- ]
- if (current_cpu == "mipsel") {
- sources += [ "ns/nsx_core_mips.c" ]
- } else {
- sources += [ "ns/nsx_core_c.c" ]
- }
} else {
defines += [ "WEBRTC_NS_FLOAT" ]
- sources += [
- "ns/defines.h",
- "ns/noise_suppression.c",
- "ns/noise_suppression.h",
- "ns/ns_core.c",
- "ns/ns_core.h",
- "ns/windows_private.h",
- ]
}
if (current_cpu == "x86" || current_cpu == "x64") {
@@ -252,6 +230,47 @@
]
}
+rtc_source_set("audio_processing_c") {
+ visibility = [ ":*" ] # Only targets in this file can depend on this.
+ sources = [
+ "agc/legacy/analog_agc.c",
+ "agc/legacy/analog_agc.h",
+ "agc/legacy/digital_agc.c",
+ "agc/legacy/digital_agc.h",
+ "agc/legacy/gain_control.h",
+ ]
+
+ if (rtc_prefer_fixed_point) {
+ sources += [
+ "ns/noise_suppression_x.c",
+ "ns/noise_suppression_x.h",
+ "ns/nsx_core.c",
+ "ns/nsx_core.h",
+ "ns/nsx_defines.h",
+ ]
+ if (current_cpu == "mipsel") {
+ sources += [ "ns/nsx_core_mips.c" ]
+ } else {
+ sources += [ "ns/nsx_core_c.c" ]
+ }
+ } else {
+ sources += [
+ "ns/defines.h",
+ "ns/noise_suppression.c",
+ "ns/noise_suppression.h",
+ "ns/ns_core.c",
+ "ns/ns_core.h",
+ "ns/windows_private.h",
+ ]
+ }
+
+ deps = [
+ "../../base:rtc_base_approved",
+ "../../common_audio",
+ "../../system_wrappers",
+ ]
+}
+
if (rtc_enable_protobuf) {
proto_library("audioproc_debug_proto") {
sources = [
@@ -287,7 +306,6 @@
sources = [
"aec/aec_core_neon.cc",
"aecm/aecm_core_neon.cc",
- "ns/nsx_core_neon.c",
"utility/ooura_fft_neon.cc",
"utility/ooura_fft_tables_neon_sse2.h",
]
@@ -312,6 +330,9 @@
deps = [
"../../common_audio",
]
+ public_deps = [
+ ":audio_processing_neon_c",
+ ]
if (apm_debug_dump) {
defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
@@ -319,6 +340,29 @@
defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
}
}
+
+ rtc_static_library("audio_processing_neon_c") {
+ sources = [
+ "ns/nsx_core_neon.c",
+ ]
+
+ if (current_cpu != "arm64") {
+ # Enable compilation for the NEON instruction set. This is needed
+ # since //build/config/arm.gni only enables NEON for iOS, not Android.
+ # This provides the same functionality as webrtc/build/arm_neon.gypi.
+ suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
+ cflags = [ "-mfpu=neon" ]
+ }
+
+ # Disable LTO on NEON targets due to compiler bug.
+ # TODO(fdegans): Enable this. See crbug.com/408997.
+ if (rtc_use_lto) {
+ cflags -= [
+ "-flto",
+ "-ffat-lto-objects",
+ ]
+ }
+ }
}
if (rtc_include_tests) {