anki/pylib/rsbridge/BUILD.bazel

54 lines
1.2 KiB
Python
Raw Normal View History

load("@rules_rust//rust:defs.bzl", "rust_shared_library")
load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script")
2020-11-02 06:02:30 +01:00
load("@bazel_skylib//lib:selects.bzl", "selects")
load("//rslib:rustfmt.bzl", "rustfmt_fix", "rustfmt_test")
cargo_build_script(
name = "build_script",
srcs = ["build.rs"],
build_script_env = {
"PYO3_PYTHON": "$(location @python)",
},
data = [
"@python",
],
2020-11-02 06:02:30 +01:00
)
rust_shared_library(
2020-11-02 06:02:30 +01:00
name = "rsbridge",
srcs = ["lib.rs"],
rustc_flags = selects.with_or({
(
"@rules_rust//rust/platform:x86_64-apple-darwin",
2021-10-15 15:28:10 +02:00
"@rules_rust//rust/platform:aarch64-apple-darwin",
2020-11-02 06:02:30 +01:00
): [
"-Clink-arg=-undefined",
"-Clink-arg=dynamic_lookup",
"-Clink-arg=-mmacosx-version-min=10.13",
2020-11-02 06:02:30 +01:00
],
"//conditions:default": [],
}),
visibility = [
"//pylib:__subpackages__",
],
deps = [
":build_script",
2020-11-24 09:41:03 +01:00
"//pylib/rsbridge/cargo:pyo3",
2020-11-02 06:02:30 +01:00
"//rslib:anki",
],
)
rustfmt_test(
name = "format_check",
2020-11-02 06:02:30 +01:00
srcs = glob([
"*.rs",
]),
)
rustfmt_fix(
name = "format",
2020-11-02 06:02:30 +01:00
srcs = glob([
"*.rs",
]),
)