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