Fix for sentencepiece build with Bazel

This commit is contained in:
ozanarmagan 2023-05-09 00:58:40 +03:00
parent fb8c507e18
commit b486ee8cd3
2 changed files with 17 additions and 1 deletions

3
BUILD
View File

@ -53,7 +53,8 @@ cc_library(
"@s2geometry",
"@hnsw",
# "@zip",
"@sentencepiece"
"@sentencepiece",
"@sentencepiece//:sentencepiece_headers"
],
)

View File

@ -9,6 +9,13 @@ filegroup(
visibility = ["//visibility:public"],
)
cc_library(
name = "sentencepiece_headers",
hdrs = glob(["src/**/*.h"]),
includes = ["src"],
visibility = ["//visibility:public"],
strip_include_prefix = "src"
)
cmake(
@ -23,7 +30,15 @@ cmake(
install = False,
cache_entries = {
'SPM_USE_BUILTIN_PROTOBUF': 'OFF',
'Protobuf_LIBRARY': '$EXT_BUILD_ROOT/bazel-out/k8-fastbuild/bin/external/com_google_protobuf/',
'Protobuf_LITE_LIBRARY': '$EXT_BUILD_ROOT/bazel-out/k8-fastbuild/bin/external/com_google_protobuf/',
'Protobuf_INCLUDE_DIR': '$EXT_BUILD_ROOT/external/com_google_protobuf/src',
},
deps = [
"@com_google_protobuf//:protobuf_lite",
"@com_google_protobuf//:protobuf",
"@com_google_protobuf//:protobuf_headers",
],
postfix_script= """
echo "Intstalling sentencepiece"
cp $BUILD_TMPDIR/src/libsentencepiece.a $INSTALLDIR/lib/libsentencepiece.a