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
104 list(APPEND VOM_SOURCES
105 igmp_binding_cmds.cpp
112 list(APPEND VOM_SOURCES
115 arp_proxy_binding_cmds.cpp
116 arp_proxy_binding.cpp
117 arp_proxy_config_cmds.cpp
119 bond_group_binding_cmds.cpp
120 bond_group_binding.cpp
121 bond_interface_cmds.cpp
124 bridge_domain_cmds.cpp
126 bridge_domain_arp_entry.cpp
127 bridge_domain_arp_entry_cmds.cpp
128 bridge_domain_entry_cmds.cpp
129 bridge_domain_entry.cpp
140 interface_factory.cpp
141 interface_ip6_nd_cmds.cpp
142 interface_span_cmds.cpp
145 ip_punt_redirect_cmds.cpp
147 ip_unnumbered_cmds.cpp
157 lldp_binding_cmds.cpp
176 route_domain_cmds.cpp
179 sub_interface_cmds.cpp
182 tap_interface_cmds.cpp
183 vxlan_gbp_tunnel_cmds.cpp
184 vxlan_tunnel_cmds.cpp
189 list(APPEND VOM_HEADERS
201 list(APPEND VOM_HEADERS
208 list(APPEND VOM_HEADERS
214 list(APPEND VOM_HEADERS
216 gbp_bridge_domain.hpp
218 gbp_endpoint_group.hpp
230 list(APPEND VOM_HEADERS
236 list(APPEND VOM_HEADERS
237 arp_proxy_binding.hpp
239 bond_group_binding.hpp
243 bridge_domain_arp_entry.hpp
244 bridge_domain_entry.hpp
278 singular_db_funcs.hpp
288 add_definitions(-Wall -Werror -std=gnu++11)
289 add_library(vom SHARED ${VOM_SOURCES})
291 set_target_properties(vom PROPERTIES SOVERSION ${VOM_LIB_VERSION})
293 target_link_libraries(vom ${VPPAPICLIENT_LIB} ${VAPICLIENT_LIB} Threads::Threads
294 ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} m rt)
295 install(TARGETS vom DESTINATION lib COMPONENT vom)
296 install(FILES ${VOM_HEADERS} DESTINATION include/vom COMPONENT vom)
299 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
300 add_definitions(-stdlib=libstdc++)
302 add_executable(vom_stats_test test_stats.cpp)
303 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
304 target_link_libraries(vom_stats_test vom stdc++)
306 target_link_libraries(vom_stats_test vom)