f68a74093629572e61ee79cb14aad64e5c216e74
[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_tunnel_cmds.cpp
168   vxlan_tunnel.cpp
169 )
170
171 if(ACL_FILE)
172   list(APPEND VOM_HEADERS
173     acl_binding.hpp
174     acl_ethertype.hpp
175     acl_l2_rule.hpp
176     acl_l3_rule.hpp
177     acl_list.hpp
178     acl_types.hpp
179   )
180 endif()
181
182 if(NAT_FILE)
183   list(APPEND VOM_HEADERS
184     nat_static.hpp
185     nat_binding.hpp
186   )
187 endif()
188
189 if(L2E_FILE)
190   list(APPEND VOM_HEADERS
191     l2_emulation.hpp
192   )
193 endif()
194
195 if(GBP_FILE)
196   list(APPEND VOM_HEADERS
197     gbp_contract.hpp
198     gbp_bridge_domain.hpp
199     gbp_endpoint.hpp
200     gbp_endpoint_group.hpp
201     gbp_ext_itf.hpp
202     gbp_recirc.hpp
203     gbp_route_domain.hpp
204     gbp_rule.hpp
205     gbp_subnet.hpp
206     gbp_vxlan.hpp
207   )
208 endif()
209
210 if(IGMP_FILE)
211   list(APPEND VOM_HEADERS
212     igmp_binding.hpp
213     igmp_listen.hpp
214   )
215 endif()
216
217 list(APPEND VOM_HEADERS
218   arp_proxy_binding.hpp
219   arp_proxy_config.hpp
220   bond_group_binding.hpp
221   bond_interface.hpp
222   bond_member.hpp
223   bridge_domain.hpp
224   bridge_domain_arp_entry.hpp
225   bridge_domain_entry.hpp
226   client_db.hpp
227   cmd.hpp
228   connection.hpp
229   dhcp_client.hpp
230   dump_cmd.hpp
231   enum_base.hpp
232   event_cmd.hpp
233   hw.hpp
234   inspect.hpp
235   interface.hpp
236   interface_cmds.hpp
237   interface_ip6_nd.hpp
238   interface_span.hpp
239   ip_punt_redirect.hpp
240   ip_unnumbered.hpp
241   l2_binding.hpp
242   l2_xconnect.hpp
243   l3_binding.hpp
244   lldp_binding.hpp
245   lldp_global.hpp
246   logger.hpp
247   neighbour.hpp
248   object_base.hpp
249   om.hpp
250   pipe.hpp
251   prefix.hpp
252   ra_config.hpp
253   ra_prefix.hpp
254   route.hpp
255   route_domain.hpp
256   rpc_cmd.hpp
257   singular_db.hpp
258   singular_db_funcs.hpp
259   sub_interface.hpp
260   tap_interface.hpp
261   types.hpp
262   api_types.hpp
263   vxlan_tunnel.hpp
264 )
265
266 add_definitions(-Wall -Werror -std=gnu++11)
267
268 add_vpp_library(vom
269   SOURCES ${VOM_SOURCES}
270
271   INSTALL_HEADERS ${VOM_HEADERS}
272
273   LINK_LIBRARIES ${VAPICLIENT_LIB} Threads::Threads boost_thread
274     ${BOOST_SYSTEM_LIB} ${BOOST_FILESYSTEM_LIB} ${BOOST_ASIO_LIB} m rt
275
276   COMPONENT libvom
277 )