BUILD.gn 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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("//build/buildflag_header.gni")
  5. import("//sandbox/features.gni")
  6. import("//testing/libfuzzer/fuzzer_test.gni")
  7. import("//testing/test.gni")
  8. # Several targets want to include this header file. We separate it out
  9. # here so multiple targets can depend on it.
  10. source_set("sandbox_export") {
  11. sources = [ "sandbox_export.h" ]
  12. }
  13. source_set("common") {
  14. sources = [
  15. "constants.h",
  16. "features.cc",
  17. "features.h",
  18. ]
  19. deps = [
  20. "//base:base",
  21. "//sandbox:sandbox_buildflags",
  22. ]
  23. }
  24. test("sandbox_unittests") {
  25. deps = [
  26. "//base/test:run_all_unittests",
  27. "//sandbox/policy:tests",
  28. "//testing/gtest",
  29. ]
  30. if (is_mac) {
  31. deps += [ "//sandbox/mac:sandbox_unittests" ]
  32. }
  33. }
  34. # Meta-target that forwards to the proper platform one.
  35. group("sandbox") {
  36. if (is_win) {
  37. public_deps = [ "//sandbox/win:sandbox" ]
  38. } else if (is_mac) {
  39. public_deps = [
  40. "//sandbox/mac:seatbelt",
  41. "//sandbox/mac:seatbelt_extension",
  42. "//sandbox/mac:system_services",
  43. "//sandbox/mac/mojom",
  44. ]
  45. } else if (is_linux || is_chromeos || is_android) {
  46. public_deps = [ "//sandbox/linux:sandbox" ]
  47. }
  48. }
  49. buildflag_header("sandbox_buildflags") {
  50. header = "sandbox_buildflags.h"
  51. flags = [
  52. "USE_SECCOMP_BPF=$use_seccomp_bpf",
  53. "DISABLE_SECCOMP_SSBD=$disable_seccomp_ssbd",
  54. ]
  55. }
  56. # This target must be here and not in win/ otherwise it would require a full
  57. # parse of win/BUILD.gn which fails on non-Windows platforms.
  58. #
  59. # Although the code is Windows-based, the fuzzer is designed to work on Linux,
  60. # so do not disable this fuzzer on non-Windows platforms.
  61. fuzzer_test("sandbox_ipc_fuzzer") {
  62. sources = [
  63. "win/fuzzer/fuzzer_types.h",
  64. "win/fuzzer/sandbox_ipc_fuzzer.cc",
  65. "win/src/crosscall_server.cc",
  66. "win/src/ipc_args.cc",
  67. ]
  68. if (!is_win) {
  69. defines = [ "SANDBOX_FUZZ_TARGET" ]
  70. }
  71. deps = [
  72. ":sandbox",
  73. "//base",
  74. ]
  75. dict = "ipc.dict"
  76. libfuzzer_options = [ "max_len=1024" ]
  77. }