1 # Copyright (c) 2018 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 vpp_find_path(IBVERBS_INCLUDE_DIR NAMES infiniband/verbs.h)
16 if (NOT IBVERBS_INCLUDE_DIR)
17 message(WARNING "-- rdma headers not found - rdma plugin disabled")
21 vpp_plugin_find_library(rdma IBVERBS_LIB libibverbs.a)
22 vpp_plugin_find_library(rdma MLX5_LIB libmlx5.a)
24 if (NOT IBVERBS_LIB OR NOT MLX5_LIB)
25 message(WARNING "rdma plugin - ibverbs not found - rdma plugin disabled")
29 string_append(RDMA_LINK_FLAGS "-Wl,--whole-archive,${MLX5_LIB},--no-whole-archive -Wl,--exclude-libs,ALL")
31 set(CMAKE_REQUIRED_FLAGS "-fPIC -shared -pthread -Wno-unused-command-line-argument ${RDMA_LINK_FLAGS} ${IBVERBS_LIB}")
32 set(CMAKE_REQUIRED_INCLUDES "${IBVERBS_INCLUDE_DIR}")
33 set(CMAKE_REQUIRED_LIBRARIES "c") # force linkage by including libc explicitely
34 CHECK_C_SOURCE_COMPILES("
35 #include <infiniband/verbs.h>
38 return 0 != ibv_get_device_list(0);
39 }" IBVERBS_COMPILES_CHECK)
41 if (NOT IBVERBS_COMPILES_CHECK)
42 message(WARNING "rdma plugins - no working ibverbs found - rdma plugin disabled")
46 include_directories(${IBVERBS_INCLUDE_DIR})