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