ip: Replace Sematics for Interface IP addresses
[vpp.git] / src / plugins / rdma / CMakeLists.txt
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:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
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.
13
14 find_path(IBVERBS_INCLUDE_DIR NAMES infiniband/verbs.h)
15
16 if (NOT IBVERBS_INCLUDE_DIR)
17   message(WARNING "-- rdma headers not found - rdma plugin disabled")
18   return()
19 endif()
20
21 vpp_plugin_find_library(rdma IBVERBS_LIB libibverbs.a)
22 vpp_plugin_find_library(rdma RDMA_UTIL_LIB librdma_util.a)
23 vpp_plugin_find_library(rdma MLX5_LIB libmlx5.a)
24
25 if (NOT IBVERBS_LIB OR NOT RDMA_UTIL_LIB OR NOT MLX5_LIB)
26   message(WARNING "rdma plugin - ibverbs not found - rdma plugin disabled")
27   return()
28 endif()
29
30 string_append(RDMA_LINK_FLAGS "-Wl,--whole-archive,${MLX5_LIB},--no-whole-archive")
31
32 set(CMAKE_REQUIRED_FLAGS "-fPIC -shared -pthread ${RDMA_LINK_FLAGS} ${IBVERBS_LIB} ${RDMA_UTIL_LIB}")
33 CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" IBVERBS_COMPILES_CHECK)
34
35 if (NOT IBVERBS_COMPILES_CHECK)
36   message(WARNING "rdma plugins - no working ibverbs found - rdma plugin disabled")
37   return()
38 endif()
39
40 include_directories(${IBVERBS_INCLUDE_DIR})
41
42 add_vpp_plugin(rdma
43   SOURCES
44   api.c
45   cli.c
46   device.c
47   format.c
48   plugin.c
49   unformat.c
50   input.c
51   output.c
52
53   MULTIARCH_SOURCES
54   input.c
55   output.c
56
57   API_FILES
58   rdma.api
59
60   API_TEST_SOURCES
61   unformat.c
62   test_api.c
63
64   LINK_FLAGS
65   "${RDMA_LINK_FLAGS}"
66
67   LINK_LIBRARIES
68   ${IBVERBS_LIB}
69   ${RDMA_UTIL_LIB}
70 )