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