1rust_library(
2    name = "cxx",
3    srcs = glob(["src/**/*.rs"]),
4    doc_deps = [
5        ":cxx-build",
6    ],
7    edition = "2021",
8    features = [
9        "alloc",
10        "std",
11    ],
12    visibility = ["PUBLIC"],
13    deps = [
14        ":core",
15        ":cxxbridge-macro",
16    ],
17)
18
19alias(
20    name = "codegen",
21    actual = ":cxxbridge",
22    visibility = ["PUBLIC"],
23)
24
25rust_binary(
26    name = "cxxbridge",
27    srcs = glob(["gen/cmd/src/**/*.rs"]) + [
28        "gen/cmd/src/gen",
29        "gen/cmd/src/syntax",
30    ],
31    edition = "2021",
32    deps = [
33        "//third-party:clap",
34        "//third-party:codespan-reporting",
35        "//third-party:proc-macro2",
36        "//third-party:quote",
37        "//third-party:syn",
38    ],
39)
40
41cxx_library(
42    name = "core",
43    srcs = ["src/cxx.cc"],
44    exported_headers = {
45        "cxx.h": "include/cxx.h",
46    },
47    header_namespace = "rust",
48    preferred_linkage = "static",
49    visibility = ["PUBLIC"],
50)
51
52rust_library(
53    name = "cxxbridge-macro",
54    srcs = glob(["macro/src/**/*.rs"]) + ["macro/src/syntax"],
55    doctests = False,
56    edition = "2021",
57    proc_macro = True,
58    deps = [
59        "//third-party:proc-macro2",
60        "//third-party:quote",
61        "//third-party:syn",
62    ],
63)
64
65rust_library(
66    name = "cxx-build",
67    srcs = glob(["gen/build/src/**/*.rs"]) + [
68        "gen/build/src/gen",
69        "gen/build/src/syntax",
70    ],
71    doctests = False,
72    edition = "2021",
73    deps = [
74        "//third-party:cc",
75        "//third-party:codespan-reporting",
76        "//third-party:once_cell",
77        "//third-party:proc-macro2",
78        "//third-party:quote",
79        "//third-party:scratch",
80        "//third-party:syn",
81    ],
82)
83
84rust_library(
85    name = "cxx-gen",
86    srcs = glob(["gen/lib/src/**/*.rs"]) + [
87        "gen/lib/src/gen",
88        "gen/lib/src/syntax",
89    ],
90    edition = "2021",
91    visibility = ["PUBLIC"],
92    deps = [
93        "//third-party:cc",
94        "//third-party:codespan-reporting",
95        "//third-party:proc-macro2",
96        "//third-party:quote",
97        "//third-party:syn",
98    ],
99)
100