• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("@rules_rust//rust:defs.bzl", "rust_static_library")
2load("//bazel:rust_cxx_bridge.bzl", "rust_cxx_bridge")
3load(
4    "//bazel:skia_rules.bzl",
5    "skia_cc_library",
6    "skia_filegroup",
7)
8
9skia_filegroup(
10    name = "rs_srcs",
11    srcs = ["FFI.rs"],
12)
13
14skia_filegroup(
15    name = "cxx_bridge_srcs",
16    srcs = ["FFI.rs"],
17)
18
19# Note: the `hdrs` of the `utils` target are included in *two* `.gni` lists
20# (`skia_codec_rust_png` and `skia_encode_rust_png_srcs`) - this works only
21# because this is a header-only library.  If `utils` needs `srcs` in the
22# future, then a separate `.gni` list may be required.
23skia_cc_library(
24    name = "utils",
25    hdrs = ["UtilsForFFI.h"],
26    features = ["layering_check"],
27    visibility = ["//experimental/rust_png:__subpackages__"],
28    deps = ["//:core"],
29)
30
31skia_cc_library(
32    name = "ffi_cpp",
33    hdrs = ["FFI.h"],
34    features = ["layering_check"],
35    visibility = [
36        "//experimental/rust_png:__subpackages__",
37    ],
38)
39
40rust_cxx_bridge(
41    name = "cxx_bridge",
42    src = "FFI.rs",
43    visibility = [
44        "//experimental/rust_png:__subpackages__",
45    ],
46    deps = [":ffi_cpp"],
47)
48
49rust_static_library(
50    name = "ffi_rs",
51    srcs = [":rs_srcs"],
52    rustc_flags = ["-Dwarnings"],
53    visibility = [
54        "//experimental/rust_png:__subpackages__",
55    ],
56    deps = [
57        ":ffi_cpp",
58        "@cxx",
59        "@rust_png//:png",
60    ],
61)
62