BUILD.gn 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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
  3. # found in the LICENSE file.
  4. import("//testing/libfuzzer/fuzzer_test.gni")
  5. declare_args() {
  6. # Allow individual projects to remove the warning suppression
  7. # by overriding this in their .gn file or through custom args.gn
  8. # See crbug.com/983223
  9. jsoncpp_no_deprecated_declarations = true
  10. }
  11. config("jsoncpp_config") {
  12. include_dirs = [ "source/include" ]
  13. # TODO(crbug.com/983223): Update JsonCpp BUILD.gn to remove deprecated
  14. # declaration flag.
  15. # This temporary flag allowing clients to update to the new version, and then
  16. # update to the new StreamWriter and CharReader classes.
  17. if (jsoncpp_no_deprecated_declarations &&
  18. (!is_win || (is_clang && !is_ios))) {
  19. cflags_cc = [ "-Wno-deprecated-declarations" ]
  20. }
  21. }
  22. source_set("jsoncpp") {
  23. sources = [
  24. "source/include/json/allocator.h",
  25. "source/include/json/assertions.h",
  26. "source/include/json/config.h",
  27. "source/include/json/forwards.h",
  28. "source/include/json/json.h",
  29. "source/include/json/json_features.h",
  30. "source/include/json/reader.h",
  31. "source/include/json/value.h",
  32. "source/include/json/version.h",
  33. "source/include/json/writer.h",
  34. "source/src/lib_json/json_reader.cpp",
  35. "source/src/lib_json/json_tool.h",
  36. "source/src/lib_json/json_value.cpp",
  37. "source/src/lib_json/json_writer.cpp",
  38. ]
  39. public_configs = [ ":jsoncpp_config" ]
  40. defines = [
  41. "JSON_USE_EXCEPTION=0",
  42. "JSON_USE_NULLREF=0",
  43. ]
  44. include_dirs = [ "source/src/lib_json" ]
  45. if (!is_win || is_clang) {
  46. cflags_cc = [ "-Wno-implicit-fallthrough" ]
  47. }
  48. }
  49. if (build_with_chromium) {
  50. fuzzer_test("jsoncpp_fuzzer") {
  51. sources = [ "fuzzers/json_fuzzer.cc" ]
  52. deps = [ ":jsoncpp" ]
  53. include_dirs = [ "generated" ]
  54. dict = "//testing/libfuzzer/fuzzers/dicts/json.dict"
  55. }
  56. }