aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl
diff options
context:
space:
mode:
authormashemat <mhemmatp@cisco.com>2019-11-13 11:48:09 +0100
committerMasoud Hemmatpour <mhemmatp@cisco.com>2019-11-14 09:10:05 +0000
commitcd09afb42f41f8bb6cc9db3d13b3f353fa69d94f (patch)
treefe81d6c08c4e5364fa7c2533ce9f13a2e518fd33 /ctrl
parent4f57ca72e8131e5cfb023b26417b924e774d5e73 (diff)
[HICN-375] Move cmake in ctrl/sysrepo-plugins to the main cmke in root
Signed-off-by: mashemat <mhemmatp@cisco.com> Change-Id: I6c2f65e61a2f13db8261a32482336b21f07d5e45
Diffstat (limited to 'ctrl')
-rw-r--r--ctrl/sysrepo-plugins/CMakeLists.txt6
-rw-r--r--ctrl/sysrepo-plugins/cmake/FindHicnLight.cmake39
-rw-r--r--ctrl/sysrepo-plugins/cmake/FindHicnPlugin.cmake39
-rw-r--r--ctrl/sysrepo-plugins/cmake/FindSysrepo.cmake46
-rw-r--r--ctrl/sysrepo-plugins/cmake/FindVPP.cmake178
-rw-r--r--ctrl/sysrepo-plugins/cmake/Modules/Packaging.cmake (renamed from ctrl/sysrepo-plugins/cmake/Packaging.cmake)0
-rw-r--r--ctrl/sysrepo-plugins/cmake/Packager.cmake149
-rw-r--r--ctrl/sysrepo-plugins/hicn-light/CMakeLists.txt4
-rw-r--r--ctrl/sysrepo-plugins/hicn-plugin/CMakeLists.txt6
9 files changed, 10 insertions, 457 deletions
diff --git a/ctrl/sysrepo-plugins/CMakeLists.txt b/ctrl/sysrepo-plugins/CMakeLists.txt
index cd7c0a16c..93434b9c6 100644
--- a/ctrl/sysrepo-plugins/CMakeLists.txt
+++ b/ctrl/sysrepo-plugins/CMakeLists.txt
@@ -18,7 +18,9 @@ project(hicn_sysrepo_plugin)
include(GNUInstallDirs)
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
+"${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Modules"
+)
# set default build type if not specified by user
if(NOT CMAKE_BUILD_TYPE)
@@ -40,5 +42,3 @@ if (BUILD_HICNLIGHT AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
add_subdirectory(hicn-light)
endif ()
include(Packaging)
-include(Packager)
-make_packages()
diff --git a/ctrl/sysrepo-plugins/cmake/FindHicnLight.cmake b/ctrl/sysrepo-plugins/cmake/FindHicnLight.cmake
deleted file mode 100644
index 7883b09dd..000000000
--- a/ctrl/sysrepo-plugins/cmake/FindHicnLight.cmake
+++ /dev/null
@@ -1,39 +0,0 @@
-#sed 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.
-
-set(HICNLIGHT_SEARCH_PATH_LIST
- ${HICNLIGHT_HOME}
- $ENV{HICNLIGHT_HOME}
- /usr/local
- /opt
- /usr
-)
-
-find_path(HICNLIGHT_INCLUDE_DIR hicn/ctrl/api.h
- HINTS ${HICNLIGHT_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- DOC "Find the hicn plugin includes"
-)
-
-find_library(HICNLIGHT_LIBRARY NAMES libhicnctrl.so
- HINTS ${HICNLIGHT_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib/x86_64-linux-gnu/
- DOC "Find the hicn light lib"
-)
-
-set(HICNLIGHT_LIBRARIES ${HICNLIGHT_LIBRARY})
-set(HICNLIGHT_INCLUDE_DIRS ${HICNLIGHT_INCLUDE_DIR})
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Hicnlight HICNLIGHT_LIBRARIES HICNLIGHT_INCLUDE_DIRS)
-
-mark_as_advanced(HICNLIGHT_LIBRARY HICNLIGHT_INCLUDE_DIR)
diff --git a/ctrl/sysrepo-plugins/cmake/FindHicnPlugin.cmake b/ctrl/sysrepo-plugins/cmake/FindHicnPlugin.cmake
deleted file mode 100644
index f50ed736e..000000000
--- a/ctrl/sysrepo-plugins/cmake/FindHicnPlugin.cmake
+++ /dev/null
@@ -1,39 +0,0 @@
-#sed 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.
-
-set(HICNPLUGIN_SEARCH_PATH_LIST
- ${HICNPLUGIN_HOME}
- $ENV{HICNPLUGIN_HOME}
- /usr/local
- /opt
- /usr
-)
-
-find_path(HICNPLUGIN_INCLUDE_DIR vapi/hicn.api.vapi.h
- HINTS ${HICNPLUGIN_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- DOC "Find the hicn plugin includes"
-)
-
-find_library(HICNPLUGIN_LIBRARY NAMES vpp_plugins/hicn_plugin.so
- HINTS ${HICNPLUGIN_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib
- DOC "Find the hicn plugin plugin"
-)
-
-set(HICNPLUGIN_LIBRARIES ${HICNPLUGIN_LIBRARY})
-set(HICNPLUGIN_INCLUDE_DIRS ${HICNPLUGIN_INCLUDE_DIR})
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(HicnPlugin DEFAULT_MSG HICNPLUGIN_LIBRARIES HICNPLUGIN_INCLUDE_DIRS)
-
-mark_as_advanced(HICNPLUGIN_LIBRARY HICNPLUGIN_INCLUDE_DIR) \ No newline at end of file
diff --git a/ctrl/sysrepo-plugins/cmake/FindSysrepo.cmake b/ctrl/sysrepo-plugins/cmake/FindSysrepo.cmake
deleted file mode 100644
index 4228ef93a..000000000
--- a/ctrl/sysrepo-plugins/cmake/FindSysrepo.cmake
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (c) 2019 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.
-
-set(SYSREPO_SEARCH_PATH_LIST
- ${SYSREPO_HOME}
- $ENV{SYSREPO_HOME}
- /usr/local
- /opt
- /usr
-)
-
-find_path(SYSREPO_INCLUDE_DIR sysrepo/values.h
- HINTS ${SYSREPO_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- DOC "Find the sysrepo includes"
-)
-
-find_path(SYSREPO_INCLUDE_MAIN_DIR sysrepo.h
- HINTS ${SYSREPO_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- DOC "Find the sysrepo includes"
-)
-
-find_library(SYSREPO_LIBRARY NAMES libsysrepo.so
- HINTS ${SYSREPO_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib
- DOC "Find the sysrepo library"
-)
-
-set(SYSREPO_LIBRARIES ${SYSREPO_LIBRARY})
-set(SYSREPO_INCLUDE_DIRS ${SYSREPO_INCLUDE_DIR} ${SYSREPO_INCLUDE_MAIN_DIR})
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Sysrepo DEFAULT_MSG SYSREPO_LIBRARIES SYSREPO_INCLUDE_DIRS)
-
-mark_as_advanced(SYSREPO_LIBRARY SYSREPO_INCLUDE_DIR SYSREPO_INCLUDE_MAIN_DIR) \ No newline at end of file
diff --git a/ctrl/sysrepo-plugins/cmake/FindVPP.cmake b/ctrl/sysrepo-plugins/cmake/FindVPP.cmake
deleted file mode 100644
index 62abc29da..000000000
--- a/ctrl/sysrepo-plugins/cmake/FindVPP.cmake
+++ /dev/null
@@ -1,178 +0,0 @@
-# Copyright (c) 2019 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.
-
-#if (VPP_LIBRARIES AND VPP_INCLUDE_DIRS)
- # in cache already
-# set(VPP_FOUND TRUE)
-#else (VPP_LIBRARIES AND VPP_INCLUDE_DIRS)
-
-set(VPP_SEARCH_PATH_LIST
-# ${VPP_HOME}
-# $ENV{VPP_HOME}
- /usr/lib
- /usr/lib64
- /usr/local/lib
- /usr/local/lib64
- /opt/local/lib
- /sw/lib
- /usr/local
- /opt
- /usr)
-
-# set(VPP_INCLUDE_PATH
-# /usr/include
-# /usr/local/include
-# /opt/local/include
-# /sw/include
-# )
-
-# set(VPP_LIBRARY_PATH
-# /usr/lib
-# /usr/lib64
-# /usr/local/lib
-# /usr/local/lib64
-# /opt/local/lib
-# /sw/lib
-# )
-
- find_path(VNET_INCLUDE_DIR
- NAMES
- vnet/vnet.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_path(VLIB_API_INCLUDE_DIR
- NAMES
- vlibapi/api.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_path(VLIBMEMORY_INCLUDE_DIR
- NAMES
- vlibmemory/api.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_path(VPP_MSG_INCLUDE_DIR
- NAMES
- vpp/api/vpe_msg_enum.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_path(VPP_ALL_INCLUDE_DIR
- NAMES
- vpp/api/vpe_all_api_h.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_path(VAPI_INCLUDE_DIR
- NAMES
- vapi/interface.api.vapi.h
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES include
- )
-
- find_library(VLIBMEMORYCLIENT_LIBRARY
- NAMES
- vlibmemoryclient
- libvlibmemoryclient
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- find_library(SVM_LIBRARY
- NAMES
- svm
- libsvm
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- find_library(VPPINFRA_LIBRARY
- NAMES
- vppinfra
- libvppinfra
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- find_library(VLIB_LIBRARY
- NAMES
- vlib
- libvlib
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- find_library(VATPLUGIN_LIBRARY
- NAMES
- vatplugin
- libvatplugin
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- find_library(VAPI_LIBRARY
- NAMES
- vapiclient
- libvapiclient
- HINTS
- ${VPP_SEARCH_PATH_LIST}
- PATH_SUFFIXES lib lib64
- )
-
- if (VPP_INCLUDE_DIR AND VPP_LIBRARY)
- set(VPP_FOUND TRUE)
- else (VPP_INCLUDE_DIR AND VPP_LIBRARY)
- set(VPP_FOUND FALSE)
- endif (VPP_INCLUDE_DIR AND VPP_LIBRARY)
-
- set(VPP_INCLUDE_DIRS
- ${VNET_INCLUDE_DIR}
- ${VLIB_API_INCLUDE_DIR}
- ${VLIB_MEMORY_INCLUDE_DIR}
- ${VPP_MSG_INCLUDE_DIR}
- ${VPP_ALL_INCLUDE_DIR}
- ${VAPI_INCLUDE_DIR}
- )
-
-message(${VAPI_LIBRARY})
- set(VPP_LIBRARIES
- ${VLIBMEMORYCLIENT_LIBRARY}
- ${SVM_LIBRARY}
- ${VPPINFRA_LIBRARY}
- ${VLIB_LIBRARY}
- ${VATPLUGIN_LIBRARY}
- ${VAPI_LIBRARY}
- )
-
- # show the VPP_INCLUDE_DIRS and VPP_LIBRARIES variables only in the advanced view
- mark_as_advanced(VPP_INCLUDE_DIRS VPP_LIBRARIES)
-
-#endif (VPP_LIBRARIES AND VPP_INCLUDE_DIRS)
diff --git a/ctrl/sysrepo-plugins/cmake/Packaging.cmake b/ctrl/sysrepo-plugins/cmake/Modules/Packaging.cmake
index f5e8426fb..f5e8426fb 100644
--- a/ctrl/sysrepo-plugins/cmake/Packaging.cmake
+++ b/ctrl/sysrepo-plugins/cmake/Modules/Packaging.cmake
diff --git a/ctrl/sysrepo-plugins/cmake/Packager.cmake b/ctrl/sysrepo-plugins/cmake/Packager.cmake
deleted file mode 100644
index b19145025..000000000
--- a/ctrl/sysrepo-plugins/cmake/Packager.cmake
+++ /dev/null
@@ -1,149 +0,0 @@
-# Copyright (c) 2017-2019 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.
-
-#############
-# RPM/DEB/TGZ Packaging utils
-#
-
-set(CONTACT "hicn-dev@lists.fd.io" CACHE STRING "Contact")
-set(PACKAGE_MAINTAINER "ICN Team" CACHE STRING "Maintainer")
-set(PACKAGE_VENDOR "fd.io" CACHE STRING "Vendor")
-
-# macro(set)
-
-macro(make_packages)
- if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
- # parse /etc/os-release
- file(READ "/etc/os-release" os_version)
- string(REPLACE "\n" ";" os_version ${os_version})
- foreach(_ver ${os_version})
- string(REPLACE "=" ";" _ver ${_ver})
- list(GET _ver 0 _name)
- list(GET _ver 1 _value)
- set(OS_${_name} ${_value})
- endforeach()
-
- # extract version from git
- execute_process(
- COMMAND git describe --long --match v*
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
- OUTPUT_VARIABLE VER
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- if (NOT VER)
- set(VER "v1.0-1-gcafe")
- endif()
-
- string(REGEX REPLACE "v(.*)-([0-9]+)-(g[0-9a-f]+)" "\\1;\\2;\\3" VER ${VER})
- list(GET VER 0 tag)
- string(REPLACE "-" "~" tag ${tag})
- list(GET VER 1 commit_num)
- list(GET VER 2 commit_name)
-
- if (NOT DEFINED ENV{BUILD_NUMBER})
- set(bld "b1")
- else()
- set(bld "b$ENV{BUILD_NUMBER}")
- endif()
-
- message("Build number is: ${bld}")
-
- #define DEB and RPM version numbers
- if(${commit_num} EQUAL 0)
- set(deb_ver "${tag}")
- set(rpm_ver "${tag}")
- else()
- set(deb_ver "${tag}-${commit_num}-release")
- set(rpm_ver "${tag}-${commit_num}-release")
- endif()
-
- get_cmake_property(components COMPONENTS)
-
- if(OS_ID_LIKE MATCHES "debian")
- set(CPACK_GENERATOR "DEB")
- set(type "DEBIAN")
-
- execute_process(
- COMMAND dpkg --print-architecture
- OUTPUT_VARIABLE arch
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- set(CPACK_PACKAGE_VERSION "${deb_ver}")
- foreach(lc ${components})
- if (${lc} MATCHES ".*Unspecified.*")
- continue()
- endif()
-
- string(TOUPPER ${lc} uc)
- set(CPACK_${type}_${uc}_FILE_NAME "${lc}_${deb_ver}_${arch}.deb")
-
- set(DEB_DEPS)
- if (NOT ${${lc}_DEB_DEPENDENCIES} STREQUAL "")
- string(REPLACE "stable_version" ${tag} DEB_DEPS ${${lc}_DEB_DEPENDENCIES})
- endif()
-
- set(CPACK_${type}_${uc}_PACKAGE_DEPENDS "${DEB_DEPS}")
- set(CPACK_${type}_${uc}_PACKAGE_NAME "${lc}")
- set(CPACK_COMPONENT_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
- endforeach()
- elseif(OS_ID_LIKE MATCHES "rhel")
- set(CPACK_GENERATOR "RPM")
- set(type "RPM")
-
- execute_process(
- COMMAND uname -m
- OUTPUT_VARIABLE arch
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- set(CPACK_PACKAGE_VERSION "${rpm_ver}")
- foreach(lc ${components})
- if (${lc} MATCHES ".*Unspecified.*")
- continue()
- endif()
-
- string(TOUPPER ${lc} uc)
- set(CPACK_${type}_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
-
- set(RPM_DEPS)
- if (NOT ${${lc}_DEB_DEPENDENCIES} STREQUAL "")
- string(REPLACE "stable_version" ${tag} RPM_DEPS ${${lc}_RPM_DEPENDENCIES})
- endif()
-
- set(CPACK_${type}_${uc}_PACKAGE_REQUIRES "${RPM_DEPS}")
-
- if(${lc} MATCHES ".*-dev")
- set(package_name ${lc}el)
- else()
- set(package_name ${lc})
- endif()
-
- set(CPACK_RPM_${uc}_PACKAGE_NAME "${package_name}")
- set(CPACK_${type}_${uc}_FILE_NAME "${package_name}-${rpm_ver}.${arch}.rpm")
- endforeach()
- endif()
-
- if(CPACK_GENERATOR)
- set(CPACK_PACKAGE_NAME ${ARG_NAME})
- set(CPACK_STRIP_FILES OFF)
- set(CPACK_PACKAGE_VENDOR "${PACKAGE_VENDOR}")
- set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
- set(CPACK_${CPACK_GENERATOR}_COMPONENT_INSTALL ON)
- set(CPACK_${type}_PACKAGE_MAINTAINER "HICN Team")
- set(CPACK_${type}_PACKAGE_RELEASE 1)
- include(CPack)
- endif()
- endif()
-endmacro()
diff --git a/ctrl/sysrepo-plugins/hicn-light/CMakeLists.txt b/ctrl/sysrepo-plugins/hicn-light/CMakeLists.txt
index eea06592d..3739663b5 100644
--- a/ctrl/sysrepo-plugins/hicn-light/CMakeLists.txt
+++ b/ctrl/sysrepo-plugins/hicn-light/CMakeLists.txt
@@ -24,7 +24,9 @@ cmake_minimum_required(VERSION 2.8)
project(sysrepo-light-plugins)
# Cmake find modules
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake")
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake/Modules"
+"${CMAKE_CURRENT_LIST_DIR}/../../../cmake/Modules"
+)
find_package(PkgConfig)
find_package(HicnLight)
diff --git a/ctrl/sysrepo-plugins/hicn-plugin/CMakeLists.txt b/ctrl/sysrepo-plugins/hicn-plugin/CMakeLists.txt
index 4c3ef6d1a..37590ee4c 100644
--- a/ctrl/sysrepo-plugins/hicn-plugin/CMakeLists.txt
+++ b/ctrl/sysrepo-plugins/hicn-plugin/CMakeLists.txt
@@ -22,7 +22,9 @@ cmake_minimum_required(VERSION 2.8)
project(sysrepo-vpp-plugins)
# Cmake find modules
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake")
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake/Modules"
+"${CMAKE_CURRENT_LIST_DIR}/../../../cmake/Modules"
+)
find_package(VPP)
find_package(PkgConfig)
@@ -54,7 +56,7 @@ set(PLUGINS_SOURCES
# build the source code into shared library
add_library(hicn SHARED ${PLUGINS_SOURCES})
target_include_directories(hicn PUBLIC ${VPP_INCLUDE_DIRS} ${HICNPLUGIN_INCLUDE_DIRS})
-target_link_libraries(hicn ${SYSREPO_LIBRARIES} ${VPP_LIBRARIES} ${HICNPLUGIN_LIBRARIES})
+target_link_libraries(hicn ${SYSREPO_LIBRARIES} ${VPP_LIBRARIES})
#set_target_properties(hicn
# PROPERTIES