blob: 5e0dd3c0f2c711bbe8a7d6ba1a6354259800fffd [file] [log] [blame]
Ryan Harrison548ee542024-05-29 03:21:13 +00001# Clean copy of third_party/libprotobuf-mutator/BUILD.gn from
2# Chromium, with non-relavent portions removed
3
4# Copyright 2017 The Chromium Authors
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
8import("//build/config/sanitizers/sanitizers.gni")
9import("//testing/libfuzzer/fuzzer_test.gni")
10
11config("public_config") {
12 include_dirs = [ "src/" ]
13}
14
15config("private_config") {
16 cflags = [ "-Wno-shadow" ]
17}
18
19source_set("libprotobuf-mutator") {
20 testonly = true
21
22 # Remove *San and coverage for a performance boost.
23 configs -= not_fuzzed_remove_configs
24 configs += [
25 "//build/config/sanitizers:not_fuzzed",
26 ":private_config",
27 ]
28
29 public_configs = [ ":public_config" ]
30
31 sources = [
32 "src/src/binary_format.cc",
33 "src/src/libfuzzer/libfuzzer_macro.cc",
34 "src/src/libfuzzer/libfuzzer_mutator.cc",
35 "src/src/mutator.cc",
36 "src/src/text_format.cc",
37 "src/src/utf8_fix.cc",
38 ]
39
40 # Allow users of LPM to use protobuf reflection and other features from
41 # protobuf_full.
42 public_deps = [ "//third_party/protobuf:protobuf_full" ]
43
44 # Let ClusterFuzz builders know to not build targets that depend on
45 # libprotobuf-mutator for AFL or Chrome OS.
46 if (use_afl || current_toolchain == "//build/toolchain/cros:target") {
47 all_dependent_configs = [ "//testing/libfuzzer:no_clusterfuzz" ]
48 }
49}