File: CMakeLists.txt

package info (click to toggle)
syslog-ng 4.8.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,456 kB
  • sloc: ansic: 177,631; python: 13,035; cpp: 11,611; makefile: 7,012; sh: 5,147; java: 3,651; xml: 3,344; yacc: 1,377; lex: 599; perl: 193; awk: 190; objc: 162
file content (40 lines) | stat: -rw-r--r-- 1,067 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
if (NOT DEFINED ENABLE_EBPF OR ENABLE_EBPF)
  find_package(LIBBPF)
endif()

module_switch(ENABLE_EBPF "Enable ebpf module (requires ebpf toolchain)" LIBBPF_FOUND)

if (NOT ENABLE_EBPF)
  return()
endif()

add_custom_command(OUTPUT vmlinux.h
                   COMMAND ${BPFTOOL} btf dump file /sys/kernel/btf/vmlinux format c >vmlinux.h)

add_custom_command(OUTPUT random.skel.c
                   COMMAND ${BPFTOOL} gen skeleton random.kern.o > random.skel.c
		   DEPENDS random.kern.o)

add_custom_command(OUTPUT random.kern.o
                   COMMAND ${BPF_CC} ${BPF_CFLAGS} -c ${CMAKE_CURRENT_SOURCE_DIR}/random.kern.c -o random.kern.o
                   DEPENDS random.kern.c vmlinux.h)

add_custom_target(generate_ebpf_skeletons DEPENDS "random.skel.c")

set(EBPF_SOURCES
    ebpf-parser.h
    ebpf-reuseport.h
    ebpf-reuseport.c
    ebpf-plugin.c
    ebpf-parser.c
)

add_module(
  TARGET ebpf
  GRAMMAR ebpf-grammar
  INCLUDES ${PROJECT_SOURCE_DIR}
  SOURCES ${EBPF_SOURCES}
  DEPENDS ${LIBBPF_LIBRARIES}
)

add_dependencies(ebpf generate_ebpf_skeletons)