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