Merge OOURA BUILD.gn files.

No-Tree-Checks: True
No-Try: True
Bug: webrtc:11509
Change-Id: If66483a02085396e231986e39ef0dafcdd3f4bed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173740
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Per Ã…hgren <peah@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31114}
diff --git a/common_audio/BUILD.gn b/common_audio/BUILD.gn
index 36f723d..72eed1f 100644
--- a/common_audio/BUILD.gn
+++ b/common_audio/BUILD.gn
@@ -55,7 +55,7 @@
     "../rtc_base/system:file_wrapper",
     "../system_wrappers",
     "../system_wrappers:cpu_features_api",
-    "third_party/ooura/fft_size_256:fft4g",
+    "third_party/ooura:fft_size_256",
     "//third_party/abseil-cpp/absl/types:optional",
   ]
 
@@ -185,7 +185,7 @@
     "../rtc_base/system:arch",
     "../system_wrappers",
     "../system_wrappers:cpu_features_api",
-    "third_party/ooura/fft_size_256:fft4g",
+    "third_party/ooura:fft_size_256",
     "third_party/spl_sqrt_floor",
   ]
 }
diff --git a/common_audio/third_party/ooura/BUILD.gn b/common_audio/third_party/ooura/BUILD.gn
new file mode 100644
index 0000000..742f620
--- /dev/null
+++ b/common_audio/third_party/ooura/BUILD.gn
@@ -0,0 +1,58 @@
+# Copyright (c) 2020 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("../../../webrtc.gni")
+
+rtc_library("fft_size_128") {
+  sources = [
+    "fft_size_128/ooura_fft.cc",
+    "fft_size_128/ooura_fft.h",
+    "fft_size_128/ooura_fft_tables_common.h",
+  ]
+  deps = [
+    "../../../rtc_base/system:arch",
+    "../../../system_wrappers:cpu_features_api",
+  ]
+  cflags = []
+
+  if (current_cpu == "x86" || current_cpu == "x64") {
+    sources += [
+      "fft_size_128/ooura_fft_sse2.cc",
+      "fft_size_128/ooura_fft_tables_neon_sse2.h",
+    ]
+    if (is_posix || is_fuchsia) {
+      cflags += [ "-msse2" ]
+    }
+  }
+
+  if (rtc_build_with_neon) {
+    sources += [
+      "fft_size_128/ooura_fft_neon.cc",
+      "fft_size_128/ooura_fft_tables_neon_sse2.h",
+    ]
+
+    deps += [ "../../../common_audio" ]
+
+    if (current_cpu != "arm64") {
+      # Enable compilation for the NEON instruction set.
+      suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
+      cflags += [ "-mfpu=neon" ]
+    }
+  }
+
+  if (current_cpu == "mipsel" && mips_float_abi == "hard") {
+    sources += [ "fft_size_128/ooura_fft_mips.cc" ]
+  }
+}
+
+rtc_library("fft_size_256") {
+  sources = [
+    "fft_size_256/fft4g.cc",
+    "fft_size_256/fft4g.h",
+  ]
+}
diff --git a/common_audio/third_party/ooura/fft_size_128/BUILD.gn b/common_audio/third_party/ooura/fft_size_128/BUILD.gn
deleted file mode 100644
index cbafc7b..0000000
--- a/common_audio/third_party/ooura/fft_size_128/BUILD.gn
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright (c) 2020 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("../../../../webrtc.gni")
-
-rtc_library("ooura_fft") {
-  sources = [
-    "ooura_fft.cc",
-    "ooura_fft.h",
-    "ooura_fft_tables_common.h",
-  ]
-  deps = [
-    "../../../../rtc_base/system:arch",
-    "../../../../system_wrappers:cpu_features_api",
-  ]
-  cflags = []
-
-  if (current_cpu == "x86" || current_cpu == "x64") {
-    sources += [
-      "ooura_fft_sse2.cc",
-      "ooura_fft_tables_neon_sse2.h",
-    ]
-    if (is_posix || is_fuchsia) {
-      cflags += [ "-msse2" ]
-    }
-  }
-
-  if (rtc_build_with_neon) {
-    sources += [
-      "ooura_fft_neon.cc",
-      "ooura_fft_tables_neon_sse2.h",
-    ]
-
-    deps += [ "../../../../common_audio" ]
-
-    if (current_cpu != "arm64") {
-      # Enable compilation for the NEON instruction set.
-      suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
-      cflags += [ "-mfpu=neon" ]
-    }
-  }
-
-  if (current_cpu == "mipsel" && mips_float_abi == "hard") {
-    sources += [ "ooura_fft_mips.cc" ]
-  }
-}
diff --git a/common_audio/third_party/ooura/fft_size_256/BUILD.gn b/common_audio/third_party/ooura/fft_size_256/BUILD.gn
deleted file mode 100644
index 030867b..0000000
--- a/common_audio/third_party/ooura/fft_size_256/BUILD.gn
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright (c) 2020 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("../../../../webrtc.gni")
-
-rtc_library("fft4g") {
-  sources = [
-    "fft4g.cc",
-    "fft4g.h",
-  ]
-}
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index ffda2da..69f94fa 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -164,7 +164,7 @@
     "../../api/audio:echo_control",
     "../../audio/utility:audio_frame_operations",
     "../../common_audio:common_audio_c",
