This commit cleans up the cmake in this repository, removing a lot of
vestigial stuff from when this repo was just host isolation and putting
it in a state where it can be more cleanly built with endpoint.
Changes:
Remove all the TARGET_* variables in the top level CMakelists.txt,
push all that logic down to lower subdirectories
Create a "libbpf" and "libelf" library target, instead of linking
against ${LIBBPF_LIB} and ${LIBELF_LIB} and then manually including
the required includes. This puts logic pertaining to where to find
libbpf includes in cmake/libbpf.cmake instead of GPL/non-GPL, which
means that we don't have to manually add the libbpf include
directories and link libraries to every target that links against it.
Remove a bunch of unneeded comments, message(...) invocations etc.
Clean up the variables in cmake/libbpf.cmake and document why we need
the one (LIBBPF_UAPI_INCLUDE_DIR) that remains
Set ARCH_TRUNC based on ARCH, don't require a higher level project to
manually specify it
Note that to get this PR building with endpoint, one LLVM intrinsic has been commented out as the endpoint toolchain
is currently using LLVM 11, which doesn't support bpf_core_enum_value_exists (see comment). This has been done to get reviews in early and will be removed when the toolchain is updated to LLVM 14. This PR should not be merged until the toolchain is updated and the commented-out code has been removed.
This commit cleans up the cmake in this repository, removing a lot of vestigial stuff from when this repo was just host isolation and putting it in a state where it can be more cleanly built with endpoint.
Changes:
${LIBBPF_LIB}
and${LIBELF_LIB}
and then manually including the required includes. This puts logic pertaining to where to find libbpf includes in cmake/libbpf.cmake instead of GPL/non-GPL, which means that we don't have to manually add the libbpf include directories and link libraries to every target that links against it.Note that to get this PR building with endpoint, one LLVM intrinsic has been commented out as the endpoint toolchain is currently using LLVM 11, which doesn't support
bpf_core_enum_value_exists
(see comment). This has been done to get reviews in early and will be removed when the toolchain is updated to LLVM 14. This PR should not be merged until the toolchain is updated and the commented-out code has been removed.