BUILD 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
  2. MSVC_C_OPTS = [
  3. "-WX",
  4. "-DWIN32",
  5. "-DWIN32_LEAN_AND_MEAN",
  6. ]
  7. POSIX_C_OPTS = [
  8. "-Wall",
  9. "-Wextra",
  10. "-Werror",
  11. "-Wnon-virtual-dtor",
  12. "-Woverloaded-virtual",
  13. "-Wold-style-cast",
  14. "-std=c++14",
  15. ]
  16. config_setting(
  17. name = "windows_x86_64",
  18. values = {"cpu": "x64_windows"},
  19. )
  20. cc_binary(
  21. name = "cc-harness",
  22. srcs = ["harness.cc"],
  23. # These ensure that we are at least compatible with what Envoy is expecting.
  24. copts = select({
  25. ":windows_x86_64": MSVC_C_OPTS,
  26. "//conditions:default": POSIX_C_OPTS,
  27. }),
  28. visibility = ["//visibility:public"],
  29. deps = [
  30. "//tests/harness:harness_cc_proto",
  31. "//tests/harness/cases:cc",
  32. ],
  33. )
  34. # Ensure that if the headers are included in multiple libraries, those libraries
  35. # can be linked without conflicts.
  36. cc_test(
  37. name = "cc_diamond_test",
  38. srcs = ["diamond_test.cc"],
  39. copts = select({
  40. ":windows_x86_64": MSVC_C_OPTS,
  41. "//conditions:default": POSIX_C_OPTS,
  42. }),
  43. linkstatic = 1, # Forces both libraries to be linked in. DO NOT REMOVE THIS
  44. deps = [
  45. "cc_diamond_0",
  46. "cc_diamond_1",
  47. ],
  48. )
  49. cc_library(
  50. name = "cc_diamond_0",
  51. srcs = ["diamond_lib.cc"],
  52. copts = select({
  53. ":windows_x86_64": MSVC_C_OPTS,
  54. "//conditions:default": POSIX_C_OPTS,
  55. }),
  56. deps = ["//tests/harness/cases:cc"],
  57. alwayslink = 1,
  58. )
  59. cc_library(
  60. name = "cc_diamond_1",
  61. srcs = ["diamond_lib.cc"],
  62. copts = select({
  63. ":windows_x86_64": MSVC_C_OPTS,
  64. "//conditions:default": POSIX_C_OPTS,
  65. }),
  66. deps = ["//tests/harness/cases:cc"],
  67. alwayslink = 1,
  68. )