GBP: per-group EP retention policy
[vpp.git] / extras / vom / vom / 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 unset (VPPAPICLIENT_LIB)
15 unset (VAPICLIENT_LIB)
16 unset (ACL_FILE)
17 unset (NAT_FILE)
18 unset (L2E_FILE)
19 unset (GBP_FILE)
20 unset (IGMP_FILE)
21 unset (VOM_SOURCES)
22 unset (VOM_HEADERS)
23
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)
28
29
30 if(NOT VPPAPICLIENT_INCLUDE_DIR OR NOT VPPAPICLIENT_LIB)
31   message(FATAL_ERROR "Cannot find vppapiclient library and/or headers")
32 endif()
33 if(NOT VAPICLIENT_INCLUDE_DIR OR NOT VAPICLIENT_LIB)
34   message(FATAL_ERROR "Cannot find vapiclient library and/or headers")
35 endif()
36
37 include_directories(${VPPAPICLIENT_INCLUDE_DIR})
38 include_directories(${VAPICLIENT_INCLUDE_DIR})
39 include_directories(${CMAKE_SOURCE_DIR})
40
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)
46
47 if(ACL_FILE)
48   list(APPEND VOM_SOURCES
49     acl_binding_cmds.cpp
50     acl_binding.cpp
51     acl_ethertype_cmds.cpp
52     acl_ethertype.cpp
53     acl_l2_list.cpp
54     acl_l2_rule.cpp
55     acl_l3_list.cpp
56     acl_l3_rule.cpp
57     acl_list_cmds.cpp
58     acl_types.cpp
59   )
60 endif()
61
62 if(NAT_FILE)
63   list(APPEND VOM_SOURCES
64     nat_static.cpp
65     nat_static_cmds.cpp
66     nat_binding.cpp
67     nat_binding_cmds.cpp
68   )
69 endif()
70
71 if (L2E_FILE)
72   list(APPEND VOM_SOURCES
73     l2_emulation_cmds.cpp
74     l2_emulation.cpp
75   )
76 endif()
77
78 if(GBP_FILE)
79   list(APPEND VOM_SOURCES
80     gbp_contract_cmds.cpp
81     gbp_contract.cpp
82     gbp_bridge_domain_cmds.cpp
83     gbp_bridge_domain.cpp
84     gbp_endpoint_cmds.cpp
85     gbp_endpoint.cpp
86     gbp_endpoint_group_cmds.cpp
87     gbp_endpoint_group.cpp
88     gbp_ext_itf.cpp
89     gbp_ext_itf_cmds.cpp
90     gbp_recirc_cmds.cpp
91     gbp_recirc.cpp
92     gbp_route_domain_cmds.cpp
93     gbp_route_domain.cpp
94     gbp_rule.cpp
95     gbp_subnet_cmds.cpp
96     gbp_subnet.cpp
97     gbp_vxlan.cpp
98     gbp_vxlan_cmds.cpp
99   )
100 endif()
101
102 if (IGMP_FILE)
103   list(APPEND VOM_SOURCES
104     igmp_binding_cmds.cpp
105     igmp_binding.cpp
106     igmp_listen_cmds.cpp
107     igmp_listen.cpp
108   )
109 endif()
110
111 list(APPEND VOM_SOURCES
112   types.cpp
113   api_types.cpp
114   arp_proxy_binding_cmds.cpp
115   arp_proxy_binding.cpp
116   arp_proxy_config_cmds.cpp
117   arp_proxy_config.cpp
118   bond_group_binding_cmds.cpp
119   bond_group_binding.cpp
120   bond_interface_cmds.cpp
121   bond_interface.cpp
122   bond_member.cpp
123   bridge_domain_cmds.cpp
124   bridge_domain.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
129   client_db.cpp
130   cmd.cpp
131   connection.cpp
132   dhcp_client_cmds.cpp
133   dhcp_client.cpp
134   hw_cmds.cpp
135   hw.cpp
136   inspect.cpp
137   interface_cmds.cpp
138   interface.cpp
139   interface_factory.cpp
140   interface_ip6_nd_cmds.cpp
141   interface_span_cmds.cpp
142   interface_span.cpp
143   interface_types.cpp
144   ip_punt_redirect_cmds.cpp
145   ip_punt_redirect.cpp
146   ip_unnumbered_cmds.cpp
147   ip_unnumbered.cpp
148   l2_binding_cmds.cpp
149   l2_binding.cpp
150   l2_vtr.cpp
151   l2_vtr_cmds.cpp
152   l2_xconnect_cmds.cpp
153   l2_xconnect.cpp
154   l3_binding_cmds.cpp
155   l3_binding.cpp
156   lldp_binding_cmds.cpp
157   lldp_binding.cpp
158   lldp_global_cmds.cpp
159   lldp_global.cpp
160   logger.cpp
161   neighbour.cpp
162   neighbour_cmds.cpp
163   object_base.cpp
164   mroute_cmds.cpp
165   om.cpp
166   pipe.cpp
167   pipe_cmds.cpp
168   prefix.cpp
169   ra_config.cpp
170   ra_prefix.cpp
171   route.cpp
172   route_api_types.cpp
173   route_cmds.cpp
174   route_domain.cpp
175   route_domain_cmds.cpp
176   stat_client.cpp
177   stat_reader.cpp
178   sub_interface_cmds.cpp
179   sub_interface.cpp
180   tap_interface.cpp
181   tap_interface_cmds.cpp
182   vxlan_gbp_tunnel_cmds.cpp
183   vxlan_tunnel_cmds.cpp
184   vxlan_tunnel.cpp
185 )
186
187 if(ACL_FILE)
188   list(APPEND VOM_HEADERS
189     acl_binding.hpp
190     acl_ethertype.hpp
191     acl_l2_rule.hpp
192     acl_l3_rule.hpp
193     acl_l3_list.hpp
194     acl_l2_list.hpp
195     acl_types.hpp
196   )
197 endif()
198
199 if(NAT_FILE)
200   list(APPEND VOM_HEADERS
201     nat_static.hpp
202     nat_binding.hpp
203   )
204 endif()
205
206 if(L2E_FILE)
207   list(APPEND VOM_HEADERS
208     l2_emulation.hpp
209   )
210 endif()
211
212 if(GBP_FILE)
213   list(APPEND VOM_HEADERS
214     gbp_contract.hpp
215     gbp_bridge_domain.hpp
216     gbp_endpoint.hpp
217     gbp_endpoint_group.hpp
218     gbp_ext_itf.hpp
219     gbp_recirc.hpp
220     gbp_route_domain.hpp
221     gbp_rule.hpp
222     gbp_subnet.hpp
223     gbp_vxlan.hpp
224   )
225 endif()
226
227 if(IGMP_FILE)
228   list(APPEND VOM_HEADERS
229     igmp_binding.hpp
230     igmp_listen.hpp
231   )
232 endif()
233
234 list(APPEND VOM_HEADERS
235   arp_proxy_binding.hpp
236   arp_proxy_config.hpp
237   bond_group_binding.hpp
238   bond_interface.hpp
239   bond_member.hpp
240   bridge_domain.hpp
241   bridge_domain_arp_entry.hpp
242   bridge_domain_entry.hpp
243   client_db.hpp
244   cmd.hpp
245   connection.hpp
246   dhcp_client.hpp
247   dump_cmd.hpp
248   enum_base.hpp
249   event_cmd.hpp
250   hw.hpp
251   inspect.hpp
252   interface.hpp
253   interface_cmds.hpp
254   interface_ip6_nd.hpp
255   interface_span.hpp
256   ip_punt_redirect.hpp
257   ip_unnumbered.hpp
258   l2_binding.hpp
259   l2_vtr.hpp
260   l2_xconnect.hpp
261   l3_binding.hpp
262   lldp_binding.hpp
263   lldp_global.hpp
264   logger.hpp
265   neighbour.hpp
266   object_base.hpp
267   om.hpp
268   pipe.hpp
269   prefix.hpp
270   ra_config.hpp
271   ra_prefix.hpp
272   route.hpp
273   route_domain.hpp
274   rpc_cmd.hpp
275   singular_db.hpp
276   singular_db_funcs.hpp
277   stat_client.hpp
278   stat_reader.hpp
279   sub_interface.hpp
280   tap_interface.hpp
281   types.hpp
282   api_types.hpp
283   vxlan_tunnel.hpp
284 )
285
286 add_definitions(-Wall -Werror -std=gnu++11)
287 add_library(vom SHARED ${VOM_SOURCES})
288 if (VOM_LIB_VERSION)
289   set_target_properties(vom PROPERTIES SOVERSION ${VOM_LIB_VERSION})
290 endif()
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)
295
296 if (Boost_FOUND)
297   if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
298     add_definitions(-stdlib=libstdc++)
299   endif()
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++)
303   else()
304     target_link_libraries(vom_stats_test vom)
305   endif()
306 endif()