diff options
author | Tom Jones <thj@freebsd.org> | 2024-01-29 14:38:19 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2024-02-23 10:07:49 +0000 |
commit | 5ed27ef8b6362ee2a30dd8f6094fa8ca32a97439 (patch) | |
tree | 69c481d7b8ac3f6025739a773989c3702933209f | |
parent | 72cb9f7e44555965873bc0aa44fa030be3a79167 (diff) |
build: Discover libepoll-shim on FreeBSD
FreeBSD doesn't offer epoll, but an implementation which uses kqueue is
available as an external library. On FreeBSD in subsystems which require
epoll have cmake look for libepoll-shim.
Type: improvement
Change-Id: Iafd5406a9e2ebaa53fd94034489ffbbf87a7d040
Signed-off-by: Tom Jones <thj@freebsd.org>
-rw-r--r-- | src/CMakeLists.txt | 15 | ||||
-rw-r--r-- | src/vlib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/vpp/CMakeLists.txt | 6 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9415c4d44fb..68d0a4fe64e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -245,6 +245,21 @@ include(cmake/exec.cmake) include(cmake/plugin.cmake) ############################################################################## +# FreeBSD - use epoll-shim +############################################################################## +set(EPOLL_LIB "") +if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") + find_path(EPOLL_SHIM_INCLUDE_DIR NAMES sys/epoll.h HINTS /usr/local/include/libepoll-shim) + find_library(EPOLL_SHIM_LIB NAMES epoll-shim HINTS /usr/local/lib) + + if(EPOLL_SHIM_INCLUDE_DIR AND EPOLL_SHIM_LIB) + message(STATUS "Found epoll-shim in ${EPOLL_SHIM_INCLUDE_DIR}") + include_directories(${EPOLL_SHIM_INCLUDE_DIR}) + string(JOIN " " EPOLL_LIB "${EPOLL_SHIM_LIB}") + endif() +endif() + +############################################################################## # subdirs - order matters ############################################################################## option(VPP_HOST_TOOLS_ONLY "Build only host tools" OFF) diff --git a/src/vlib/CMakeLists.txt b/src/vlib/CMakeLists.txt index 61e8ba7dd78..7ec9b2050e9 100644 --- a/src/vlib/CMakeLists.txt +++ b/src/vlib/CMakeLists.txt @@ -153,7 +153,7 @@ add_vpp_library(vlib API_FILES pci/pci_types.api - LINK_LIBRARIES vppinfra svm ${CMAKE_DL_LIBS} + LINK_LIBRARIES vppinfra svm ${CMAKE_DL_LIBS} ${EPOLL_LIB} DEPENDS api_headers ) diff --git a/src/vpp/CMakeLists.txt b/src/vpp/CMakeLists.txt index 37f57ac7823..84144e4d059 100644 --- a/src/vpp/CMakeLists.txt +++ b/src/vpp/CMakeLists.txt @@ -90,7 +90,7 @@ endif() add_vpp_executable(vpp ENABLE_EXPORTS SOURCES ${VPP_SOURCES} - LINK_LIBRARIES svm vlib vppinfra vlibmemory vnet Threads::Threads ${CMAKE_DL_LIBS} + LINK_LIBRARIES svm vlib vppinfra vlibmemory vnet Threads::Threads ${CMAKE_DL_LIBS} ${EPOLL_LIB} DEPENDS vpp_version_h api_headers ) @@ -99,7 +99,7 @@ add_vpp_executable(vpp ############################################################################## add_vpp_executable(vppctl SOURCES app/vppctl.c - LINK_LIBRARIES vppinfra + LINK_LIBRARIES vppinfra ${EPOLL_LIB} ) ############################################################################## @@ -122,7 +122,7 @@ add_vpp_executable(vpp_get_stats add_vpp_executable(vpp_prometheus_export SOURCES app/vpp_prometheus_export.c - LINK_LIBRARIES vppapiclient vppinfra svm vlibmemoryclient + LINK_LIBRARIES vppapiclient vppinfra svm vlibmemoryclient ${EPOLL_LIB} DEPENDS api_headers ) |