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"],
|
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
|
|
|
},
|
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
|
|
|
)
|