BUILD.gn 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. config("qcms_config") {
  6. include_dirs = [ "src" ]
  7. }
  8. disable_qcms = false
  9. static_library("qcms") {
  10. if (disable_qcms) {
  11. sources = [ "src/empty.c" ]
  12. } else {
  13. sources = [
  14. "src/chain.c",
  15. "src/chain.h",
  16. "src/iccread.c",
  17. "src/matrix.c",
  18. "src/matrix.h",
  19. "src/qcms.h",
  20. "src/qcms_util.c",
  21. "src/qcmsint.h",
  22. "src/qcmstypes.h",
  23. "src/transform.c",
  24. "src/transform_util.c",
  25. "src/transform_util.h",
  26. ]
  27. defines = []
  28. if (current_cpu == "x86" || current_cpu == "x64") {
  29. defines += [ "SSE2_ENABLE" ]
  30. sources += [ "src/transform-sse2.c" ]
  31. }
  32. if (use_fuzzing_engine) {
  33. defines += [ "USE_LIBFUZZER" ]
  34. }
  35. }
  36. configs -= [ "//build/config/compiler:chromium_code" ]
  37. configs += [ "//build/config/compiler:no_chromium_code" ]
  38. public_configs = [ ":qcms_config" ]
  39. if (is_win) {
  40. cflags = [
  41. "/wd4018", # Signed/unsigned mismatch in comparison.
  42. "/wd4056", # Overflow in floating-point constant arithmetic (INFINITY).
  43. "/wd4756", # Overflow in constant arithmetic (INFINITY).
  44. ]
  45. }
  46. }
  47. # fuzzers BUILD depends on this target. Needed for package discovery
  48. group("fuzzers") {
  49. }
  50. fuzzer_test("qcms_color_space_fuzzer") {
  51. sources = [
  52. "//testing/libfuzzer/fuzzers/color_space_data.h",
  53. "qcms_color_space_fuzzer.cc",
  54. ]
  55. deps = [
  56. ":qcms",
  57. "//base",
  58. ]
  59. dict = "//testing/libfuzzer/fuzzers/dicts/icc.dict"
  60. libfuzzer_options = [ "max_len=4194304" ]
  61. }
  62. if (!disable_qcms) {
  63. executable("qcms_tests") {
  64. if (current_cpu == "x86" || current_cpu == "x64") {
  65. defines = [ "SSE2_ENABLE" ]
  66. }
  67. sources = [
  68. "src/tests/qcms_test_internal_srgb.c",
  69. "src/tests/qcms_test_main.c",
  70. "src/tests/qcms_test_munsell.c",
  71. "src/tests/qcms_test_ntsc_gamut.c",
  72. "src/tests/qcms_test_output_trc.c",
  73. "src/tests/qcms_test_tetra_clut_rgba.c",
  74. "src/tests/qcms_test_util.c",
  75. ]
  76. deps = [
  77. "//build/win:default_exe_manifest",
  78. "//third_party/qcms",
  79. ]
  80. configs -= [ "//build/config/compiler:chromium_code" ]
  81. configs += [ "//build/config/compiler:no_chromium_code" ]
  82. public_configs = [ ":qcms_config" ]
  83. }
  84. }