BUILD 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
  5. package(default_visibility = ["//visibility:public"])
  6. cc_library(
  7. name = "bazel_working_dir",
  8. hdrs = ["bazel_working_dir.h"],
  9. deps = [
  10. "@llvm-project//llvm:Support",
  11. ],
  12. )
  13. cc_library(
  14. name = "command_line",
  15. srcs = ["command_line.cpp"],
  16. hdrs = ["command_line.h"],
  17. deps = [
  18. ":check",
  19. ":ostream",
  20. "@llvm-project//llvm:Support",
  21. ],
  22. )
  23. cc_test(
  24. name = "command_line_test",
  25. size = "small",
  26. srcs = ["command_line_test.cpp"],
  27. deps = [
  28. ":command_line",
  29. "//testing/base:gtest_main",
  30. "//testing/base:test_raw_ostream",
  31. "@com_google_googletest//:gtest",
  32. "@llvm-project//llvm:Support",
  33. ],
  34. )
  35. cc_library(
  36. name = "check",
  37. srcs = [
  38. "check_internal.cpp",
  39. "check_internal.h",
  40. ],
  41. hdrs = ["check.h"],
  42. deps = [
  43. ":ostream",
  44. "@llvm-project//llvm:Support",
  45. ],
  46. )
  47. cc_test(
  48. name = "check_test",
  49. size = "small",
  50. srcs = ["check_test.cpp"],
  51. deps = [
  52. ":check",
  53. "//testing/base:gtest_main",
  54. "@com_google_googletest//:gtest",
  55. ],
  56. )
  57. cc_library(
  58. name = "enum_base",
  59. hdrs = ["enum_base.h"],
  60. deps = [
  61. "//common:ostream",
  62. "@llvm-project//llvm:Support",
  63. ],
  64. )
  65. cc_library(
  66. name = "enum_base_test_def",
  67. testonly = 1,
  68. textual_hdrs = ["enum_base_test.def"],
  69. )
  70. cc_test(
  71. name = "enum_base_test",
  72. size = "small",
  73. srcs = ["enum_base_test.cpp"],
  74. deps = [
  75. ":enum_base",
  76. ":enum_base_test_def",
  77. "//testing/base:gtest_main",
  78. "//testing/base:test_raw_ostream",
  79. "@com_google_googletest//:gtest",
  80. ],
  81. )
  82. cc_library(
  83. name = "error",
  84. hdrs = ["error.h"],
  85. deps = [
  86. ":check",
  87. ":ostream",
  88. "@llvm-project//llvm:Support",
  89. ],
  90. )
  91. cc_test(
  92. name = "error_test",
  93. size = "small",
  94. srcs = ["error_test.cpp"],
  95. deps = [
  96. ":error",
  97. "//testing/base:gtest_main",
  98. "//testing/base:test_raw_ostream",
  99. "@com_google_googletest//:gtest",
  100. ],
  101. )
  102. cc_library(
  103. name = "hashing",
  104. srcs = ["hashing.cpp"],
  105. hdrs = ["hashing.h"],
  106. deps = [
  107. ":check",
  108. ":ostream",
  109. "@llvm-project//llvm:Support",
  110. ],
  111. )
  112. cc_test(
  113. name = "hashing_test",
  114. srcs = ["hashing_test.cpp"],
  115. deps = [
  116. ":hashing",
  117. "//testing/base:gtest_main",
  118. "//testing/base:test_raw_ostream",
  119. "@com_google_googletest//:gtest",
  120. "@llvm-project//llvm:Support",
  121. ],
  122. )
  123. cc_binary(
  124. name = "hashing_benchmark",
  125. testonly = 1,
  126. srcs = ["hashing_benchmark.cpp"],
  127. deps = [
  128. ":check",
  129. ":hashing",
  130. "@com_github_google_benchmark//:benchmark_main",
  131. "@com_google_absl//absl/hash",
  132. "@com_google_absl//absl/random",
  133. "@llvm-project//llvm:Support",
  134. ],
  135. )
  136. cc_library(
  137. name = "indirect_value",
  138. hdrs = ["indirect_value.h"],
  139. )
  140. cc_test(
  141. name = "indirect_value_test",
  142. size = "small",
  143. srcs = ["indirect_value_test.cpp"],
  144. deps = [
  145. ":indirect_value",
  146. "//testing/base:gtest_main",
  147. "@com_google_googletest//:gtest",
  148. ],
  149. )
  150. cc_library(
  151. name = "init_llvm",
  152. srcs = ["init_llvm.cpp"],
  153. hdrs = ["init_llvm.h"],
  154. deps = [
  155. "@llvm-project//llvm:Support",
  156. ],
  157. )
  158. # Link against this to cause `:init_llvm` to pull in all LLVM targets.
  159. #
  160. # Be careful when depending on this: it pulls in several hundred megabytes of
  161. # LLVM binary size in -c fastbuild. This should only be depended on by a
  162. # `cc_binary` or `cc_test` target, never a `cc_library`.
  163. cc_library(
  164. name = "all_llvm_targets",
  165. srcs = ["all_llvm_targets.cpp"],
  166. deps = [
  167. ":init_llvm",
  168. "@llvm-project//llvm:AllTargetsAsmParsers",
  169. "@llvm-project//llvm:AllTargetsCodeGens",
  170. "@llvm-project//llvm:Support",
  171. ],
  172. alwayslink = 1,
  173. )
  174. cc_library(
  175. name = "ostream",
  176. hdrs = ["ostream.h"],
  177. deps = [
  178. "@llvm-project//llvm:Support",
  179. ],
  180. )
  181. cc_library(
  182. name = "string_helpers",
  183. srcs = ["string_helpers.cpp"],
  184. hdrs = ["string_helpers.h"],
  185. deps = [
  186. ":check",
  187. ":error",
  188. "@llvm-project//llvm:Support",
  189. ],
  190. )
  191. cc_test(
  192. name = "string_helpers_test",
  193. size = "small",
  194. srcs = ["string_helpers_test.cpp"],
  195. deps = [
  196. ":string_helpers",
  197. "//testing/base:gtest_main",
  198. "@com_google_googletest//:gtest",
  199. "@llvm-project//llvm:Support",
  200. ],
  201. )
  202. cc_library(
  203. name = "struct_reflection",
  204. hdrs = ["struct_reflection.h"],
  205. )
  206. cc_test(
  207. name = "struct_reflection_test",
  208. size = "small",
  209. srcs = ["struct_reflection_test.cpp"],
  210. deps = [
  211. ":struct_reflection",
  212. "//testing/base:gtest_main",
  213. "@com_google_googletest//:gtest",
  214. ],
  215. )
  216. cc_library(
  217. name = "vlog",
  218. srcs = ["vlog_internal.h"],
  219. hdrs = ["vlog.h"],
  220. deps = [
  221. ":ostream",
  222. "@llvm-project//llvm:Support",
  223. ],
  224. )
  225. cc_test(
  226. name = "vlog_test",
  227. size = "small",
  228. srcs = ["vlog_test.cpp"],
  229. deps = [
  230. ":vlog",
  231. "//testing/base:gtest_main",
  232. "//testing/base:test_raw_ostream",
  233. "@com_google_googletest//:gtest",
  234. ],
  235. )