13a5aa4fac
There's currently no way for userspace programs building with Bazel to ingest the kernel UAPI headers. Kleaf generates a tarball of the headers, but a Bazel cc_binary rule cannot use that as an input. Define a native Bazel header-only cc_library which userspace programs can use to build with the kernel's UAPI headers. For example: cc_binary( name = "foo", srcs = ["foo.c"], deps = ["//msm-kernel:kalama_gki_uapi_header_library"], ) Change-Id: Ib884d9123e4ffd0bead97e8cebb5a3456e73b2a6 Signed-off-by: John Moon <quic_johmoo@quicinc.com>
19 lines
573 B
Python
19 lines
573 B
Python
load(":uapi_unpacker.bzl", "uapi_unpacker")
|
|
|
|
def define_uapi_library(target):
|
|
"""Create a header-only cc_library of the kernel's UAPI headers
|
|
|
|
Args:
|
|
target: name of main Bazel target (e.g. `kalama_gki`)
|
|
"""
|
|
uapi_unpacker(
|
|
name = "{}_uapi_unpacker".format(target),
|
|
kernel_uapi_headers = ":{}_uapi_headers".format(target),
|
|
)
|
|
|
|
native.cc_library(
|
|
name = "{}_uapi_header_library".format(target),
|
|
hdrs = [":{}_uapi_unpacker".format(target)],
|
|
includes = ["{}_uapi_unpacker_uapi_headers".format(target)],
|
|
)
|