From 98c074126b3c3f0b6922db429608e4a45dee53f4 Mon Sep 17 00:00:00 2001 From: Derek G Foster Date: Mon, 23 Oct 2023 19:02:17 -0700 Subject: [PATCH] Append SDE pkgconfig folders to PKG_CONFIG_PATH (#319) - Check for `pkgconfig` directories in the DPDK SDE and append them to PKG_CONFIG_PATH before using pkg-config to find the DPDK module. - Address a CMake module warning by using `DpdkDriver` as the DPDK package name instead of `DPDK`. - Correct an error in a DPDK LDFLAGS variable reference. - Update krnlmon submodule reference. Signed-off-by: Derek G Foster --- cmake/FindDpdkDriver.cmake | 40 +++++++++++++++++++++++++++++--------- krnlmon/krnlmon | 2 +- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/cmake/FindDpdkDriver.cmake b/cmake/FindDpdkDriver.cmake index 10a0040f..ffe106ce 100644 --- a/cmake/FindDpdkDriver.cmake +++ b/cmake/FindDpdkDriver.cmake @@ -7,12 +7,6 @@ # This module requires that SDE_INSTALL_DIR be defined. # It needs additional work to make it a proper CMake find-module. -#----------------------------------------------------------------------- -# Use pkg-config to find DPDK module -#----------------------------------------------------------------------- -include(FindPkgConfig) -pkg_check_modules(DPDK REQUIRED libdpdk) - #----------------------------------------------------------------------- # Define SDE_INCLUDE_DIR #----------------------------------------------------------------------- @@ -121,12 +115,40 @@ set_target_properties(sde::target_utils PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${SDE_INCLUDE_DIR} IMPORTED_LINK_INTERFACE_LANGUAGES C) +#----------------------------------------------------------------------- +# Append SDE pkgconfig directories to PKG_CONFIG_PATH +#----------------------------------------------------------------------- +function(_set_pkg_config_path) + file(TO_CMAKE_PATH "$ENV{PKG_CONFIG_PATH}" _sde_pkg_path) + + foreach(_libdir lib lib64 lib/x86_64-linux-gnu) + set(_path ${SDE_INSTALL_DIR}/${_libdir}/pkgconfig) + if(EXISTS ${_path}) + list(APPEND _sde_pkg_path ${_path}) + endif() + endforeach() + + list(JOIN _sde_pkg_path ":" _sde_pkg_path) + + if(NOT _sde_pkg_path STREQUAL "") + set(ENV{PKG_CONFIG_PATH} "${_sde_pkg_path}") + endif() +endfunction() + +_set_pkg_config_path() + +#----------------------------------------------------------------------- +# Use pkg-config to find DPDK module +#----------------------------------------------------------------------- +include(FindPkgConfig) +pkg_check_modules(DpdkDriver REQUIRED libdpdk) + #----------------------------------------------------------------------- # Define SDE_LIBRARY_DIRS #----------------------------------------------------------------------- set(SDE_LIBRARY_DIRS ${SDE_INSTALL_DIR}/lib - ${DPDK_LIBRARY_DIRS} + ${DpdkDriver_LIBRARY_DIRS} ) #----------------------------------------------------------------------- @@ -145,7 +167,7 @@ function(add_dpdk_target_libraries TGT) target_link_directories(${TGT} PUBLIC ${SDE_LIBRARY_DIRS}) target_link_options(${TGT} PUBLIC - ${DPDK_LD_FLAGS} - ${DPDK_LDFLAGS_OTHER} + ${DpdkDriver_LDFLAGS} + ${DpdkDriver_LDFLAGS_OTHER} ) endfunction() diff --git a/krnlmon/krnlmon b/krnlmon/krnlmon index cad209bb..64897e71 160000 --- a/krnlmon/krnlmon +++ b/krnlmon/krnlmon @@ -1 +1 @@ -Subproject commit cad209bb103bb24509fe7a5388c1a922deda5f19 +Subproject commit 64897e71cba9bb5526b164f8837e85a0bdf86519