Don't use the bazel toolchain to link against libllvm
Managing versions and standard libraries to keep these compatible is
annoying, so just use a shell script to compile this one file.
Change-Id: I6167b9c6cc5395430be1ce9964dea4c1b1e6f3ad
Signed-off-by: Brian Silverman <bsilver16834@gmail.com>
diff --git a/y2020/vision/sift/BUILD b/y2020/vision/sift/BUILD
index c2a71fe..c6afc98 100644
--- a/y2020/vision/sift/BUILD
+++ b/y2020/vision/sift/BUILD
@@ -1,6 +1,8 @@
load(":fast_gaussian.bzl", "fast_gaussian")
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library", "flatbuffer_ts_library")
+# Note that this file is also used directly by :fast_gaussian_halide_generator,
+# without any dependencies added here.
cc_library(
name = "get_gaussian_kernel",
hdrs = [
@@ -21,23 +23,32 @@
],
)
-cc_binary(
- name = "fast_gaussian_generator",
+sh_binary(
+ name = "fast_gaussian_halide_generator",
srcs = [
+ "fast_gaussian_halide_generator.sh",
+ ],
+ data = [
"fast_gaussian_generator.cc",
+ "get_gaussian_kernel.h",
+ "@amd64_debian_sysroot//:sysroot_files",
+ "@deb_zlib1g_dev_1_2_11_dfsg_1_amd64_deb_repo//file",
+ "@halide_k8//:build_files",
+ "@llvm_toolchain//:all-components-x86_64-linux",
],
- linkopts = [
- "-lpthread",
- "-ldl",
- ],
- target_compatible_with = ["@platforms//os:linux"],
deps = [
- ":get_gaussian_kernel",
- "//third_party:halide",
- "//third_party:halide_gengen",
- # This somehow brings in a zlib that libllvm needs?
- # TODO(Brian): Remove this dependency, it's not really used.
- "//third_party:opencv",
+ "@bazel_tools//tools/bash/runfiles",
+ ],
+)
+
+genrule(
+ name = "run_fast_gaussian_halide_generator",
+ outs = [
+ "fast_gaussian_generator",
+ ],
+ cmd = "$(location :fast_gaussian_halide_generator) $@",
+ tools = [
+ ":fast_gaussian_halide_generator",
],
)