BUILD 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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("//bazel/cc_rules:defs.bzl", "cc_library", "cc_test")
  5. load("llvm_tools.bzl", "LLVM_MAIN_TOOLS", "generate_llvm_tools_def")
  6. package(default_visibility = ["//visibility:public"])
  7. cc_library(
  8. name = "for_each_macro",
  9. hdrs = ["for_each_macro.h"],
  10. deps = [
  11. "@llvm-project//llvm:Support",
  12. ],
  13. )
  14. cc_library(
  15. name = "index_base",
  16. hdrs = ["index_base.h"],
  17. deps = [
  18. "//common:ostream",
  19. "@llvm-project//llvm:Support",
  20. ],
  21. )
  22. cc_library(
  23. name = "kind_switch",
  24. hdrs = ["kind_switch.h"],
  25. deps = [
  26. ":for_each_macro",
  27. "@llvm-project//llvm:Support",
  28. ],
  29. )
  30. cc_test(
  31. name = "kind_switch_test",
  32. size = "small",
  33. srcs = ["kind_switch_test.cpp"],
  34. deps = [
  35. ":kind_switch",
  36. "//common:raw_string_ostream",
  37. "//testing/base:gtest_main",
  38. "@googletest//:gtest",
  39. ],
  40. )
  41. cc_library(
  42. name = "pretty_stack_trace_function",
  43. hdrs = ["pretty_stack_trace_function.h"],
  44. deps = [
  45. "@llvm-project//llvm:Support",
  46. ],
  47. )
  48. cc_library(
  49. name = "mem_usage",
  50. hdrs = ["mem_usage.h"],
  51. deps = [
  52. ":yaml",
  53. "//common:map",
  54. "//common:set",
  55. "@llvm-project//llvm:Support",
  56. ],
  57. )
  58. cc_library(
  59. name = "timings",
  60. hdrs = ["timings.h"],
  61. deps = [
  62. ":yaml",
  63. "@llvm-project//llvm:Support",
  64. ],
  65. )
  66. cc_library(
  67. name = "value_ids",
  68. hdrs = ["value_ids.h"],
  69. deps = [
  70. ":index_base",
  71. "//common:check",
  72. "//common:ostream",
  73. "@llvm-project//llvm:Support",
  74. ],
  75. )
  76. cc_library(
  77. name = "value_store",
  78. hdrs = ["value_store.h"],
  79. deps = [
  80. ":mem_usage",
  81. ":yaml",
  82. "//common:check",
  83. "//common:hashtable_key_context",
  84. "//common:ostream",
  85. "//common:set",
  86. "@llvm-project//llvm:Support",
  87. ],
  88. )
  89. cc_test(
  90. name = "value_store_test",
  91. size = "small",
  92. srcs = ["value_store_test.cpp"],
  93. deps = [
  94. ":value_ids",
  95. ":value_store",
  96. "//common:raw_string_ostream",
  97. "//testing/base:gtest_main",
  98. "//toolchain/testing:yaml_test_helpers",
  99. "@googletest//:gtest",
  100. ],
  101. )
  102. cc_library(
  103. name = "int",
  104. srcs = ["int.cpp"],
  105. hdrs = ["int.h"],
  106. deps = [
  107. ":index_base",
  108. ":mem_usage",
  109. ":value_store",
  110. ":yaml",
  111. "//common:check",
  112. "//common:hashtable_key_context",
  113. "//common:ostream",
  114. "//common:set",
  115. "@llvm-project//llvm:Support",
  116. ],
  117. )
  118. cc_test(
  119. name = "int_test",
  120. size = "small",
  121. srcs = ["int_test.cpp"],
  122. deps = [
  123. ":int",
  124. "//common:raw_string_ostream",
  125. "//testing/base:gtest_main",
  126. "//toolchain/testing:yaml_test_helpers",
  127. "@googletest//:gtest",
  128. ],
  129. )
  130. generate_llvm_tools_def(
  131. name = "llvm_tools_def",
  132. out = "llvm_tools.def",
  133. )
  134. config_setting(
  135. name = "is_macos",
  136. constraint_values = ["@platforms//os:macos"],
  137. )
  138. cc_library(
  139. name = "llvm_tools",
  140. srcs = ["llvm_tools.cpp"],
  141. hdrs = ["llvm_tools.h"],
  142. linkopts = select({
  143. # TODO: This should be moved upstream to LLVM's tool libraries that
  144. # require it.
  145. ":is_macos": [
  146. "-framework",
  147. "CoreFoundation",
  148. ],
  149. "//conditions:default": [],
  150. }),
  151. deps = [
  152. ":llvm_tools_def",
  153. "//common:command_line",
  154. "//common:enum_base",
  155. "@llvm-project//llvm:Support",
  156. ] + [info.lib for info in LLVM_MAIN_TOOLS.values()],
  157. )
  158. cc_library(
  159. name = "shared_value_stores",
  160. hdrs = ["shared_value_stores.h"],
  161. deps = [
  162. ":int",
  163. ":mem_usage",
  164. ":value_ids",
  165. ":value_store",
  166. ":yaml",
  167. ],
  168. )
  169. cc_test(
  170. name = "shared_value_stores_test",
  171. size = "small",
  172. srcs = ["shared_value_stores_test.cpp"],
  173. deps = [
  174. ":shared_value_stores",
  175. "//common:raw_string_ostream",
  176. "//testing/base:gtest_main",
  177. "//toolchain/testing:yaml_test_helpers",
  178. "@googletest//:gtest",
  179. ],
  180. )
  181. cc_library(
  182. name = "yaml",
  183. hdrs = ["yaml.h"],
  184. deps = [
  185. "//common:check",
  186. "//common:ostream",
  187. "@llvm-project//llvm:Support",
  188. ],
  189. )