Skip to content

Commit

Permalink
Append SDE pkgconfig folders to PKG_CONFIG_PATH
Browse files Browse the repository at this point in the history
- Check for `pkgconfig` directories in the SDE and append them to
  PKG_CONFIG_PATH before using pkg-config to find the DPDK module.

Signed-off-by: Derek G Foster <[email protected]>
  • Loading branch information
ffoulkes committed Oct 20, 2023
1 parent d52c7e2 commit eb67df4
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions cmake/FindDpdkDriver.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
#-----------------------------------------------------------------------
Expand Down Expand Up @@ -121,6 +115,34 @@ 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(DPDK REQUIRED libdpdk)

#-----------------------------------------------------------------------
# Define SDE_LIBRARY_DIRS
#-----------------------------------------------------------------------
Expand Down

0 comments on commit eb67df4

Please sign in to comment.