third_party_rust_cxx/tests/BUCK

57 lines
1.0 KiB
Python

load("//tools/buck:genrule.bzl", "genrule")
rust_test(
name = "test",
srcs = ["test.rs"],
deps = [":ffi"],
)
rust_library(
name = "ffi",
srcs = [
"ffi/lib.rs",
"ffi/module.rs",
],
crate = "cxx_test_suite",
deps = [
":impl",
"//:cxx",
],
)
cxx_library(
name = "impl",
srcs = [
"ffi/tests.cc",
":gen-lib-source",
":gen-module-source",
],
header_namespace = "cxx-test-suite",
headers = {
"lib.rs.h": ":gen-lib-header",
"tests.h": "ffi/tests.h",
},
deps = ["//:core"],
)
genrule(
name = "gen-lib-header",
srcs = ["ffi/lib.rs"],
out = "ffi/lib.rs.h",
cmd = "$(exe //:codegen) --header ${SRCS} > ${OUT}",
)
genrule(
name = "gen-lib-source",
srcs = ["ffi/lib.rs"],
out = "ffi/lib.rs.cc",
cmd = "$(exe //:codegen) ${SRCS} > ${OUT}",
)
genrule(
name = "gen-module-source",
srcs = ["ffi/module.rs"],
out = "ffi/module.rs.cc",
cmd = "$(exe //:codegen) ${SRCS} > ${OUT}",
)