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 message(STATUS "RDMA plugins - looking for ibverbs")
16 find_path(IBVERBS_INCLUDE_DIR NAMES infiniband/verbs.h)
17 find_library(IBVERBS_LIB NAMES libibverbs.a)
18 find_library(MLX5_LIB NAMES libmlx5.a)
20 if (NOT IBVERBS_LIB OR NOT MLX5_LIB)
21 message(WARNING "RDMA plugins - ibverbs not found - rdma_plugin disabled")
26 string_append(RDMA_LINK_FLAGS "-Wl,--whole-archive,${MLX5_LIB},--no-whole-archive")
29 set(CMAKE_REQUIRED_FLAGS "-fPIC -shared ${IBVERBS_LIB} ${RDMA_LINK_FLAGS}")
30 CHECK_C_SOURCE_COMPILES("" IBVERBS_COMPILES_CHECK)
32 if (NOT IBVERBS_COMPILES_CHECK)
33 message(WARNING "RDMA plugins - no working ibverbs found - rdma_plugin disabled")
37 message(STATUS "RDMA plugins - found ${IBVERBS_INCLUDE_DIR}")
38 message(STATUS "RDMA plugins - found ${IBVERBS_LIB}")
39 message(STATUS "RDMA plugins - found ${MLX5_LIB}")
41 include_directories(${IBVERBS_INCLUDE_DIR})