From b8b457c6ab2f761c345d4136c8a2dc8341555693 Mon Sep 17 00:00:00 2001 From: JackyYin Date: Thu, 19 May 2022 20:36:09 +0800 Subject: [PATCH] examples/c: Build bpftool submodule in cmake Add bpftool submodule as an ExternalProject to generate bpftool. Because tools/bpftool no longer exists, also update bpftool executable to build/bpftool/bpftool. Signed-off-by: Jacky Yin --- examples/c/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/c/CMakeLists.txt b/examples/c/CMakeLists.txt index 129f0aed..61a126f0 100644 --- a/examples/c/CMakeLists.txt +++ b/examples/c/CMakeLists.txt @@ -25,9 +25,20 @@ ExternalProject_Add(libbpf STEP_TARGETS build ) +ExternalProject_Add(bpftool + PREFIX bpftool + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../bpftool/src + CONFIGURE_COMMAND "" + BUILD_COMMAND make + OUTPUT=${CMAKE_CURRENT_BINARY_DIR}/bpftool/ + BUILD_IN_SOURCE TRUE + INSTALL_COMMAND "" + STEP_TARGETS build +) + # Set BpfObject input parameters -- note this is usually not necessary unless # you're in a highly vendored environment (like libbpf-bootstrap) -set(BPFOBJECT_BPFTOOL_EXE ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/bpftool) +set(BPFOBJECT_BPFTOOL_EXE ${CMAKE_CURRENT_BINARY_DIR}/bpftool/bpftool) set(BPFOBJECT_VMLINUX_H ${CMAKE_CURRENT_SOURCE_DIR}/../../vmlinux/vmlinux.h) set(LIBBPF_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/libbpf) set(LIBBPF_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/libbpf/libbpf.a)