vom: Add support for redirect contracts in gbp
[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 (VAPICLIENT_LIB)
15 unset (ACL_FILE)
16 unset (NAT_FILE)
17 unset (L2E_FILE)
18 unset (GBP_FILE)
19 unset (IGMP_FILE)
20 unset (VOM_SOURCES)
21 unset (VOM_HEADERS)
22
23 find_library(VAPICLIENT_LIB NAMES vapiclient REQUIRED)
24 find_path(VAPICLIENT_INCLUDE_DIR NAMES vapi/vapi.hpp)
25
26 if(NOT VAPICLIENT_INCLUDE_DIR OR NOT VAPICLIENT_LIB)
27   message(FATAL_ERROR "Cannot find vapiclient library and/or headers")
28 endif()
29
30 include_directories(${VAPICLIENT_INCLUDE_DIR})
31 include_directories(${CMAKE_SOURCE_DIR})
32
33 find_file(ACL_FILE NAMES acl.api.vapi.hpp PATH_SUFFIXES vapi)
34 find_file(NAT_FILE NAMES nat.api.vapi.hpp PATH_SUFFIXES vapi)
35 find_file(L2E_FILE NAMES l2e.api.vapi.hpp PATH_SUFFIXES vapi)
36 find_file(GBP_FILE NAMES gbp.api.vapi.hpp PATH_SUFFIXES vapi)
37 find_file(IGMP_FILE NAMES igmp.api.vapi.hpp PATH_SUFFIXES vapi)
38
39 if(ACL_FILE)
40   list(APPEND VOM_SOURCES
41     acl_binding_cmds.cpp
42     acl_binding.cpp
43     acl_ethertype_cmds.cpp
44     acl_ethertype.cpp
45     acl_l2_rule.cpp
46     acl_l3_rule.cpp
47     acl_list_cmds.cpp
48     acl_list.cpp
49     acl_types.cpp
50   )
51 endif()
52
53 if(NAT_FILE)
54   list(APPEND VOM_SOURCES
55     nat_static.cpp
56     nat_static_cmds.cpp
57     nat_binding.cpp
58     nat_binding_cmds.cpp
59   )
60 endif()
61
62 if (L2E_FILE)
63   list(APPEND VOM_SOURCES
64     l2_emulation_cmds.cpp
65     l2_emulation.cpp
66   )
67 endif()
68
69 if(GBP_FILE)
70   list(APPEND VOM_SOURCES
71     gbp_contract_cmds.cpp
72     gbp_contract.cpp
73     gbp_bridge_domain_cmds.cpp
74     gbp_bridge_domain.cpp
75     gbp_endpoint_cmds.cpp
76     gbp_endpoint.cpp
77     gbp_endpoint_group_cmds.cpp
78     gbp_endpoint_group.cpp
79     gbp_recirc_cmds.cpp
80     gbp_recirc.cpp
81     gbp_route_domain_cmds.cpp
82     gbp_route_domain.cpp
83     gbp_rule.cpp
84     gbp_subnet_cmds.cpp
85     gbp_subnet.cpp
86     gbp_vxlan.cpp
87     gbp_vxlan_cmds.cpp
88   )
89 endif()
90
91 if (IGMP_FILE)
92   list(APPEND VOM_SOURCES
93     igmp_binding_cmds.cpp
94     igmp_binding.cpp
95     igmp_listen_cmds.cpp
96     igmp_listen.cpp
97   )
98 endif()
99
100 list(APPEND VOM_SOURCES
101   types.cpp
102   api_types.cpp
103   arp_proxy_binding_cmds.cpp
104   arp_proxy_binding.cpp
105   arp_proxy_config_cmds.cpp
106   arp_proxy_config.cpp
107   bond_group_binding_cmds.cpp
108   bond_group_binding.cpp
109   bond_interface_cmds.cpp
110   bond_interface.cpp
111   bond_member.cpp
112   bridge_domain_cmds.cpp
113   bridge_domain.cpp
114   bridge_domain_arp_entry.cpp
115   bridge_domain_arp_entry_cmds.cpp
116   bridge_domain_entry_cmds.cpp
117   bridge_domain_entry.cpp
118   client_db.cpp
119   cmd.cpp
120   connection.cpp
121   dhcp_client_cmds.cpp
122   dhcp_client.cpp
123   hw_cmds.cpp
124   hw.cpp
125   inspect.cpp
126   interface_cmds.cpp
127   interface.cpp
128   interface_factory.cpp
129   interface_ip6_nd_cmds.cpp
130   interface_span_cmds.cpp
131   interface_span.cpp
132   interface_types.cpp
133   ip_punt_redirect_cmds.cpp
134   ip_punt_redirect.cpp
135   ip_unnumbered_cmds.cpp
136   ip_unnumbered.cpp
137   l2_binding_cmds.cpp
138   l2_binding.cpp
139   l2_xconnect_cmds.cpp
140   l2_xconnect.cpp
141   l3_binding_cmds.cpp
142   l3_binding.cpp
143   lldp_binding_cmds.cpp
144   lldp_binding.cpp
145   lldp_global_cmds.cpp
146   lldp_global.cpp
147   logger.cpp
148   neighbour.cpp
149   neighbour_cmds.cpp
150   object_base.cpp
151   om.cpp
152   pipe.cpp
153   pipe_cmds.cpp
154   prefix.cpp
155   ra_config.cpp
156   ra_prefix.cpp
157   route.cpp
158   route_cmds.cpp
159   route_domain.cpp
160   route_domain_cmds.cpp
161   sub_interface_cmds.cpp
162   sub_interface.cpp
163   tap_interface.cpp
164   tap_interface_cmds.cpp
165   vxlan_tunnel_cmds.cpp
166   vxlan_tunnel.cpp
167 )
168
169 if(ACL_FILE)
170   list(APPEND VOM_HEADERS
171     acl_binding.hpp
172     acl_ethertype.hpp
173     acl_l2_rule.hpp
174     acl_l3_rule.hpp
175     acl_list.hpp
176     acl_types.hpp
177   )
178 endif()
179
180 if(NAT_FILE)
181   list(APPEND VOM_HEADERS
182     nat_static.hpp
183     nat_binding.hpp
184   )
185 endif()
186
187 if(L2E_FILE)
188   list(APPEND VOM_HEADERS
189     l2_emulation.hpp
190   )
191 endif()
192
193 if(GBP_FILE)
194   list(APPEND VOM_HEADERS
195     gbp_contract.hpp
196     gbp_bridge_domain.hpp
197     gbp_endpoint.hpp
198     gbp_endpoint_group.hpp
199     gbp_recirc.hpp
200     gbp_route_domain.hpp
201     gbp_rule.hpp
202     gbp_subnet.hpp
203     gbp_vxlan.hpp
204   )
205 endif()
206
207 if(IGMP_FILE)
208   list(APPEND VOM_HEADERS
209     igmp_binding.hpp
210     igmp_listen.hpp
211   )
212 endif()
213
214 list(APPEND VOM_HEADERS
215   arp_proxy_binding.hpp
216   arp_proxy_config.hpp
217   bond_group_binding.hpp
218   bond_interface.hpp
219   bond_member.hpp
220   bridge_domain.hpp
221   bridge_domain_arp_entry.hpp
222   bridge_domain_entry.hpp
223   client_db.hpp
224   cmd.hpp
225   connection.hpp
226   dhcp_client.hpp
227   dump_cmd.hpp
228   enum_base.hpp
229   event_cmd.hpp
230   hw.hpp
231   inspect.hpp
232   interface.hpp
233   interface_cmds.hpp
234   interface_ip6_nd.hpp
235   interface_span.hpp
236   ip_punt_redirect.hpp
237   ip_unnumbered.hpp
238   l2_binding.hpp
239   l2_xconnect.hpp
240   l3_binding.hpp
241   lldp_binding.hpp
242   lldp_global.hpp
243   logger.hpp
244   neighbour.hpp
245   object_base.hpp
246   om.hpp
247   pipe.hpp
248   prefix.hpp
249   ra_config.hpp
250   ra_prefix.hpp
251   route.hpp
252   route_domain.hpp
253   rpc_cmd.hpp
254   singular_db.hpp
255   singular_db_funcs.hpp
256   sub_interface.hpp
257   tap_interface.hpp
258   types.hpp
259   api_types.hpp
260   vxlan_tunnel.hpp
261 )
262
263 add_definitions(-Wall -Werror -std=gnu++11)
264
265 add_vpp_library(vom
266   SOURCES ${VOM_SOURCES}
267
268   INSTALL_HEADERS ${VOM_HEADERS}
269
270   LINK_LIBRARIES ${VAPICLIENT_LIB} Threads::Threads boost_thread
271     ${BOOST_SYSTEM_LIB} ${BOOST_FILESYSTEM_LIB} ${BOOST_ASIO_LIB} m rt
272
273   COMPONENT libvom
274 )