2016-08-02 15:50:13 +00:00
|
|
|
# Try to find dpdk
|
2016-02-03 10:31:45 +00:00
|
|
|
#
|
|
|
|
# Once done, this will define
|
|
|
|
#
|
|
|
|
# DPDK_FOUND
|
|
|
|
# DPDK_INCLUDE_DIR
|
|
|
|
# DPDK_LIBRARIES
|
|
|
|
|
|
|
|
find_path(DPDK_INCLUDE_DIR rte_config.h
|
2017-01-10 07:14:01 +00:00
|
|
|
PATH_SUFFIXES dpdk
|
|
|
|
HINTS $ENV{DPDK_DIR}/include)
|
2016-08-02 15:50:13 +00:00
|
|
|
|
2017-01-10 07:14:01 +00:00
|
|
|
set(components
|
2017-11-28 10:00:37 +00:00
|
|
|
pci bus_pci cmdline eal ethdev hash kvargs mbuf
|
2017-01-10 07:14:01 +00:00
|
|
|
mempool mempool_ring mempool_stack
|
|
|
|
pmd_bond pmd_vmxnet3_uio pmd_ixgbe pmd_i40e pmd_ring pmd_af_packet
|
|
|
|
ring)
|
2016-02-03 10:31:45 +00:00
|
|
|
|
2017-01-10 07:14:01 +00:00
|
|
|
foreach(c ${components})
|
|
|
|
find_library(DPDK_rte_${c}_LIBRARY rte_${c}
|
|
|
|
HINTS $ENV{DPDK_DIR}/lib)
|
|
|
|
list(APPEND check_LIBRARIES "${DPDK_rte_${c}_LIBRARY}")
|
2018-07-20 10:50:07 +00:00
|
|
|
if(DPDK_rte_${c}_LIBRARY)
|
|
|
|
add_library(dpdk::${c} UNKNOWN IMPORTED)
|
|
|
|
set_target_properties(dpdk::${c} PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${DPDK_INCLUDE_DIR}"
|
|
|
|
IMPORTED_LOCATION "${DPDK_rte_${c}_LIBRARY}")
|
|
|
|
list(APPEND DPDK_LIBRARIES dpdk::${c})
|
|
|
|
endif()
|
2017-01-10 07:14:01 +00:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
mark_as_advanced(DPDK_INCLUDE_DIR ${check_LIBRARIES})
|
2016-08-02 15:50:13 +00:00
|
|
|
|
|
|
|
if (EXISTS ${WITH_DPDK_MLX5})
|
|
|
|
find_library(DPDK_rte_pmd_mlx5_LIBRARY rte_pmd_mlx5)
|
|
|
|
list(APPEND check_LIBRARIES ${DPDK_rte_pmd_mlx5_LIBRARY})
|
|
|
|
mark_as_advanced(DPDK_rte_pmd_mlx5_LIBRARY)
|
|
|
|
endif()
|
2016-02-03 10:31:45 +00:00
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(dpdk DEFAULT_MSG
|
|
|
|
DPDK_INCLUDE_DIR
|
2016-08-02 15:50:13 +00:00
|
|
|
check_LIBRARIES)
|
2016-02-03 10:31:45 +00:00
|
|
|
|
|
|
|
if(DPDK_FOUND)
|
2017-01-10 07:14:01 +00:00
|
|
|
if(EXISTS ${WITH_DPDK_MLX5})
|
|
|
|
list(APPEND check_LIBRARIES -libverbs)
|
|
|
|
endif()
|
2016-02-03 10:31:45 +00:00
|
|
|
set(DPDK_LIBRARIES
|
2017-07-05 05:42:10 +00:00
|
|
|
-Wl,--whole-archive ${check_LIBRARIES} -Wl,--no-whole-archive)
|
2016-02-03 10:31:45 +00:00
|
|
|
endif(DPDK_FOUND)
|