Separate build targets for aec3 and aec3_unittests

Bug: webrtc:8844
Change-Id: Id6a98eae19aaedc87c3f402a004f58f0290d5c28
Reviewed-on: https://webrtc-review.googlesource.com/56580
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22173}
diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn
new file mode 100644
index 0000000..0ac47fb
--- /dev/null
+++ b/modules/audio_processing/aec3/BUILD.gn
@@ -0,0 +1,199 @@
+# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS.  All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("//build/config/arm.gni")
+import("../../../webrtc.gni")
+
+config("apm_debug_dump") {
+  if (apm_debug_dump) {
+    defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
+  } else {
+    defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
+  }
+}
+
+rtc_static_library("aec3") {
+  visibility = [ "*" ]
+  configs += [ ":apm_debug_dump" ]
+  sources = [
+    "adaptive_fir_filter.cc",
+    "adaptive_fir_filter.h",
+    "aec3_common.cc",
+    "aec3_common.h",
+    "aec3_fft.cc",
+    "aec3_fft.h",
+    "aec_state.cc",
+    "aec_state.h",
+    "block_framer.cc",
+    "block_framer.h",
+    "block_processor.cc",
+    "block_processor.h",
+    "block_processor_metrics.cc",
+    "block_processor_metrics.h",
+    "cascaded_biquad_filter.cc",
+    "cascaded_biquad_filter.h",
+    "comfort_noise_generator.cc",
+    "comfort_noise_generator.h",
+    "decimator.cc",
+    "decimator.h",
+    "delay_estimate.h",
+    "downsampled_render_buffer.cc",
+    "downsampled_render_buffer.h",
+    "echo_canceller3.cc",
+    "echo_canceller3.h",
+    "echo_path_delay_estimator.cc",
+    "echo_path_delay_estimator.h",
+    "echo_path_variability.cc",
+    "echo_path_variability.h",
+    "echo_remover.cc",
+    "echo_remover.h",
+    "echo_remover_metrics.cc",
+    "echo_remover_metrics.h",
+    "erl_estimator.cc",
+    "erl_estimator.h",
+    "erle_estimator.cc",
+    "erle_estimator.h",
+    "fft_buffer.cc",
+    "fft_buffer.h",
+    "fft_data.h",
+    "frame_blocker.cc",
+    "frame_blocker.h",
+    "main_filter_update_gain.cc",
+    "main_filter_update_gain.h",
+    "matched_filter.cc",
+    "matched_filter.h",
+    "matched_filter_lag_aggregator.cc",
+    "matched_filter_lag_aggregator.h",
+    "matrix_buffer.cc",
+    "matrix_buffer.h",
+    "output_selector.cc",
+    "output_selector.h",
+    "render_buffer.cc",
+    "render_buffer.h",
+    "render_delay_buffer.cc",
+    "render_delay_buffer.h",
+    "render_delay_controller.cc",
+    "render_delay_controller.h",
+    "render_delay_controller_metrics.cc",
+    "render_delay_controller_metrics.h",
+    "render_signal_analyzer.cc",
+    "render_signal_analyzer.h",
+    "residual_echo_estimator.cc",
+    "residual_echo_estimator.h",
+    "shadow_filter_update_gain.cc",
+    "shadow_filter_update_gain.h",
+    "skew_estimator.cc",
+    "skew_estimator.h",
+    "subtractor.cc",
+    "subtractor.h",
+    "subtractor_output.h",
+    "suppression_filter.cc",
+    "suppression_filter.h",
+    "suppression_gain.cc",
+    "suppression_gain.h",
+    "vector_buffer.cc",
+    "vector_buffer.h",
+    "vector_math.h",
+  ]
+
+  defines = []
+  deps = [
+    "..:aec_core",
+    "..:apm_logging",
+    "..:audio_processing",
+    "../../..:typedefs",
+    "../../../api:array_view",
+    "../../../api:optional",
+    "../../../api/audio:aec3_config",
+    "../../../api/audio:echo_control",
+    "../../../common_audio:common_audio_c",
+    "../../../rtc_base:checks",
+    "../../../rtc_base:rtc_base_approved",
+    "../../../system_wrappers:cpu_features_api",
+    "../../../system_wrappers:metrics_api",
+  ]
+
+  configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
+}
+
+if (rtc_include_tests) {
+  rtc_source_set("aec3_unittests") {
+    testonly = true
+
+    configs += [ ":apm_debug_dump" ]
+    sources = [
+      "mock/mock_block_processor.h",
+      "mock/mock_echo_remover.h",
+      "mock/mock_render_delay_buffer.h",
+      "mock/mock_render_delay_controller.h",
+    ]
+
+    deps = [
+      ":aec3",
+      "..:apm_logging",
+      "..:audio_processing",
+      "..:audio_processing_unittests",
+      "../../..:typedefs",
+      "../../../api:array_view",
+      "../../../api:optional",
+      "../../../api/audio:aec3_config",
+      "../../../rtc_base:checks",
+      "../../../rtc_base:rtc_base_approved",
+      "../../../system_wrappers:cpu_features_api",
+      "../../../test:test_support",
+    ]
+
+    defines = []
+
+    if (rtc_enable_protobuf) {
+      sources += [
+        "adaptive_fir_filter_unittest.cc",
+        "aec3_fft_unittest.cc",
+        "aec_state_unittest.cc",
+        "block_framer_unittest.cc",
+        "block_processor_metrics_unittest.cc",
+        "block_processor_unittest.cc",
+        "cascaded_biquad_filter_unittest.cc",
+        "comfort_noise_generator_unittest.cc",
+        "decimator_unittest.cc",
+        "echo_canceller3_unittest.cc",
+        "echo_path_delay_estimator_unittest.cc",
+        "echo_path_variability_unittest.cc",
+        "echo_remover_metrics_unittest.cc",
+        "echo_remover_unittest.cc",
+        "erl_estimator_unittest.cc",
+        "erle_estimator_unittest.cc",
+        "fft_data_unittest.cc",
+        "frame_blocker_unittest.cc",
+        "main_filter_update_gain_unittest.cc",
+        "matched_filter_lag_aggregator_unittest.cc",
+        "matched_filter_unittest.cc",
+        "output_selector_unittest.cc",
+        "render_buffer_unittest.cc",
+        "render_delay_buffer_unittest.cc",
+        "render_delay_controller_metrics_unittest.cc",
+        "render_delay_controller_unittest.cc",
+        "render_signal_analyzer_unittest.cc",
+        "residual_echo_estimator_unittest.cc",
+        "shadow_filter_update_gain_unittest.cc",
+        "skew_estimator_unittest.cc",
+        "subtractor_unittest.cc",
+        "suppression_filter_unittest.cc",
+        "suppression_gain_unittest.cc",
+        "vector_math_unittest.cc",
+      ]
+    }
+
+    if ((!build_with_chromium || is_win) && is_clang) {
+      # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
+      suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
+    }
+
+    configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
+  }
+}