BUILD 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. # Copyright 2009 The RE2 Authors. All Rights Reserved.
  2. # Use of this source code is governed by a BSD-style
  3. # license that can be found in the LICENSE file.
  4. # Bazel (http://bazel.io/) BUILD file for RE2.
  5. licenses(["notice"])
  6. exports_files(["LICENSE"])
  7. config_setting(
  8. name = "macos",
  9. values = {"cpu": "darwin"},
  10. )
  11. config_setting(
  12. name = "wasm",
  13. values = {"cpu": "wasm32"},
  14. )
  15. config_setting(
  16. name = "windows",
  17. values = {"cpu": "x64_windows"},
  18. )
  19. load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
  20. cc_library(
  21. name = "re2",
  22. srcs = [
  23. "re2/bitmap256.h",
  24. "re2/bitstate.cc",
  25. "re2/compile.cc",
  26. "re2/dfa.cc",
  27. "re2/filtered_re2.cc",
  28. "re2/mimics_pcre.cc",
  29. "re2/nfa.cc",
  30. "re2/onepass.cc",
  31. "re2/parse.cc",
  32. "re2/perl_groups.cc",
  33. "re2/pod_array.h",
  34. "re2/prefilter.cc",
  35. "re2/prefilter.h",
  36. "re2/prefilter_tree.cc",
  37. "re2/prefilter_tree.h",
  38. "re2/prog.cc",
  39. "re2/prog.h",
  40. "re2/re2.cc",
  41. "re2/regexp.cc",
  42. "re2/regexp.h",
  43. "re2/set.cc",
  44. "re2/simplify.cc",
  45. "re2/sparse_array.h",
  46. "re2/sparse_set.h",
  47. "re2/stringpiece.cc",
  48. "re2/tostring.cc",
  49. "re2/unicode_casefold.cc",
  50. "re2/unicode_casefold.h",
  51. "re2/unicode_groups.cc",
  52. "re2/unicode_groups.h",
  53. "re2/walker-inl.h",
  54. "util/logging.h",
  55. "util/mix.h",
  56. "util/mutex.h",
  57. "util/rune.cc",
  58. "util/strutil.cc",
  59. "util/strutil.h",
  60. "util/utf.h",
  61. "util/util.h",
  62. ],
  63. hdrs = [
  64. "re2/filtered_re2.h",
  65. "re2/re2.h",
  66. "re2/set.h",
  67. "re2/stringpiece.h",
  68. ],
  69. copts = select({
  70. ":wasm": [],
  71. ":windows": [],
  72. "//conditions:default": ["-pthread"],
  73. }),
  74. linkopts = select({
  75. # macOS doesn't need `-pthread' when linking and it appears that
  76. # older versions of Clang will warn about the unused command line
  77. # argument, so just don't pass it.
  78. ":macos": [],
  79. ":wasm": [],
  80. ":windows": [],
  81. "//conditions:default": ["-pthread"],
  82. }),
  83. visibility = ["//visibility:public"],
  84. )
  85. cc_library(
  86. name = "testing",
  87. testonly = 1,
  88. srcs = [
  89. "re2/testing/backtrack.cc",
  90. "re2/testing/dump.cc",
  91. "re2/testing/exhaustive_tester.cc",
  92. "re2/testing/null_walker.cc",
  93. "re2/testing/regexp_generator.cc",
  94. "re2/testing/string_generator.cc",
  95. "re2/testing/tester.cc",
  96. "util/pcre.cc",
  97. ],
  98. hdrs = [
  99. "re2/testing/exhaustive_tester.h",
  100. "re2/testing/regexp_generator.h",
  101. "re2/testing/string_generator.h",
  102. "re2/testing/tester.h",
  103. "util/benchmark.h",
  104. "util/flags.h",
  105. "util/malloc_counter.h",
  106. "util/pcre.h",
  107. "util/test.h",
  108. ],
  109. deps = [":re2"],
  110. )
  111. cc_library(
  112. name = "test",
  113. testonly = 1,
  114. srcs = ["util/test.cc"],
  115. deps = [":testing"],
  116. )
  117. cc_test(
  118. name = "charclass_test",
  119. size = "small",
  120. srcs = ["re2/testing/charclass_test.cc"],
  121. deps = [":test"],
  122. )
  123. cc_test(
  124. name = "compile_test",
  125. size = "small",
  126. srcs = ["re2/testing/compile_test.cc"],
  127. deps = [":test"],
  128. )
  129. cc_test(
  130. name = "filtered_re2_test",
  131. size = "small",
  132. srcs = ["re2/testing/filtered_re2_test.cc"],
  133. deps = [":test"],
  134. )
  135. cc_test(
  136. name = "mimics_pcre_test",
  137. size = "small",
  138. srcs = ["re2/testing/mimics_pcre_test.cc"],
  139. deps = [":test"],
  140. )
  141. cc_test(
  142. name = "parse_test",
  143. size = "small",
  144. srcs = ["re2/testing/parse_test.cc"],
  145. deps = [":test"],
  146. )
  147. cc_test(
  148. name = "possible_match_test",
  149. size = "small",
  150. srcs = ["re2/testing/possible_match_test.cc"],
  151. deps = [":test"],
  152. )
  153. cc_test(
  154. name = "re2_arg_test",
  155. size = "small",
  156. srcs = ["re2/testing/re2_arg_test.cc"],
  157. deps = [":test"],
  158. )
  159. cc_test(
  160. name = "re2_test",
  161. size = "small",
  162. srcs = ["re2/testing/re2_test.cc"],
  163. deps = [":test"],
  164. )
  165. cc_test(
  166. name = "regexp_test",
  167. size = "small",
  168. srcs = ["re2/testing/regexp_test.cc"],
  169. deps = [":test"],
  170. )
  171. cc_test(
  172. name = "required_prefix_test",
  173. size = "small",
  174. srcs = ["re2/testing/required_prefix_test.cc"],
  175. deps = [":test"],
  176. )
  177. cc_test(
  178. name = "search_test",
  179. size = "small",
  180. srcs = ["re2/testing/search_test.cc"],
  181. deps = [":test"],
  182. )
  183. cc_test(
  184. name = "set_test",
  185. size = "small",
  186. srcs = ["re2/testing/set_test.cc"],
  187. deps = [":test"],
  188. )
  189. cc_test(
  190. name = "simplify_test",
  191. size = "small",
  192. srcs = ["re2/testing/simplify_test.cc"],
  193. deps = [":test"],
  194. )
  195. cc_test(
  196. name = "string_generator_test",
  197. size = "small",
  198. srcs = ["re2/testing/string_generator_test.cc"],
  199. deps = [":test"],
  200. )
  201. cc_test(
  202. name = "dfa_test",
  203. size = "large",
  204. srcs = ["re2/testing/dfa_test.cc"],
  205. deps = [":test"],
  206. )
  207. cc_test(
  208. name = "exhaustive1_test",
  209. size = "large",
  210. srcs = ["re2/testing/exhaustive1_test.cc"],
  211. deps = [":test"],
  212. )
  213. cc_test(
  214. name = "exhaustive2_test",
  215. size = "large",
  216. srcs = ["re2/testing/exhaustive2_test.cc"],
  217. deps = [":test"],
  218. )
  219. cc_test(
  220. name = "exhaustive3_test",
  221. size = "large",
  222. srcs = ["re2/testing/exhaustive3_test.cc"],
  223. deps = [":test"],
  224. )
  225. cc_test(
  226. name = "exhaustive_test",
  227. size = "large",
  228. srcs = ["re2/testing/exhaustive_test.cc"],
  229. deps = [":test"],
  230. )
  231. cc_test(
  232. name = "random_test",
  233. size = "large",
  234. srcs = ["re2/testing/random_test.cc"],
  235. deps = [":test"],
  236. )
  237. cc_library(
  238. name = "benchmark",
  239. testonly = 1,
  240. srcs = ["util/benchmark.cc"],
  241. deps = [":testing"],
  242. )
  243. cc_binary(
  244. name = "regexp_benchmark",
  245. testonly = 1,
  246. srcs = ["re2/testing/regexp_benchmark.cc"],
  247. deps = [":benchmark"],
  248. )