VOM: vxlan-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_ext_itf.cpp
80     gbp_ext_itf_cmds.cpp
81     gbp_recirc_cmds.cpp
82     gbp_recirc.cpp
83     gbp_route_domain_cmds.cpp
84     gbp_route_domain.cpp
85     gbp_rule.cpp
86     gbp_subnet_cmds.cpp
87     gbp_subnet.cpp
88     gbp_vxlan.cpp
89     gbp_vxlan_cmds.cpp
90   )
91 endif()
92
93 if (IGMP_FILE)
94   list(APPEND VOM_SOURCES
95     igmp_binding_cmds.cpp
96     igmp_binding.cpp
97     igmp_listen_cmds.cpp
98     igmp_listen.cpp
99   )
100 endif()
101
102 list(APPEND VOM_SOURCES
103   types.cpp
104   api_types.cpp
105   arp_proxy_binding_cmds.cpp
106   arp_proxy_binding.cpp
107   arp_proxy_config_cmds.cpp
108   arp_proxy_config.cpp
109   bond_group_binding_cmds.cpp
110   bond_group_binding.cpp
111   bond_interface_cmds.cpp
112   bond_interface.cpp
113   bond_member.cpp
114   bridge_domain_cmds.cpp
115   bridge_domain.cpp
116   bridge_domain_arp_entry.cpp
117   bridge_domain_arp_entry_cmds.cpp
118   bridge_domain_entry_cmds.cpp
119   bridge_domain_entry.cpp
120   client_db.cpp
121   cmd.cpp
122   connection.cpp
123   dhcp_client_cmds.cpp
124   dhcp_client.cpp
125   hw_cmds.cpp
126   hw.cpp
127   inspect.cpp
128   interface_cmds.cpp
129   interface.cpp
130   interface_factory.cpp
131   interface_ip6_nd_cmds.cpp
132   interface_span_cmds.cpp
133   interface_span.cpp
134   interface_types.cpp
135   ip_punt_redirect_cmds.cpp
136   ip_punt_redirect.cpp
137   ip_unnumbered_cmds.cpp
138   ip_unnumbered.cpp
139   l2_binding_cmds.cpp
140   l2_binding.cpp
141   l2_xconnect_cmds.cpp
142   l2_xconnect.cpp
143   l3_binding_cmds.cpp
144   l3_binding.cpp
145   lldp_binding_cmds.cpp
146   lldp_binding.cpp
147   lldp_global_cmds.cpp
148   lldp_global.cpp
149   logger.cpp
150   neighbour.cpp
151   neighbour_cmds.cpp
152   object_base.cpp
153   om.cpp
154   pipe.cpp
155   pipe_cmds.cpp
156   prefix.cpp
157   ra_config.cpp
158   ra_prefix.cpp
159   route.cpp
160   route_cmds.cpp
161   route_domain.cpp
162   route_domain_cmds.cpp
163   sub_interface_cmds.cpp
164   sub_interface.cpp
165   tap_interface.cpp
166   tap_interface_cmds.cpp
167   vxlan_gbp_tunnel_cmds.cpp
168   vxlan_tunnel_cmds.cpp
169   vxlan_tunnel.cpp
170 )
171
172 if(ACL_FILE)
173   list(APPEND VOM_HEADERS
174     acl_binding.hpp
175     acl_ethertype.hpp
176     acl_l2_rule.hpp
177     acl_l3_rule.hpp
178     acl_list.hpp
179     acl_types.hpp
180   )
181 endif()
182
183 if(NAT_FILE)
184   list(APPEND VOM_HEADERS
185     nat_static.hpp
186     nat_binding.hpp
187   )
188 endif()
189
190 if(L2E_FILE)
191   list(APPEND VOM_HEADERS
192     l2_emulation.hpp
193   )
194 endif()
195
196 if(GBP_FILE)
197   list(APPEND VOM_HEADERS
198     gbp_contract.hpp
199     gbp_bridge_domain.hpp
200     gbp_endpoint.hpp
201     gbp_endpoint_group.hpp
202     gbp_ext_itf.hpp
203     gbp_recirc.hpp
204     gbp_route_domain.hpp
205     gbp_rule.hpp
206     gbp_subnet.hpp
207     gbp_vxlan.hpp
208   )
209 endif()
210
211 if(IGMP_FILE)
212   list(APPEND VOM_HEADERS
213     igmp_binding.hpp
214     igmp_listen.hpp
215   )
216 endif()
217
218 list(APPEND VOM_HEADERS
219   arp_proxy_binding.hpp
220   arp_proxy_config.hpp
221   bond_group_binding.hpp
222   bond_interface.hpp
223   bond_member.hpp
224   bridge_domain.hpp
225   bridge_domain_arp_entry.hpp
226   bridge_domain_entry.hpp
227   client_db.hpp
228   cmd.hpp
229   connection.hpp
230   dhcp_client.hpp
231   dump_cmd.hpp
232   enum_base.hpp
233   event_cmd.hpp
234   hw.hpp
235   inspect.hpp
236   interface.hpp
237   interface_cmds.hpp
238   interface_ip6_nd.hpp
239   interface_span.hpp
240   ip_punt_redirect.hpp
241   ip_unnumbered.hpp
242   l2_binding.hpp
243   l2_xconnect.hpp
244   l3_binding.hpp
245   lldp_binding.hpp
246   lldp_global.hpp
247   logger.hpp
248   neighbour.hpp
249   object_base.hpp
250   om.hpp
251   pipe.hpp
252   prefix.hpp
253   ra_config.hpp
254   ra_prefix.hpp
255   route.hpp
256   route_domain.hpp
257   rpc_cmd.hpp
258   singular_db.hpp
259   singular_db_funcs.hpp
260   sub_interface.hpp
261   tap_interface.hpp
262   types.hpp
263   api_types.hpp
264   vxlan_tunnel.hpp
265 )
266
267 add_definitions(-Wall -Werror -std=gnu++11)
268
269 add_vpp_library(vom
270   SOURCES ${VOM_SOURCES}
271
272   INSTALL_HEADERS ${VOM_HEADERS}
273
274   LINK_LIBRARIES ${VAPICLIENT_LIB} Threads::Threads boost_thread
275     ${BOOST_SYSTEM_LIB} ${BOOST_FILESYSTEM_LIB} ${BOOST_ASIO_LIB} m rt
276
277   COMPONENT libvom
278 )