File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,20 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "loongarch64")
3535 set (ARCH "loongarch" )
3636endif ()
3737
38- set (LIBBPF_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} /libbpf)
38+ set (LIBBPF_INCLUDE_DIRS
39+ ${CMAKE_CURRENT_BINARY_DIR} /libbpf
40+ ${CMAKE_CURRENT_SOURCE_DIR} /libbpf/include
41+ ${CMAKE_CURRENT_BINARY_DIR} /libbpf/usr/include )
3942set (LIBBPF_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR} /libbpf/libbpf.a)
4043
4144# EXAMPLE_VERSION_INFO is defined by setup.py and passed into the C++ code as a
4245# define (VERSION_INFO) here.
4346target_compile_definitions (pylibbpf
4447 PRIVATE VERSION_INFO=${PYLIBBPF_VERSION_INFO} )
48+
49+ # ensure build order
50+ add_dependencies (pylibbpf libbpf)
51+
52+ # headers + linking
53+ target_include_directories (pylibbpf PRIVATE ${LIBBPF_INCLUDE_DIRS} )
54+ target_link_libraries (pylibbpf PRIVATE ${LIBBPF_LIBRARIES} )
Original file line number Diff line number Diff line change 11#include < pybind11/pybind11.h>
2-
32#define STRINGIFY (x ) #x
43#define MACRO_STRINGIFY (x ) STRINGIFY(x)
54
5+ extern " C" {
6+ #include " bpf/libbpf.h"
7+ }
8+
69int add (int i, int j) {
710 return i + j;
811}
You can’t perform that action at this time.
0 commit comments