mirror of
https://github.com/nmap/nmap.git
synced 2025-12-24 08:29:04 +00:00
Upgrade libpcap to 1.10.4
This commit is contained in:
@@ -5,89 +5,49 @@
|
||||
# dpdk_FOUND
|
||||
# dpdk_INCLUDE_DIRS
|
||||
# dpdk_LIBRARIES
|
||||
# dpdk_STATIC_LIBRARIES
|
||||
# dpdk_LIBS_STATIC
|
||||
# dpdk_REQUIRES_PRIVATE
|
||||
# dpdk_PACKAGE_NAME
|
||||
|
||||
#
|
||||
# We only try to find DPDK using pkg-config; DPDK is *SO*
|
||||
# complicated - DPDK 19.02, for example, has about 117(!)
|
||||
# libraries, and the precise set of libraries required has
|
||||
# changed over time - so attempting to guess which libraries
|
||||
# you need, and hardcoding that in an attempt to find the
|
||||
# libraries without DPDK, rather than relying on DPDK to
|
||||
# tell you, with a .pc file, what libraries are needed,
|
||||
# is *EXTREMELY* fragile and has caused some bug reports,
|
||||
# so we're just not going to do it.
|
||||
#
|
||||
# If that causes a problem, the only thing we will do is
|
||||
# accept an alternative way of finding the appropriate
|
||||
# library set for the installed version of DPDK that is
|
||||
# as robust as pkg-config (i.e., it had better work as well
|
||||
# as pkg-config with *ALL* versions of DPDK that provide a
|
||||
# libdpdk.pc file).
|
||||
#
|
||||
# If dpdk_ROOT is set, add ${dpdk_ROOT}/pkgconfig
|
||||
# to PKG_CONFIG_PATH, so we look for the .pc file there,
|
||||
# first.
|
||||
#
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(dpdk QUIET libdpdk)
|
||||
endif()
|
||||
message(STATUS "Executing Finddpdk")
|
||||
if(NOT dpdk_INCLUDE_DIRS)
|
||||
message(STATUS "Executing find_path")
|
||||
find_path(dpdk_config_INCLUDE_DIR rte_config.h
|
||||
HINTS
|
||||
ENV DPDK_DIR
|
||||
PATH_SUFFIXES
|
||||
dpdk
|
||||
include
|
||||
)
|
||||
find_path(dpdk_common_INCLUDE_DIR rte_common.h
|
||||
HINTS
|
||||
ENV DPDK_DIR
|
||||
PATH_SUFFIXES
|
||||
dpdk
|
||||
include
|
||||
)
|
||||
set(dpdk_INCLUDE_DIRS "${dpdk_config_INCLUDE_DIR}")
|
||||
if(NOT dpdk_config_INCLUDE_DIR STREQUAL dpdk_common_INCLUDE_DIR)
|
||||
list(APPEND dpdk_INCLUDE_DIRS "${dpdk_common_INCLUDE_DIR}")
|
||||
set(save_PKG_CONFIG_PATH $ENV{PKG_CONFIG_PATH})
|
||||
if(dpdk_ROOT)
|
||||
set(ENV{PKG_CONFIG_PATH} "${dpdk_ROOT}/pkgconfig:$ENV{PKG_CONFIG_PATH}")
|
||||
endif()
|
||||
|
||||
set(components
|
||||
bus_pci
|
||||
cmdline
|
||||
eal
|
||||
ethdev
|
||||
hash
|
||||
kvargs
|
||||
mbuf
|
||||
mempool
|
||||
mempool_ring
|
||||
mempool_stack
|
||||
pci
|
||||
pmd_af_packet
|
||||
pmd_bond
|
||||
pmd_i40e
|
||||
pmd_ixgbe
|
||||
pmd_mlx5
|
||||
pmd_ring
|
||||
pmd_vmxnet3_uio
|
||||
ring)
|
||||
|
||||
set(dpdk_LIBRARIES)
|
||||
|
||||
foreach(c ${components})
|
||||
find_library(DPDK_rte_${c}_LIBRARY rte_${c}
|
||||
HINTS
|
||||
ENV DPDK_DIR
|
||||
${dpdk_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES lib)
|
||||
if(DPDK_rte_${c}_LIBRARY)
|
||||
set(dpdk_lib dpdk::${c})
|
||||
if (NOT TARGET ${dpdk_lib})
|
||||
add_library(${dpdk_lib} UNKNOWN IMPORTED)
|
||||
set_target_properties(${dpdk_lib} PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${dpdk_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${DPDK_rte_${c}_LIBRARY}")
|
||||
if(c STREQUAL pmd_mlx5)
|
||||
find_package(verbs QUIET)
|
||||
if(verbs_FOUND)
|
||||
target_link_libraries(${dpdk_lib} INTERFACE IBVerbs::verbs)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND dpdk_LIBRARIES ${dpdk_lib})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
#
|
||||
# Where the heck did this list come from? libdpdk on Ubuntu 20.04,
|
||||
# for example, doesn't even *have* -ldpdk; that's why we go with
|
||||
# pkg-config, in the hopes that it provides a correct set of flags
|
||||
# for this tangled mess.
|
||||
#
|
||||
list(APPEND dpdk_LIBRARIES dpdk rt m numo dl)
|
||||
pkg_check_modules(dpdk QUIET libdpdk)
|
||||
if(dpdk_FOUND)
|
||||
#
|
||||
# Get link information for DPDK.
|
||||
#
|
||||
pkg_get_link_info(dpdk libdpdk)
|
||||
endif()
|
||||
set(ENV{PKG_CONFIG_PATH} "${save_PKG_CONFIG_PATH}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(dpdk_INCLUDE_DIRS ${dpdk_LIBRARIES})
|
||||
mark_as_advanced(dpdk_INCLUDE_DIRS dpdk_LIBRARIES dpdk_STATIC_LIBRARIES dpdk_REQUIRES_PRIVATE)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(dpdk DEFAULT_MSG
|
||||
@@ -95,29 +55,64 @@ find_package_handle_standard_args(dpdk DEFAULT_MSG
|
||||
dpdk_LIBRARIES)
|
||||
|
||||
if(dpdk_FOUND)
|
||||
if(NOT TARGET dpdk::cflags)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
|
||||
set(rte_cflags "-march=core2")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM")
|
||||
set(rte_cflags "-march=armv7-a")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
|
||||
set(rte_cflags "-march=armv8-a+crc")
|
||||
#
|
||||
# This depends on CMake support for "imported targets",
|
||||
# which are not supported until CMake 3.19.
|
||||
#
|
||||
# Ubuntu 20.04 provides CMake 3.16.3, so we are *NOT*
|
||||
# going to require CMake 3.19. If you want to use
|
||||
# Shiny New Features(TM), wait until all the OSes on
|
||||
# which a build might conceivably be done, and that
|
||||
# provide CMake, provide 3.19 or later.
|
||||
#
|
||||
# Just don't do this stuff on earlier versions. If that
|
||||
# breaks something, figure out a way to do it *without*
|
||||
# "imported targets", and either do this that way, or,
|
||||
# at least, do it that way on older versions of CMake.
|
||||
#
|
||||
# (One good thing about autotools is that only the builders
|
||||
# of a package, and people doing configure-script development,
|
||||
# have to care about the autoconf etc. version; you don't
|
||||
# even need to have autotools installed in order to be able
|
||||
# to run an autotools-generated configure script, you just
|
||||
# need an environment UN*Xy enough, and modern enough, to
|
||||
# run the stuff in the script.
|
||||
#
|
||||
# This is *NOT* the case for CMake; not only do you need
|
||||
# CMake in order to build a package using CMake, you need
|
||||
# a version recent enough to run the stuff the package's
|
||||
# CMake files use.
|
||||
#
|
||||
# Please keep this in mind when changing any CMake files,
|
||||
# and keep in mind what versions of CMake come with, for
|
||||
# example, commonly-used versions of commonly-used
|
||||
# Linux distributiions.)
|
||||
#
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.19)
|
||||
if(NOT TARGET dpdk::cflags)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
|
||||
set(rte_cflags "-march=core2")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|ARM")
|
||||
set(rte_cflags "-march=armv7-a")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|AARCH64")
|
||||
set(rte_cflags "-march=armv8-a+crc")
|
||||
endif()
|
||||
add_library(dpdk::cflags INTERFACE IMPORTED)
|
||||
if (rte_cflags)
|
||||
set_target_properties(dpdk::cflags PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "${rte_cflags}")
|
||||
endif()
|
||||
endif()
|
||||
add_library(dpdk::cflags INTERFACE IMPORTED)
|
||||
if (rte_cflags)
|
||||
set_target_properties(dpdk::cflags PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "${rte_cflags}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TARGET dpdk::dpdk)
|
||||
add_library(dpdk::dpdk INTERFACE IMPORTED)
|
||||
find_package(Threads QUIET)
|
||||
list(APPEND dpdk_LIBRARIES
|
||||
Threads::Threads
|
||||
dpdk::cflags)
|
||||
set_target_properties(dpdk::dpdk PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "${dpdk_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${dpdk_INCLUDE_DIRS}")
|
||||
if(NOT TARGET dpdk::dpdk)
|
||||
add_library(dpdk::dpdk INTERFACE IMPORTED)
|
||||
find_package(Threads QUIET)
|
||||
list(APPEND dpdk_LIBRARIES
|
||||
Threads::Threads
|
||||
dpdk::cflags)
|
||||
set_target_properties(dpdk::dpdk PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "${dpdk_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${dpdk_INCLUDE_DIRS}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user