2020-02-10 02:59:12 +00:00
|
|
|
rust_binary(
|
|
|
|
name = "demo-rs",
|
|
|
|
srcs = glob(["src/**"]),
|
|
|
|
deps = [
|
|
|
|
":gen",
|
|
|
|
"//:cxx",
|
|
|
|
"//demo-cxx:demo-cxx",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
cxx_library(
|
|
|
|
name = "gen",
|
|
|
|
srcs = [":gen-source"],
|
|
|
|
deps = [
|
|
|
|
":include",
|
|
|
|
"//demo-cxx:include",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "gen-header",
|
|
|
|
srcs = ["src/main.rs"],
|
2020-09-01 23:07:52 +00:00
|
|
|
out = "generated.h",
|
2020-02-10 02:59:12 +00:00
|
|
|
cmd = "$(exe //:codegen) --header ${SRCS} > ${OUT}",
|
|
|
|
type = "cxxbridge",
|
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "gen-source",
|
|
|
|
srcs = ["src/main.rs"],
|
2020-09-01 23:07:52 +00:00
|
|
|
out = "generated.cc",
|
2020-02-10 02:59:12 +00:00
|
|
|
cmd = "$(exe //:codegen) ${SRCS} > ${OUT}",
|
|
|
|
type = "cxxbridge",
|
|
|
|
)
|
|
|
|
|
|
|
|
cxx_library(
|
|
|
|
name = "include",
|
|
|
|
exported_headers = {
|
2020-03-18 02:09:29 +00:00
|
|
|
"src/main.rs.h": ":gen-header",
|
2020-02-10 02:59:12 +00:00
|
|
|
},
|
|
|
|
visibility = ["PUBLIC"],
|
|
|
|
)
|