Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.7)
project(warp17)

set(CMAKE_CXX_STANDARD 11)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
find_package(dpdk REQUIRED)

message("DPDK include dir: ${DPDK_INCLUDE_DIR}")

include_directories(${DPDK_INCLUDE_DIR})

FILE(GLOB_RECURSE SOURCE_FILES src/*.c)

MACRO(HEADER_DIRECTORIES return_list)
FILE(GLOB_RECURSE new_list inc/*.h)
SET(dir_list "")
FOREACH(file_path ${new_list})
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
SET(dir_list ${dir_list} ${dir_path})
ENDFOREACH()
LIST(REMOVE_DUPLICATES dir_list)
SET(${return_list} ${dir_list})
ENDMACRO()

HEADER_DIRECTORIES(include_dirs)
message("folders: ${include_dirs}")
include_directories(${include_dirs})

add_executable(warp17 ${SOURCE_FILES})
target_link_libraries(warp17 ${DPDK_LIBRARIES})
75 changes: 75 additions & 0 deletions cmake/modules/Finddpdk.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Try to find dpdk
#
# Once done, this will define
#
# DPDK_FOUND
# DPDK_INCLUDE_DIR
# DPDK_LIBRARIES

find_path(DPDK_INCLUDE_DIR rte_config.h
PATH_SUFFIXES dpdk)
find_library(DPDK_rte_hash_LIBRARY rte_hash)
find_library(DPDK_rte_kvargs_LIBRARY rte_kvargs)
find_library(DPDK_rte_mbuf_LIBRARY rte_mbuf)
find_library(DPDK_rte_ethdev_LIBRARY rte_ethdev)
find_library(DPDK_rte_mempool_LIBRARY rte_mempool)
find_library(DPDK_rte_ring_LIBRARY rte_ring)
find_library(DPDK_rte_eal_LIBRARY rte_eal)
find_library(DPDK_rte_cmdline_LIBRARY rte_cmdline)
find_library(DPDK_rte_pmd_bond_LIBRARY rte_pmd_bond)
find_library(DPDK_rte_pmd_vmxnet3_uio_LIBRARY rte_pmd_vmxnet3_uio)
find_library(DPDK_rte_pmd_ixgbe_LIBRARY rte_pmd_ixgbe)
find_library(DPDK_rte_pmd_i40e_LIBRARY rte_pmd_i40e)
find_library(DPDK_rte_pmd_ring_LIBRARY rte_pmd_ring)
find_library(DPDK_rte_pmd_af_packet_LIBRARY rte_pmd_af_packet)

set(check_LIBRARIES
${DPDK_rte_hash_LIBRARY}
${DPDK_rte_kvargs_LIBRARY}
${DPDK_rte_mbuf_LIBRARY}
${DPDK_rte_ethdev_LIBRARY}
${DPDK_rte_mempool_LIBRARY}
${DPDK_rte_ring_LIBRARY}
${DPDK_rte_eal_LIBRARY}
${DPDK_rte_cmdline_LIBRARY}
${DPDK_rte_pmd_bond_LIBRARY}
${DPDK_rte_pmd_vmxnet3_uio_LIBRARY}
${DPDK_rte_pmd_ixgbe_LIBRARY}
${DPDK_rte_pmd_i40e_LIBRARY}
${DPDK_rte_pmd_ring_LIBRARY}
${DPDK_rte_pmd_af_packet_LIBRARY})

mark_as_advanced(DPDK_INCLUDE_DIR
DPDK_rte_hash_LIBRARY
DPDK_rte_kvargs_LIBRARY
DPDK_rte_mbuf_LIBRARY
DPDK_rte_ethdev_LIBRARY
DPDK_rte_mempool_LIBRARY
DPDK_rte_ring_LIBRARY
DPDK_rte_eal_LIBRARY
DPDK_rte_cmdline_LIBRARY
DPDK_rte_pmd_bond_LIBRARY
DPDK_rte_pmd_vmxnet3_uio_LIBRARY
DPDK_rte_pmd_ixgbe_LIBRARY
DPDK_rte_pmd_i40e_LIBRARY
DPDK_rte_pmd_ring_LIBRARY
DPDK_rte_pmd_af_packet_LIBRARY)

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()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(dpdk DEFAULT_MSG
DPDK_INCLUDE_DIR
check_LIBRARIES)

if(DPDK_FOUND)
if (EXISTS ${WITH_DPDK_MLX5})
list(APPEND check_LIBRARIES -libverbs)
endif()
set(DPDK_LIBRARIES
-Wl,--whole-archive ${check_LIBRARIES} -lpthread -Wl,--no-whole-archive)
endif(DPDK_FOUND)