third_party_rust_cxx/demo/BUCK

58 lines
993 B
Python
Raw Normal View History

2020-02-10 02:59:12 +00:00
rust_binary(
2020-09-01 22:51:38 +00:00
name = "demo",
srcs = glob(["src/**/*.rs"]),
2020-02-10 02:59:12 +00:00
deps = [
2020-09-01 22:51:38 +00:00
":demo-sys",
2020-02-10 02:59:12 +00:00
":gen",
"//:cxx",
],
)
cxx_library(
name = "gen",
srcs = [":gen-source"],
deps = [
2020-09-01 22:51:38 +00:00
":demo-include",
2020-02-10 02:59:12 +00:00
":include",
],
)
genrule(
name = "gen-header",
srcs = ["src/main.rs"],
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"],
out = "generated.cc",
2020-02-10 02:59:12 +00:00
cmd = "$(exe //:codegen) ${SRCS} > ${OUT}",
type = "cxxbridge",
)
cxx_library(
name = "include",
exported_headers = {
"src/main.rs.h": ":gen-header",
2020-02-10 02:59:12 +00:00
},
2020-09-01 22:51:38 +00:00
)
cxx_library(
name = "demo-sys",
srcs = ["src/demo.cc"],
compiler_flags = ["-std=c++14"],
deps = [
":demo-include",
":include",
],
)
cxx_library(
name = "demo-include",
exported_headers = ["include/demo.h"],
deps = ["//:core"],
2020-02-10 02:59:12 +00:00
)