| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//testing/libfuzzer/fuzzer_test.gni") | 5 import("//testing/libfuzzer/fuzzer_test.gni") |
| 6 | 6 |
| 7 if (is_win) { | 7 if (is_win) { |
| 8 import("//build/config/win/visual_studio_version.gni") | 8 import("//build/config/win/visual_studio_version.gni") |
| 9 } | 9 } |
| 10 | 10 |
| 11 config("includes") { | 11 config("includes") { |
| 12 include_dirs = [ "include" ] | 12 include_dirs = [ "include" ] |
| 13 } | 13 } |
| 14 | 14 |
| 15 source_set("headers") { |
| 16 sources = [ |
| 17 "include/brotli/decode.h", |
| 18 "include/brotli/encode.h", |
| 19 "include/brotli/port.h", |
| 20 "include/brotli/types.h", |
| 21 ] |
| 22 } |
| 23 |
| 15 static_library("common") { | 24 static_library("common") { |
| 16 sources = [ | 25 sources = [ |
| 17 "common/constants.h", | 26 "common/constants.h", |
| 18 "common/dictionary.c", | 27 "common/dictionary.c", |
| 19 "common/dictionary.h", | 28 "common/dictionary.h", |
| 20 "common/version.h", | 29 "common/version.h", |
| 21 ] | 30 ] |
| 22 public_configs = [ ":includes" ] | 31 public_configs = [ ":includes" ] |
| 32 deps = [ |
| 33 ":headers", |
| 34 ] |
| 23 } | 35 } |
| 24 | 36 |
| 25 static_library("dec") { | 37 static_library("dec") { |
| 26 sources = [ | 38 sources = [ |
| 27 "dec/bit_reader.c", | 39 "dec/bit_reader.c", |
| 28 "dec/bit_reader.h", | 40 "dec/bit_reader.h", |
| 29 "dec/context.h", | 41 "dec/context.h", |
| 30 "dec/decode.c", | 42 "dec/decode.c", |
| 31 "dec/huffman.c", | 43 "dec/huffman.c", |
| 32 "dec/huffman.h", | 44 "dec/huffman.h", |
| 33 "dec/port.h", | 45 "dec/port.h", |
| 34 "dec/prefix.h", | 46 "dec/prefix.h", |
| 35 "dec/state.c", | 47 "dec/state.c", |
| 36 "dec/state.h", | 48 "dec/state.h", |
| 37 "dec/transform.h", | 49 "dec/transform.h", |
| 38 ] | 50 ] |
| 39 public_configs = [ ":includes" ] | 51 public_configs = [ ":includes" ] |
| 40 | 52 |
| 53 public_deps = [ |
| 54 ":headers", |
| 55 ] |
| 56 |
| 41 deps = [ | 57 deps = [ |
| 42 ":common", | 58 ":common", |
| 43 ] | 59 ] |
| 44 | 60 |
| 45 configs -= [ "//build/config/compiler:chromium_code" ] | 61 configs -= [ "//build/config/compiler:chromium_code" ] |
| 46 configs += [ "//build/config/compiler:no_chromium_code" ] | 62 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 47 | 63 |
| 48 # Since we are never debug brotli, freeze the optimizations to -O2. | 64 # Since we are never debug brotli, freeze the optimizations to -O2. |
| 49 configs -= [ "//build/config/compiler:default_optimization" ] | 65 configs -= [ "//build/config/compiler:default_optimization" ] |
| 50 configs += [ "//build/config/compiler:optimize_max" ] | 66 configs += [ "//build/config/compiler:optimize_max" ] |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 "enc/utf8_util.c", | 122 "enc/utf8_util.c", |
| 107 "enc/utf8_util.h", | 123 "enc/utf8_util.h", |
| 108 "enc/write_bits.h", | 124 "enc/write_bits.h", |
| 109 "tools/bro.c", | 125 "tools/bro.c", |
| 110 ] | 126 ] |
| 111 public_configs = [ ":includes" ] | 127 public_configs = [ ":includes" ] |
| 112 | 128 |
| 113 deps = [ | 129 deps = [ |
| 114 ":common", | 130 ":common", |
| 115 ":dec", | 131 ":dec", |
| 132 ":headers", |
| 116 "//build/config/sanitizers:deps", | 133 "//build/config/sanitizers:deps", |
| 117 "//build/win:default_exe_manifest", | 134 "//build/win:default_exe_manifest", |
| 118 ] | 135 ] |
| 119 | 136 |
| 120 if (is_win && visual_studio_version == "2015") { | 137 if (is_win && visual_studio_version == "2015") { |
| 121 # Disabling "result of 32-bit shift implicitly converted to 64 bits", | 138 # Disabling "result of 32-bit shift implicitly converted to 64 bits", |
| 122 # caused by code like: foo |= (1 << i); // warning 4334 | 139 # caused by code like: foo |= (1 << i); // warning 4334 |
| 123 cflags = [ "/wd4334" ] | 140 cflags = [ "/wd4334" ] |
| 124 } | 141 } |
| 125 | 142 |
| 126 # Always build release since this is a build tool. | 143 # Always build release since this is a build tool. |
| 127 if (is_debug) { | 144 if (is_debug) { |
| 128 configs -= [ "//build/config:debug" ] | 145 configs -= [ "//build/config:debug" ] |
| 129 configs += [ "//build/config:release" ] | 146 configs += [ "//build/config:release" ] |
| 130 } | 147 } |
| 131 } | 148 } |
| 132 } | 149 } |
| 133 | 150 |
| 134 fuzzer_test("brotli_fuzzer") { | 151 fuzzer_test("brotli_fuzzer") { |
| 135 sources = [ | 152 sources = [ |
| 136 "fuzz/decode_fuzzer.cc", | 153 "fuzz/decode_fuzzer.cc", |
| 137 ] | 154 ] |
| 138 deps = [ | 155 deps = [ |
| 139 ":dec", | 156 ":dec", |
| 140 ] | 157 ] |
| 141 libfuzzer_options = [ "max_len=1280" ] | 158 libfuzzer_options = [ "max_len=1280" ] |
| 142 } | 159 } |
| OLD | NEW |