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 unset (VPPAPICLIENT_LIB)
15 unset (VAPICLIENT_LIB)
24 find_library(VPPAPICLIENT_LIB NAMES vppapiclient REQUIRED)
25 find_path(VPPAPICLIENT_INCLUDE_DIR NAMES vpp-api/client/vppapiclient.h)
26 find_library(VAPICLIENT_LIB NAMES vapiclient REQUIRED)
27 find_path(VAPICLIENT_INCLUDE_DIR NAMES vapi/vapi.hpp)
30 if(NOT VPPAPICLIENT_INCLUDE_DIR OR NOT VPPAPICLIENT_LIB)
31 message(FATAL_ERROR "Cannot find vppapiclient library and/or headers")
33 if(NOT VAPICLIENT_INCLUDE_DIR OR NOT VAPICLIENT_LIB)
34 message(FATAL_ERROR "Cannot find vapiclient library and/or headers")
37 include_directories(${VPPAPICLIENT_INCLUDE_DIR})
38 include_directories(${VAPICLIENT_INCLUDE_DIR})
39 include_directories(${CMAKE_SOURCE_DIR})
41 find_file(ACL_FILE NAMES acl.api.vapi.hpp PATH_SUFFIXES vapi)
42 find_file(NAT_FILE NAMES nat.api.vapi.hpp PATH_SUFFIXES vapi)
43 find_file(L2E_FILE NAMES l2e.api.vapi.hpp PATH_SUFFIXES vapi)
44 find_file(GBP_FILE NAMES gbp.api.vapi.hpp PATH_SUFFIXES vapi)
45 find_file(IGMP_FILE NAMES igmp.api.vapi.hpp PATH_SUFFIXES vapi)
48 list(APPEND VOM_SOURCES
51 acl_ethertype_cmds.cpp
63 list(APPEND VOM_SOURCES
72 list(APPEND VOM_SOURCES
79 list(APPEND VOM_SOURCES
82 gbp_bridge_domain_cmds.cpp
86 gbp_endpoint_group_cmds.cpp
87 gbp_endpoint_group.cpp
92 gbp_route_domain_cmds.cpp
103 list(APPEND VOM_SOURCES
104 igmp_binding_cmds.cpp
111 list(APPEND VOM_SOURCES
114 arp_proxy_binding_cmds.cpp
115 arp_proxy_binding.cpp
116 arp_proxy_config_cmds.cpp
118 bond_group_binding_cmds.cpp
119 bond_group_binding.cpp
120 bond_interface_cmds.cpp
123 bridge_domain_cmds.cpp
125 bridge_domain_arp_entry.cpp
126 bridge_domain_arp_entry_cmds.cpp
127 bridge_domain_entry_cmds.cpp
128 bridge_domain_entry.cpp
139 interface_factory.cpp
140 interface_ip6_nd_cmds.cpp
141 interface_span_cmds.cpp
144 ip_punt_redirect_cmds.cpp
146 ip_unnumbered_cmds.cpp
156 lldp_binding_cmds.cpp
175 route_domain_cmds.cpp
178 sub_interface_cmds.cpp
181 tap_interface_cmds.cpp
182 vxlan_gbp_tunnel_cmds.cpp
183 vxlan_tunnel_cmds.cpp
188 list(APPEND VOM_HEADERS
200 list(APPEND VOM_HEADERS
207 list(APPEND VOM_HEADERS
213 list(APPEND VOM_HEADERS
215 gbp_bridge_domain.hpp
217 gbp_endpoint_group.hpp
228 list(APPEND VOM_HEADERS
234 list(APPEND VOM_HEADERS
235 arp_proxy_binding.hpp
237 bond_group_binding.hpp
241 bridge_domain_arp_entry.hpp
242 bridge_domain_entry.hpp
276 singular_db_funcs.hpp
286 add_definitions(-Wall -Werror -std=gnu++11)
287 add_library(vom SHARED ${VOM_SOURCES})
289 set_target_properties(vom PROPERTIES SOVERSION ${VOM_LIB_VERSION})
291 target_link_libraries(vom ${VPPAPICLIENT_LIB} ${VAPICLIENT_LIB} Threads::Threads
292 ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} m rt)
293 install(TARGETS vom DESTINATION lib COMPONENT vom)
294 install(FILES ${VOM_HEADERS} DESTINATION include/vom COMPONENT vom)
297 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
298 add_definitions(-stdlib=libstdc++)
300 add_executable(vom_stats_test test_stats.cpp)
301 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
302 target_link_libraries(vom_stats_test vom stdc++)
304 target_link_libraries(vom_stats_test vom)