Skip to content

Commit

Permalink
examples/c: Build bpftool submodule in cmake
Browse files Browse the repository at this point in the history
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 <jjyyg1123@gmail.com>
  • Loading branch information
JackyYin authored and anakryiko committed May 25, 2022
1 parent 3666bcf commit b8b457c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion examples/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b8b457c

Please sign in to comment.