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