• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("@rules_cc//cc:defs.bzl", "cc_library")
2load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_proc_macro")
3
4rust_library(
5    name = "cxx",
6    srcs = glob(["src/**/*.rs"]),
7    crate_features = [
8        "alloc",
9        "std",
10    ],
11    edition = "2018",
12    proc_macro_deps = [
13        ":cxxbridge-macro",
14    ],
15    visibility = ["//visibility:public"],
16    deps = [":core-lib"],
17)
18
19rust_binary(
20    name = "codegen",
21    srcs = glob(["gen/cmd/src/**/*.rs"]),
22    data = ["gen/cmd/src/gen/include/cxx.h"],
23    edition = "2018",
24    visibility = ["//visibility:public"],
25    deps = [
26        "//third-party:clap",
27        "//third-party:codespan-reporting",
28        "//third-party:proc-macro2",
29        "//third-party:quote",
30        "//third-party:syn",
31    ],
32)
33
34cc_library(
35    name = "core",
36    hdrs = ["include/cxx.h"],
37    include_prefix = "rust",
38    strip_include_prefix = "include",
39    visibility = ["//visibility:public"],
40)
41
42cc_library(
43    name = "core-lib",
44    srcs = ["src/cxx.cc"],
45    hdrs = ["include/cxx.h"],
46)
47
48rust_proc_macro(
49    name = "cxxbridge-macro",
50    srcs = glob(["macro/src/**/*.rs"]),
51    edition = "2018",
52    deps = [
53        "//third-party:proc-macro2",
54        "//third-party:quote",
55        "//third-party:syn",
56    ],
57)
58
59rust_library(
60    name = "build",
61    srcs = glob(["gen/build/src/**/*.rs"]),
62    data = ["gen/build/src/gen/include/cxx.h"],
63    edition = "2018",
64    visibility = ["//visibility:public"],
65    deps = [
66        "//third-party:cc",
67        "//third-party:codespan-reporting",
68        "//third-party:once_cell",
69        "//third-party:proc-macro2",
70        "//third-party:quote",
71        "//third-party:scratch",
72        "//third-party:syn",
73    ],
74)
75
76rust_library(
77    name = "lib",
78    srcs = glob(["gen/lib/src/**/*.rs"]),
79    data = ["gen/lib/src/gen/include/cxx.h"],
80    edition = "2018",
81    visibility = ["//visibility:public"],
82    deps = [
83        "//third-party:cc",
84        "//third-party:codespan-reporting",
85        "//third-party:proc-macro2",
86        "//third-party:quote",
87        "//third-party:syn",
88    ],
89)
90