From d4d7e8ad84cb24cee31f10d5bfedab715df65754 Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Mon, 3 Sep 2018 15:25:43 +0200 Subject: cmake: Move VOM to cmake Change-Id: I352dbb8e972e59a4caae4acd507153446470ce6b Signed-off-by: Mohsin Kazmi --- extras/vom/CMakeLists.txt | 35 +++++++ extras/vom/Makefile.am | 5 - extras/vom/configure.ac | 20 ---- extras/vom/vom/CMakeLists.txt | 239 ++++++++++++++++++++++++++++++++++++++++++ extras/vom/vom/Makefile.am | 238 ----------------------------------------- 5 files changed, 274 insertions(+), 263 deletions(-) create mode 100644 extras/vom/CMakeLists.txt delete mode 100644 extras/vom/Makefile.am delete mode 100644 extras/vom/configure.ac create mode 100644 extras/vom/vom/CMakeLists.txt delete mode 100644 extras/vom/vom/Makefile.am (limited to 'extras') diff --git a/extras/vom/CMakeLists.txt b/extras/vom/CMakeLists.txt new file mode 100644 index 00000000000..d3557104fd8 --- /dev/null +++ b/extras/vom/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright (c) 2018 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) + +project(vom) + +include(CheckCCompilerFlag) +include(CheckCXXCompilerFlag) + +if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") + set(VOM_LIB_DIR_NAME lib64) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)") + set(VOM_LIB_DIR_NAME lib64) +else() + set(VOM_LIB_DIR_NAME lib) +endif() + +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${VOM_LIB_DIR_NAME}) +set(CMAKE_INSTALL_MESSAGE NEVER) + +find_package(Threads REQUIRED) + +add_subdirectory(vom) diff --git a/extras/vom/Makefile.am b/extras/vom/Makefile.am deleted file mode 100644 index 51e8dab63de..00000000000 --- a/extras/vom/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ - - -AUTOMAKE_OPTIONS = foreign subdir-objects - -SUBDIRS = vom diff --git a/extras/vom/configure.ac b/extras/vom/configure.ac deleted file mode 100644 index 0e15095e117..00000000000 --- a/extras/vom/configure.ac +++ /dev/null @@ -1,20 +0,0 @@ -AC_INIT(vom, 18.07) -LT_INIT -AM_INIT_AUTOMAKE -AM_SILENT_RULES([yes]) -AC_PREFIX_DEFAULT([/usr]) - -PKG_CHECK_MODULES([CHECK], [check], [HAVE_CHECK=1], [HAVE_CHECK=0]) -AM_CONDITIONAL([USE_CHECK],[test "$HAVE_CHECK" -eq 1]) - -AC_PROG_CC -AC_PROG_CXX - -AM_CONDITIONAL(ENABLE_ACL_PLUGIN, test "yes" = "yes") -AM_CONDITIONAL(ENABLE_NAT_PLUGIN, test "yes" = "yes") -AM_CONDITIONAL(ENABLE_L2E_PLUGIN, test "yes" = "yes") -AM_CONDITIONAL(ENABLE_GBP_PLUGIN, test "yes" = "yes") - -AC_OUTPUT([Makefile vom/Makefile]) - -AC_CONFIG_MACRO_DIR([m4]) diff --git a/extras/vom/vom/CMakeLists.txt b/extras/vom/vom/CMakeLists.txt new file mode 100644 index 00000000000..c9ff7aa41ee --- /dev/null +++ b/extras/vom/vom/CMakeLists.txt @@ -0,0 +1,239 @@ +# Copyright (c) 2018 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +unset (VAPICLIENT_LIB) +unset (ACL_FILE) +unset (NAT_FILE) +unset (L2E_FILE) +unset (GBP_FILE) +unset (VOM_SOURCES) +unset (VOM_HEADERS) + +find_library(VAPICLIENT_LIB NAMES vapiclient REQUIRED HINTS ${VPP_LIB_DIR_HINT}) +find_path(VAPICLIENT_INCLUDE_DIR NAMES vapi/vapi.hpp HINTS ${VPP_INCLUDE_DIR_HINT}) + +if(NOT VAPICLIENT_INCLUDE_DIR OR NOT VAPICLIENT_LIB) + message(FATAL_ERROR "Cannot find vapiclient library and/or headers") +endif() + +include_directories(${VAPICLIENT_INCLUDE_DIR}) +include_directories(${CMAKE_SOURCE_DIR}) + +find_file(ACL_FILE NAMES acl.api.vapi.hpp PATH_SUFFIXES vapi HINTS ${VPP_INCLUDE_DIR_HINT}) +find_file(NAT_FILE NAMES nat.api.vapi.hpp PATH_SUFFIXES vapi HINTS ${VPP_INCLUDE_DIR_HINT}) +find_file(L2E_FILE NAMES l2e.api.vapi.hpp PATH_SUFFIXES vapi HINTS ${VPP_INCLUDE_DIR_HINT}) +find_file(GBP_FILE NAMES gbp.api.vapi.hpp PATH_SUFFIXES vapi HINTS ${VPP_INCLUDE_DIR_HINT}) + +if(ACL_FILE) + list(APPEND VOM_SOURCES + acl_binding_cmds.cpp + acl_binding.cpp + acl_ethertype_cmds.cpp + acl_ethertype.cpp + acl_l2_rule.cpp + acl_l3_rule.cpp + acl_list_cmds.cpp + acl_list.cpp + acl_types.cpp + ) +endif() + +if(NAT_FILE) + list(APPEND VOM_SOURCES + nat_static.cpp + nat_static_cmds.cpp + nat_binding.cpp + nat_binding_cmds.cpp + ) +endif() + +if (L2E_FILE) + list(APPEND VOM_SOURCES + l2_emulation_cmds.cpp + l2_emulation.cpp + ) +endif() + +if(GBP_FILE) + list(APPEND VOM_SOURCES + gbp_recirc_cmds.cpp + gbp_recirc.cpp + gbp_subnet_cmds.cpp + gbp_subnet.cpp + gbp_endpoint_cmds.cpp + gbp_endpoint.cpp + gbp_endpoint_group_cmds.cpp + gbp_endpoint_group.cpp + gbp_contract_cmds.cpp + gbp_contract.cpp + ) +endif() + +list(APPEND VOM_SOURCES + types.cpp + api_types.cpp + arp_proxy_binding_cmds.cpp + arp_proxy_binding.cpp + arp_proxy_config_cmds.cpp + arp_proxy_config.cpp + bond_group_binding_cmds.cpp + bond_group_binding.cpp + bond_interface_cmds.cpp + bond_interface.cpp + bond_member.cpp + bridge_domain_cmds.cpp + bridge_domain.cpp + bridge_domain_arp_entry.cpp + bridge_domain_arp_entry_cmds.cpp + bridge_domain_entry_cmds.cpp + bridge_domain_entry.cpp + client_db.cpp + cmd.cpp + connection.cpp + dhcp_client_cmds.cpp + dhcp_client.cpp + hw_cmds.cpp + hw.cpp + inspect.cpp + interface_cmds.cpp + interface.cpp + interface_factory.cpp + interface_ip6_nd_cmds.cpp + interface_span_cmds.cpp + interface_span.cpp + interface_types.cpp + ip_unnumbered_cmds.cpp + ip_unnumbered.cpp + l2_binding_cmds.cpp + l2_binding.cpp + l2_xconnect_cmds.cpp + l2_xconnect.cpp + l3_binding_cmds.cpp + l3_binding.cpp + lldp_binding_cmds.cpp + lldp_binding.cpp + lldp_global_cmds.cpp + lldp_global.cpp + logger.cpp + neighbour.cpp + neighbour_cmds.cpp + object_base.cpp + om.cpp + pipe.cpp + pipe_cmds.cpp + prefix.cpp + ra_config.cpp + ra_prefix.cpp + route.cpp + route_cmds.cpp + route_domain.cpp + route_domain_cmds.cpp + sub_interface_cmds.cpp + sub_interface.cpp + tap_interface.cpp + tap_interface_cmds.cpp + vxlan_tunnel_cmds.cpp + vxlan_tunnel.cpp +) + +if(ACL_FILE) + list(APPEND VOM_HEADERS + acl_binding.hpp + acl_ethertype.hpp + acl_l2_rule.hpp + acl_l3_rule.hpp + acl_list.hpp + acl_types.hpp + ) +endif() + +if(NAT_FILE) + list(APPEND VOM_HEADERS + nat_static.hpp + nat_binding.hpp + ) +endif() + +if(L2E_FILE) + list(APPEND VOM_HEADERS + l2_emulation.hpp + ) +endif() + +if(GBP_FILE) + list(APPEND VOM_HEADERS + gbp_endpoint.hpp + gbp_endpoint_group.hpp + gbp_subnet.hpp + gbp_recirc.hpp + gbp_contract.hpp + ) +endif() + +list(APPEND VOM_HEADERS + arp_proxy_binding.hpp + arp_proxy_config.hpp + bond_group_binding.hpp + bond_interface.hpp + bond_member.hpp + bridge_domain.hpp + bridge_domain_arp_entry.hpp + bridge_domain_entry.hpp + client_db.hpp + cmd.hpp + connection.hpp + dhcp_client.hpp + dump_cmd.hpp + enum_base.hpp + event_cmd.hpp + hw.hpp + inspect.hpp + interface.hpp + interface_cmds.hpp + interface_ip6_nd.hpp + interface_span.hpp + ip_unnumbered.hpp + l2_binding.hpp + l2_xconnect.hpp + l3_binding.hpp + lldp_binding.hpp + lldp_global.hpp + logger.hpp + neighbour.hpp + object_base.hpp + om.hpp + pipe.hpp + prefix.hpp + ra_config.hpp + ra_prefix.hpp + route.hpp + route_domain.hpp + rpc_cmd.hpp + singular_db.hpp + singular_db_funcs.hpp + sub_interface.hpp + tap_interface.hpp + types.hpp + api_types.hpp + vxlan_tunnel.hpp +) + +add_library(vom SHARED ${VOM_SOURCES}) +target_link_libraries(vom ${VAPICLIENT_LIB} Threads::Threads boost_thread + ${BOOST_SYSTEM_LIB} ${BOOST_FILESYSTEM_LIB} ${BOOST_ASIO_LIB} m rt) +add_definitions(-Wall -Werror -std=gnu++11) +install(TARGETS vom DESTINATION ${VOM_LIB_DIR_NAME}) + +foreach(file ${VOM_HEADERS}) + install(FILES ${file} DESTINATION include/vom) +endforeach() diff --git a/extras/vom/vom/Makefile.am b/extras/vom/vom/Makefile.am deleted file mode 100644 index 797bef0f611..00000000000 --- a/extras/vom/vom/Makefile.am +++ /dev/null @@ -1,238 +0,0 @@ -# Copyright (c) 2017 Cisco and/or its affiliates. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -AUTOMAKE_OPTIONS = foreign -ACLOCAL_AMFLAGS = -I m4 -AM_LIBTOOLFLAGS = --quiet - -AM_CXXFLAGS = -Wall -Werror -std=gnu++11 -I${top_srcdir} - -bin_PROGRAMS = -noinst_LTLIBRARIES = -CLEANDIRS = - -lib_LTLIBRARIES = libvom.la - -libvom_la_DEPENDENCIES = -libvom_la_LIBADD = \ - -lvapiclient \ - -lpthread \ - -lboost_thread \ - $(BOOST_SYSTEM_LIB) \ - $(BOOST_FILESYSTEM_LIB) \ - $(BOOST_ASIO_LIB) \ - -lm -lrt - -ACL_SOURCES = -if ENABLE_ACL_PLUGIN -ACL_SOURCES += \ - acl_binding_cmds.cpp \ - acl_binding.cpp \ - acl_ethertype_cmds.cpp \ - acl_ethertype.cpp \ - acl_l2_rule.cpp \ - acl_l3_rule.cpp \ - acl_list_cmds.cpp \ - acl_list.cpp \ - acl_types.cpp -endif - -NAT_SOURCES = -if ENABLE_NAT_PLUGIN -NAT_SOURCES += \ - nat_static.cpp \ - nat_static_cmds.cpp \ - nat_binding.cpp \ - nat_binding_cmds.cpp -endif - -L2E_SOURCES = -if ENABLE_L2E_PLUGIN -L2E_SOURCES += \ - l2_emulation_cmds.cpp \ - l2_emulation.cpp -endif - -GBP_SOURCES = -if ENABLE_GBP_PLUGIN -GBP_SOURCES += \ - gbp_recirc_cmds.cpp \ - gbp_recirc.cpp \ - gbp_subnet_cmds.cpp \ - gbp_subnet.cpp \ - gbp_endpoint_cmds.cpp \ - gbp_endpoint.cpp \ - gbp_endpoint_group_cmds.cpp \ - gbp_endpoint_group.cpp \ - gbp_contract_cmds.cpp \ - gbp_contract.cpp -endif - -libvom_la_SOURCES = \ - types.cpp \ - api_types.cpp \ - arp_proxy_binding_cmds.cpp \ - arp_proxy_binding.cpp \ - arp_proxy_config_cmds.cpp \ - arp_proxy_config.cpp \ - bond_group_binding_cmds.cpp \ - bond_group_binding.cpp \ - bond_interface_cmds.cpp \ - bond_interface.cpp \ - bond_member.cpp \ - bridge_domain_cmds.cpp \ - bridge_domain.cpp \ - bridge_domain_arp_entry.cpp \ - bridge_domain_arp_entry_cmds.cpp \ - bridge_domain_entry_cmds.cpp \ - bridge_domain_entry.cpp \ - client_db.cpp \ - cmd.cpp \ - connection.cpp \ - dhcp_client_cmds.cpp \ - dhcp_client.cpp \ - hw_cmds.cpp \ - hw.cpp \ - inspect.cpp \ - interface_cmds.cpp \ - interface.cpp \ - interface_factory.cpp \ - interface_ip6_nd_cmds.cpp \ - interface_span_cmds.cpp \ - interface_span.cpp \ - interface_types.cpp \ - ip_unnumbered_cmds.cpp \ - ip_unnumbered.cpp \ - l2_binding_cmds.cpp \ - l2_binding.cpp \ - l2_xconnect_cmds.cpp \ - l2_xconnect.cpp \ - l3_binding_cmds.cpp \ - l3_binding.cpp \ - lldp_binding_cmds.cpp \ - lldp_binding.cpp \ - lldp_global_cmds.cpp \ - lldp_global.cpp \ - logger.cpp \ - neighbour.cpp \ - neighbour_cmds.cpp \ - object_base.cpp \ - om.cpp \ - pipe.cpp \ - pipe_cmds.cpp \ - prefix.cpp \ - ra_config.cpp \ - ra_prefix.cpp \ - route.cpp \ - route_cmds.cpp \ - route_domain.cpp \ - route_domain_cmds.cpp \ - sub_interface_cmds.cpp \ - sub_interface.cpp \ - tap_interface.cpp \ - tap_interface_cmds.cpp \ - vxlan_tunnel_cmds.cpp \ - vxlan_tunnel.cpp \ - $(ACL_SOURCES) \ - $(NAT_SOURCES) \ - $(L2E_SOURCES) \ - $(GBP_SOURCES) - - -vomincludedir = $(includedir)/vom - -ACL_INCLUDES = -if ENABLE_ACL_PLUGIN -ACL_INCLUDES += \ - acl_binding.hpp \ - acl_ethertype.hpp \ - acl_l2_rule.hpp \ - acl_l3_rule.hpp \ - acl_list.hpp \ - acl_types.hpp -endif - -NAT_INCLUDES = -if ENABLE_NAT_PLUGIN -NAT_INCLUDES += \ - nat_static.hpp \ - nat_binding.hpp -endif - -L2E_INCLUDES = -if ENABLE_L2E_PLUGIN -L2E_INCLUDES += \ - l2_emulation.hpp -endif - -GBP_INCLUDES = -if ENABLE_GBP_PLUGIN -GBP_INCLUDES += \ - gbp_endpoint.hpp \ - gbp_endpoint_group.hpp \ - gbp_subnet.hpp \ - gbp_recirc.hpp \ - gbp_contract.hpp -endif - -vominclude_HEADERS = \ - arp_proxy_binding.hpp \ - arp_proxy_config.hpp \ - bond_group_binding.hpp \ - bond_interface.hpp \ - bond_member.hpp \ - bridge_domain.hpp \ - bridge_domain_arp_entry.hpp \ - bridge_domain_entry.hpp \ - client_db.hpp \ - cmd.hpp \ - connection.hpp \ - dhcp_client.hpp \ - dump_cmd.hpp \ - enum_base.hpp \ - event_cmd.hpp \ - hw.hpp \ - inspect.hpp \ - interface.hpp \ - interface_cmds.hpp \ - interface_ip6_nd.hpp \ - interface_span.hpp \ - ip_unnumbered.hpp \ - l2_binding.hpp \ - l2_xconnect.hpp \ - l3_binding.hpp \ - lldp_binding.hpp \ - lldp_global.hpp \ - logger.hpp \ - neighbour.hpp \ - object_base.hpp \ - om.hpp \ - pipe.hpp \ - prefix.hpp \ - ra_config.hpp \ - ra_prefix.hpp \ - route.hpp \ - route_domain.hpp \ - rpc_cmd.hpp \ - singular_db.hpp \ - singular_db_funcs.hpp \ - sub_interface.hpp \ - tap_interface.hpp \ - types.hpp \ - vxlan_tunnel.hpp \ - $(ACL_INCLUDES) \ - $(NAT_INCLUDES) \ - $(L2E_INCLUDES) \ - $(GBP_INCLUDES) - -# vi:syntax=automake -- cgit 1.2.3-korg