libs icon indicating copy to clipboard operation
libs copied to clipboard

cleanup(build): Use a single cmake module for driver_config.h

Open gnosek opened this issue 1 year ago • 16 comments

Instead of manually generating driver_config.h when needed (approximately, since the libscap engines do not generate it, even though they rely on it), encapsulate all the logic in a single cmake module.

Note: this removes the driver_config directory from LIBSCAP_INCLUDE_DIRS. If you actually need driver_config.h, add this to your CMakeLists.txt:

include(driver_config)
include_directories(${DRIVER_CONFIG_OUTPUT_DIR})

What type of PR is this?

/kind cleanup

Any specific area of the project related to this PR?

/area build

/area driver-kmod

/area driver-bpf

/area driver-modern-bpf

What this PR does / why we need it:

driver_config.h is generated in three different places, in different ways, into two target locations (including the source directory). Clean this up and use just one well-defined place we can refer to later.

Also, (as it turned out to be a prerequisite for the fix), the BPF build now no longer touches the source directory and does not depend on any files outside the (generated) source directory.

Does this PR introduce a user-facing change?:

(I'm not sure about user-facing, but it is a change for libscap consumers, even though driver_config.h is generally not needed)

action required: driver_config.h is no longer available in ${LIBSCAP_INCLUDE_DIRS}

gnosek avatar Jul 05 '23 13:07 gnosek