File: BUILD.gn

package info (click to toggle)
webrtc-audio-processing 1.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,112 kB
  • sloc: cpp: 50,766; ansic: 19,793; asm: 236; makefile: 4
file content (110 lines) | stat: -rw-r--r-- 2,493 bytes parent folder | download | duplicates (11)
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
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/arm.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")

config("common_config") {
  if (is_win) {
    defines = [
      # Required to use math constants from math.h.
      "_USE_MATH_DEFINES",
    ]
  }

  # PFFFT doesn't support SIMD on some cpus, so build a scalar version.
  if ((current_cpu == "arm" && !arm_use_neon) || current_cpu == "mipsel" ||
      current_cpu == "mips64el" || current_cpu == "ppc64" ||
      current_cpu == "s390x") {
    defines = [ "PFFFT_SIMD_DISABLE" ]
  }
}

static_library("pffft") {
  configs += [ ":common_config" ]
  sources = [
    "src/pffft.c",
    "src/pffft.h",
  ]
}

# Fuzzing.

group("fuzzers") {
  testonly = true
  deps = [
    ":pffft_complex_fuzzer",
    ":pffft_real_fuzzer",
  ]
}

fuzzer_testdata_dir = "$target_gen_dir/testdata"

action("generate_pffft_fuzzer_corpus") {
  script = "generate_seed_corpus.py"
  sources = [ "generate_seed_corpus.py" ]
  args = [ rebase_path(fuzzer_testdata_dir, root_build_dir) ]
  outputs = [ fuzzer_testdata_dir ]
}

fuzzer_test("pffft_complex_fuzzer") {
  sources = [ "pffft_fuzzer.cc" ]
  cflags = [ "-DTRANSFORM_COMPLEX" ]
  deps = [ ":pffft" ]
  seed_corpus = fuzzer_testdata_dir
  seed_corpus_deps = [ ":generate_pffft_fuzzer_corpus" ]
}

fuzzer_test("pffft_real_fuzzer") {
  sources = [ "pffft_fuzzer.cc" ]
  cflags = [ "-DTRANSFORM_REAL" ]
  deps = [ ":pffft" ]
  seed_corpus = fuzzer_testdata_dir
  seed_corpus_deps = [ ":generate_pffft_fuzzer_corpus" ]
}

# Unit tests and benchmark.

# This target must be used only for testing and benchmark purposes.
static_library("fftpack") {
  testonly = true
  configs += [ ":common_config" ]
  sources = [
    "src/fftpack.c",
    "src/fftpack.h",
  ]
  visibility = [ ":*" ]
}

config("pffft_benchmark_internal_config") {
  cflags = [
    # test_pffft.c contains an `exit(1)` following a `break` statement.
    "-Wno-unreachable-code",
  ]
}

executable("pffft_benchmark") {
  testonly = true
  configs += [
    ":common_config",
    ":pffft_benchmark_internal_config",
  ]
  sources = [ "src/test_pffft.c" ]
  deps = [
    ":fftpack",
    ":pffft",
  ]
}

test("pffft_unittest") {
  testonly = true
  sources = [ "pffft_unittest.cc" ]
  deps = [
    ":fftpack",
    ":pffft",
    "//testing/gtest",
    "//testing/gtest:gtest_main",
  ]
}