blob: 041d1da49b2470263a7a8d7c06017ca62367f478 [file] [log] [blame]
load("@rules_rust//rust:defs.bzl", "rust_doc", "rust_library", "rust_test")
package(default_visibility = ["//ffi/rust_calling_c:__subpackages__"])
rust_library(
name = "matrix",
srcs = [
"src/ffi.rs",
"src/matrix.rs",
],
deps = [
"//ffi/rust_calling_c/c:native_matrix",
"@libc",
],
)
rust_test(
name = "matrix_test",
crate = ":matrix",
)
rust_doc(
name = "matrix_doc",
crate = ":matrix",
)
## Do the same as above, but with a dynamic c library.
rust_library(
name = "matrix_dynamically_linked",
srcs = [
"src/ffi.rs",
"src/matrix.rs",
],
crate_root = "src/matrix.rs",
target_compatible_with = select({
# TODO: Make this work on windows
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
deps = [
"//ffi/rust_calling_c/c:native_matrix_so",
"@libc",
],
)
rust_test(
name = "matrix_dylib_test",
crate = ":matrix_dynamically_linked",
target_compatible_with = select({
# TODO: This test requires --incompatible_macos_set_install_name and Bazel 4.2.0+
"@platforms//os:macos": ["@platforms//:incompatible"],
# TODO: Make this work on windows
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
)
rust_doc(
name = "matrix_dylib_doc",
crate = ":matrix_dynamically_linked",
)