GBP: Global config for EP retention
[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_global.cpp
91     gbp_global_cmds.cpp
92     gbp_recirc_cmds.cpp
93     gbp_recirc.cpp
94     gbp_route_domain_cmds.cpp
95     gbp_route_domain.cpp
96     gbp_rule.cpp
97     gbp_subnet_cmds.cpp
98     gbp_subnet.cpp
99     gbp_vxlan.cpp
100     gbp_vxlan_cmds.cpp
101   )
102 endif()
103
104 if (IGMP_FILE)
105   list(APPEND VOM_SOURCES
106     igmp_binding_cmds.cpp
107     igmp_binding.cpp
108     igmp_listen_cmds.cpp
109     igmp_listen.cpp
110   )
111 endif()
112
113 list(APPEND VOM_SOURCES
114   types.cpp
115   api_types.cpp
116   arp_proxy_binding_cmds.cpp
117   arp_proxy_binding.cpp
118   arp_proxy_config_cmds.cpp
119   arp_proxy_config.cpp
120   bond_group_binding_cmds.cpp
121   bond_group_binding.cpp
122   bond_interface_cmds.cpp
123   bond_interface.cpp
124   bond_member.cpp
125   bridge_domain_cmds.cpp
126   bridge_domain.cpp
127   bridge_domain_arp_entry.cpp
128   bridge_domain_arp_entry_cmds.cpp
129   bridge_domain_entry_cmds.cpp
130   bridge_domain_entry.cpp
131   client_db.cpp
132   cmd.cpp
133   connection.cpp
134   dhcp_client_cmds.cpp
135   dhcp_client.cpp
136   hw_cmds.cpp
137   hw.cpp
138   inspect.cpp
139   interface_cmds.cpp
140   interface.cpp
141   interface_factory.cpp
142   interface_ip6_nd_cmds.cpp
143   interface_span_cmds.cpp
144   interface_span.cpp
145   interface_types.cpp
146   ip_punt_redirect_cmds.cpp
147   ip_punt_redirect.cpp
148   ip_unnumbered_cmds.cpp
149   ip_unnumbered.cpp
150   l2_binding_cmds.cpp
151   l2_binding.cpp
152   l2_vtr.cpp
153   l2_vtr_cmds.cpp
154   l2_xconnect_cmds.cpp
155   l2_xconnect.cpp
156   l3_binding_cmds.cpp
157   l3_binding.cpp
158   lldp_binding_cmds.cpp
159   lldp_binding.cpp
160   lldp_global_cmds.cpp
161   lldp_global.cpp
162   logger.cpp
163   neighbour.cpp
164   neighbour_cmds.cpp
165   object_base.cpp
166   mroute_cmds.cpp
167   om.cpp
168   pipe.cpp
169   pipe_cmds.cpp
170   prefix.cpp
171   ra_config.cpp
172   ra_prefix.cpp
173   route.cpp
174   route_api_types.cpp
175   route_cmds.cpp
176   route_domain.cpp
177   route_domain_cmds.cpp
178   stat_client.cpp
179   stat_reader.cpp
180   sub_interface_cmds.cpp
181   sub_interface.cpp
182   tap_interface.cpp
183   tap_interface_cmds.cpp
184   vxlan_gbp_tunnel_cmds.cpp
185   vxlan_tunnel_cmds.cpp
186   vxlan_tunnel.cpp
187 )
188
189 if(ACL_FILE)
190   list(APPEND VOM_HEADERS
191     acl_binding.hpp
192     acl_ethertype.hpp
193     acl_l2_rule.hpp
194     acl_l3_rule.hpp
195     acl_l3_list.hpp
196     acl_l2_list.hpp
197     acl_types.hpp
198   )
199 endif()
200
201 if(NAT_FILE)
202   list(APPEND VOM_HEADERS
203     nat_static.hpp
204     nat_binding.hpp
205   )
206 endif()
207
208 if(L2E_FILE)
209   list(APPEND VOM_HEADERS
210     l2_emulation.hpp
211   )
212 endif()
213
214 if(GBP_FILE)
215   list(APPEND VOM_HEADERS
216     gbp_contract.hpp
217     gbp_bridge_domain.hpp
218     gbp_endpoint.hpp
219     gbp_endpoint_group.hpp
220     gbp_ext_itf.hpp
221     gbp_global.hpp
222     gbp_recirc.hpp
223     gbp_route_domain.hpp
224     gbp_rule.hpp
225     gbp_subnet.hpp
226     gbp_vxlan.hpp
227   )
228 endif()
229
230 if(IGMP_FILE)
231   list(APPEND VOM_HEADERS
232     igmp_binding.hpp
233     igmp_listen.hpp
234   )
235 endif()
236
237 list(APPEND VOM_HEADERS
238   arp_proxy_binding.hpp
239   arp_proxy_config.hpp
240   bond_group_binding.hpp
241   bond_interface.hpp
242   bond_member.hpp
243   bridge_domain.hpp
244   bridge_domain_arp_entry.hpp
245   bridge_domain_entry.hpp
246   client_db.hpp
247   cmd.hpp
248   connection.hpp
249   dhcp_client.hpp
250   dump_cmd.hpp
251   enum_base.hpp
252   event_cmd.hpp
253   hw.hpp
254   inspect.hpp
255   interface.hpp
256   interface_cmds.hpp
257   interface_ip6_nd.hpp
258   interface_span.hpp
259   ip_punt_redirect.hpp
260   ip_unnumbered.hpp
261   l2_binding.hpp
262   l2_vtr.hpp
263   l2_xconnect.hpp
264   l3_binding.hpp
265   lldp_binding.hpp
266   lldp_global.hpp
267   logger.hpp
268   neighbour.hpp
269   object_base.hpp
270   om.hpp
271   pipe.hpp
272   prefix.hpp
273   ra_config.hpp
274   ra_prefix.hpp
275   route.hpp
276   route_domain.hpp
277   rpc_cmd.hpp
278   singular_db.hpp
279   singular_db_funcs.hpp
280   stat_client.hpp
281   stat_reader.hpp
282   sub_interface.hpp
283   tap_interface.hpp
284   types.hpp
285   api_types.hpp
286   vxlan_tunnel.hpp
287 )
288
289 add_definitions(-Wall -Werror -std=gnu++11)
290 add_library(vom SHARED ${VOM_SOURCES})
291 if (VOM_LIB_VERSION)
292   set_target_properties(vom PROPERTIES SOVERSION ${VOM_LIB_VERSION})
293 endif()
294 target_link_libraries(vom ${VPPAPICLIENT_LIB} ${VAPICLIENT_LIB} Threads::Threads
295     ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} m rt)
296 install(TARGETS vom DESTINATION lib COMPONENT vom)
297 install(FILES ${VOM_HEADERS} DESTINATION include/vom COMPONENT vom)
298
299 if (Boost_FOUND)
300   if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
301     add_definitions(-stdlib=libstdc++)
302   endif()
303   add_executable(vom_stats_test test_stats.cpp)
304   if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
305     target_link_libraries(vom_stats_test vom stdc++)
306   else()
307     target_link_libraries(vom_stats_test vom)
308   endif()
309 endif()