Skip to content

Commit 1a0a8a5

Browse files
committed
Shim
1 parent 9378e21 commit 1a0a8a5

File tree

2 files changed

+64
-3
lines changed

2 files changed

+64
-3
lines changed

targets.bzl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ def define_common_targets():
2828
srcs = ["src/regex.cpp"] + glob([
2929
"src/*_regex.cpp",
3030
]),
31-
deps = [
32-
"fbsource//third-party/pcre2:pcre2-8",
33-
],
3431
exported_headers = subdir_glob([
3532
("include", "pytorch/tokenizers/regex.h"),
3633
("include", "pytorch/tokenizers/*_regex.h"),
@@ -39,6 +36,7 @@ def define_common_targets():
3936
":headers",
4037
],
4138
exported_external_deps = [
39+
"pcre2",
4240
"re2",
4341
],
4442
visibility = ["//pytorch/tokenizers/..."],

third-party/targets.bzl

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,66 @@ def define_common_targets():
5959
":abseil",
6060
],
6161
)
62+
63+
runtime.cxx_library(
64+
name = "pcre2",
65+
srcs = [
66+
"src/pcre2_auto_possess.c",
67+
"src/pcre2_chkdint.c",
68+
"src/pcre2_compile.c",
69+
"src/pcre2_compile_cgroup.c",
70+
"src/pcre2_compile_class.c",
71+
"src/pcre2_config.c",
72+
"src/pcre2_context.c",
73+
"src/pcre2_convert.c",
74+
"src/pcre2_dfa_match.c",
75+
"src/pcre2_error.c",
76+
"src/pcre2_extuni.c",
77+
"src/pcre2_find_bracket.c",
78+
"src/pcre2_jit_compile.c",
79+
"src/pcre2_maketables.c",
80+
"src/pcre2_match.c",
81+
"src/pcre2_match_data.c",
82+
"src/pcre2_match_next.c",
83+
"src/pcre2_newline.c",
84+
"src/pcre2_ord2utf.c",
85+
"src/pcre2_pattern_info.c",
86+
"src/pcre2_script_run.c",
87+
"src/pcre2_serialize.c",
88+
"src/pcre2_string_utils.c",
89+
"src/pcre2_study.c",
90+
"src/pcre2_substitute.c",
91+
"src/pcre2_substring.c",
92+
"src/pcre2_tables.c",
93+
"src/pcre2_ucd.c",
94+
"src/pcre2_valid_utf.c",
95+
"src/pcre2_xclass.c",
96+
"src/pcre2_chartables.c",
97+
],
98+
headers = [
99+
"src/pcre2.h",
100+
"src/pcre2_compile.h",
101+
"src/pcre2_internal.h",
102+
"src/pcre2_intmodedep.h",
103+
"src/pcre2_jit_match_inc.h",
104+
"src/pcre2_jit_misc_inc.h",
105+
"src/pcre2_printint_inc.h",
106+
"src/pcre2_ucp.h",
107+
"src/pcre2_ucptables_inc.h",
108+
"src/pcre2_util.h",
109+
],
110+
header_namespace = "src",
111+
defines = [
112+
"HAVE_CONFIG_H",
113+
"HAVE_MEMMOVE",
114+
"HAVE_STRERROR",
115+
"PCRE2_CODE_UNIT_WIDTH=8",
116+
"PCpRE2_STATIC",
117+
"SUPPORT_PCRE2_8",
118+
"SUPPORT_UNICODE",
119+
] + select({
120+
"DEFAULT": ["HAVE_UNISTD_H"],
121+
"WINDOWS": [],
122+
}),
123+
visibility = ["PUBLIC"],
124+
)

0 commit comments

Comments
 (0)