2021-12-03 11:35:52 +01:00
|
|
|
load("@rules_rust//rust:defs.bzl", "rust_shared_library")
|
2021-03-27 09:39:02 +01:00
|
|
|
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"],
|
2021-10-15 12:16:04 +02:00
|
|
|
build_script_env = {
|
|
|
|
"PYO3_PYTHON": "$(location @python)",
|
|
|
|
},
|
|
|
|
data = [
|
|
|
|
"@python",
|
|
|
|
],
|
2020-11-02 06:02:30 +01:00
|
|
|
)
|
|
|
|
|
2021-12-03 11:35:52 +01:00
|
|
|
rust_shared_library(
|
2020-11-02 06:02:30 +01:00
|
|
|
name = "rsbridge",
|
|
|
|
srcs = ["lib.rs"],
|
|
|
|
rustc_flags = selects.with_or({
|
|
|
|
(
|
2021-03-27 09:39:02 +01:00
|
|
|
"@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",
|
2021-10-08 08:27:22 +02:00
|
|
|
"-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(
|
2020-11-12 11:11:40 +01:00
|
|
|
name = "format_check",
|
2020-11-02 06:02:30 +01:00
|
|
|
srcs = glob([
|
|
|
|
"*.rs",
|
|
|
|
]),
|
|
|
|
)
|
|
|
|
|
|
|
|
rustfmt_fix(
|
2020-11-12 11:11:40 +01:00
|
|
|
name = "format",
|
2020-11-02 06:02:30 +01:00
|
|
|
srcs = glob([
|
|
|
|
"*.rs",
|
|
|
|
]),
|
|
|
|
)
|