diff --git a/BUILD.gn b/BUILD.gn index 31a71392da046f7a11a90a7a2be8ec8e43d641f5..16f09ed5f3415e8caddbdefbeea697f7988b5302 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -13,6 +13,37 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") + +libbpf_headers = [ + "bpf.h", + "libbpf.h", + "btf.h", + "libbpf_common.h", + "libbpf_legacy.h", + "xsk.h", + "bpf_helpers.h", + "bpf_helper_defs.h", + "bpf_tracing.h", + "bpf_endian.h", + "bpf_core_read.h", + "skel_internal.h", + "libbpf_version.h", +] + +foreach(file, libbpf_headers) { + copy("headers_{$file}") { + sources = [ "//third_party/libbpf/src/${file}" ] + outputs = [ "${target_out_dir}/bpf_headers/bpf/${file}" ] + } +} + +group("make_headers") { + deps = [] + foreach(file, libbpf_headers) { + deps += [":headers_{$file}"] + } +} + config("libbpf_config") { cflags = [ "-Wno-incompatible-pointer-types", @@ -33,13 +64,16 @@ config("libbpf_config") { "-Wno-uninitialized", ] defines = [ "HAVE_ELFIO" ] -} - -config("libbpf_public_config") { + include_dirs = [ "./src", "./include", "./include/uapi", + ] +} + +config("libbpf_public_config") { + include_dirs = [ "//third_party/zlib", "//third_party/elfio/c_wrapper", "//third_party/elfio/elfio", @@ -48,6 +82,7 @@ config("libbpf_public_config") { ohos_shared_library("libbpf") { deps = [ + ":make_headers", "//third_party/elfio:elfio", "//third_party/zlib:libz", ]