-    "../../common_audio/third_party/ooura/fft_size_256:fft4g",
+    "../../common_audio/third_party/ooura:fft_size_256",
     "../../rtc_base:checks",
     "../../rtc_base:deprecation",
     "../../rtc_base:gtest_prod",
diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn
index 9f6b6eb..d07ffa6 100644
--- a/modules/audio_processing/aec3/BUILD.gn
+++ b/modules/audio_processing/aec3/BUILD.gn
@@ -140,7 +140,7 @@
     "../../../api/audio:aec3_config",
     "../../../api/audio:echo_control",
     "../../../common_audio:common_audio_c",
-    "../../../common_audio/third_party/ooura/fft_size_128:ooura_fft",
+    "../../../common_audio/third_party/ooura:fft_size_128",
     "../../../rtc_base:checks",
     "../../../rtc_base:rtc_base_approved",
     "../../../rtc_base:safe_minmax",
diff --git a/modules/audio_processing/agc/BUILD.gn b/modules/audio_processing/agc/BUILD.gn
index 43612d6..42830c9 100644
--- a/modules/audio_processing/agc/BUILD.gn
+++ b/modules/audio_processing/agc/BUILD.gn
@@ -75,7 +75,7 @@
   deps = [
     "../../../common_audio",
     "../../../common_audio:common_audio_c",
-    "../../../common_audio/third_party/ooura/fft_size_256:fft4g",
+    "../../../common_audio/third_party/ooura:fft_size_256",
     "../../../rtc_base:checks",
     "../../../rtc_base:rtc_base_approved",
     "../../../system_wrappers:cpu_features_api",
diff --git a/modules/audio_processing/agc2/BUILD.gn b/modules/audio_processing/agc2/BUILD.gn
index 0d1c956..8d9bb14 100644
--- a/modules/audio_processing/agc2/BUILD.gn
+++ b/modules/audio_processing/agc2/BUILD.gn
@@ -150,7 +150,7 @@
     "..:audio_frame_view",
     "../../../api:array_view",
     "../../../common_audio",
-    "../../../common_audio/third_party/ooura/fft_size_128:ooura_fft",
+    "../../../common_audio/third_party/ooura:fft_size_128",
     "../../../rtc_base:checks",
     "../../../rtc_base:macromagic",
   ]
diff --git a/modules/audio_processing/ns/BUILD.gn b/modules/audio_processing/ns/BUILD.gn
index b988239..442a313 100644
--- a/modules/audio_processing/ns/BUILD.gn
+++ b/modules/audio_processing/ns/BUILD.gn
@@ -54,8 +54,8 @@
     "..:high_pass_filter",
     "../../../api:array_view",
     "../../../common_audio:common_audio_c",
-    "../../../common_audio/third_party/ooura/fft_size_128:ooura_fft",
-    "../../../common_audio/third_party/ooura/fft_size_256:fft4g",
+    "../../../common_audio/third_party/ooura:fft_size_128",
+    "../../../common_audio/third_party/ooura:fft_size_256",
     "../../../rtc_base:checks",
     "../../../rtc_base:rtc_base_approved",
     "../../../rtc_base:safe_minmax",
diff --git a/modules/audio_processing/transient/BUILD.gn b/modules/audio_processing/transient/BUILD.gn
index 9df9323..984ffbf 100644
--- a/modules/audio_processing/transient/BUILD.gn
+++ b/modules/audio_processing/transient/BUILD.gn
@@ -52,7 +52,7 @@
     "../../../common_audio:common_audio_c",
     "../../../common_audio:fir_filter",
     "../../../common_audio:fir_filter_factory",
-    "../../../common_audio/third_party/ooura/fft_size_256:fft4g",
+    "../../../common_audio/third_party/ooura:fft_size_256",
     "../../../rtc_base:checks",
     "../../../rtc_base:gtest_prod",
     "../../../rtc_base:logging",
diff --git a/modules/audio_processing/vad/BUILD.gn b/modules/audio_processing/vad/BUILD.gn
index 9f48883..71e079d 100644
--- a/modules/audio_processing/vad/BUILD.gn
+++ b/modules/audio_processing/vad/BUILD.gn
@@ -38,7 +38,7 @@
     "../../../audio/utility:audio_frame_operations",
     "../../../common_audio",
     "../../../common_audio:common_audio_c",
-    "../../../common_audio/third_party/ooura/fft_size_256:fft4g",
+    "../../../common_audio/third_party/ooura:fft_size_256",
     "../../../rtc_base:checks",
     "../../audio_coding:isac_vad",
   ]