BUILD.gn 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Copyright 2016 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//testing/libfuzzer/fuzzer_test.gni")
  5. import("//testing/test.gni")
  6. config("ced_config") {
  7. include_dirs = [ "src" ]
  8. }
  9. config("ced_config_private") {
  10. # This cannot be set directly on the "ced" and "ced_unittests" target because
  11. # the target cflags property is added to the command-line before the cflags
  12. # property from its config. For configs, the cflags property are set in the
  13. # order public_configs, configs thus it is correctly set after the flag that
  14. # enable the error.
  15. if (is_clang) {
  16. cflags = [ "-Wno-unused-function" ]
  17. }
  18. }
  19. static_library("ced") {
  20. sources = [
  21. # find src -maxdepth 3 ! -type d | egrep '\.(h|cc)$' | grep -v test.cc |\
  22. # LC_COLLATE=c sort | sed 's/^\(.*\)$/ "\1",/'
  23. "src/compact_enc_det/compact_enc_det.cc",
  24. "src/compact_enc_det/compact_enc_det_generated_tables.h",
  25. "src/compact_enc_det/compact_enc_det_generated_tables2.h",
  26. "src/compact_enc_det/compact_enc_det_hint_code.cc",
  27. "src/compact_enc_det/compact_enc_det_hint_code.h",
  28. "src/util/basictypes.h",
  29. "src/util/case_insensitive_hash.h",
  30. "src/util/commandlineflags.h",
  31. "src/util/encodings/encodings.cc",
  32. "src/util/encodings/encodings.h",
  33. "src/util/encodings/encodings.pb.h",
  34. "src/util/languages/languages.cc",
  35. "src/util/languages/languages.h",
  36. "src/util/languages/languages.pb.h",
  37. "src/util/logging.h",
  38. "src/util/port.h",
  39. "src/util/string_util.h",
  40. "src/util/varsetter.h",
  41. ]
  42. configs -= [ "//build/config/compiler:chromium_code" ]
  43. configs += [
  44. "//build/config/compiler:no_chromium_code",
  45. ":ced_config_private",
  46. ]
  47. public_configs = [ ":ced_config" ]
  48. if (is_win) {
  49. defines = [ "COMPILER_MSVC" ]
  50. cflags = [
  51. "/wd4005", # Macro defined twice.
  52. "/wd4006", # #undef expected an identifier.
  53. "/wd4018", # '<': signed/unsigned mismatch
  54. "/wd4309", # Truncation of constant value.
  55. ]
  56. } else {
  57. defines = [ "COMPILER_GCC" ]
  58. }
  59. defines += [ "HTML5_MODE" ]
  60. }
  61. test("ced_unittests") {
  62. sources = [
  63. "src/compact_enc_det/compact_enc_det_fuzz_test.cc",
  64. "src/compact_enc_det/compact_enc_det_unittest.cc",
  65. "src/compact_enc_det/detail_head_string.inc",
  66. "src/util/encodings/encodings_unittest.cc",
  67. ]
  68. configs += [ ":ced_config_private" ]
  69. if (is_win) {
  70. defines = [ "COMPILER_MSVC" ]
  71. cflags = [
  72. "/wd4310", # Truncation of constant value.
  73. "/wd4267", # size_t -> int
  74. ]
  75. } else {
  76. defines = [ "COMPILER_GCC" ]
  77. }
  78. defines += [ "HTML5_MODE" ]
  79. deps = [
  80. ":ced",
  81. "//testing/gtest",
  82. "//testing/gtest:gtest_main",
  83. ]
  84. }
  85. fuzzer_test("compact_enc_det_fuzzer") {
  86. sources = [ "compact_enc_det_fuzzer.cc" ]
  87. deps = [
  88. ":ced",
  89. "//base/test:test_support",
  90. ]
  91. seed_corpus = "compact_enc_det_corpus"
  92. }