aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Muscariello <lumuscar+fdio@cisco.com>2019-01-22 17:50:52 +0000
committerGerrit Code Review <gerrit@fd.io>2019-01-22 17:50:52 +0000
commitbed18df840364847e378d1ce2dea2fbace029720 (patch)
treed0cd5b86ba9c159f9e8a32331a82e121bafdb4c5
parent471bcdc47dce89394a724e96f7c4bd6f242b6a31 (diff)
parent211b6a8bc6d959a874a43f28d4cda43eae48200d (diff)
Merge "[HICN-3] First version of packaging system based on cmake."
-rwxr-xr-xCMakeLists.txt11
-rwxr-xr-xcmake/Modules/BuildMacros.cmake15
-rwxr-xr-xcmake/Modules/Packager.cmake32
-rwxr-xr-xhicn-light/CMakeLists.txt3
-rw-r--r--hicn-light/cmake/Modules/Packaging.cmake31
-rwxr-xr-xhicn-light/src/CMakeLists.txt2
-rwxr-xr-xhicn-plugin/CMakeLists.txt32
-rw-r--r--hicn-plugin/cmake/Modules/Packaging.cmake31
-rwxr-xr-xlib/CMakeLists.txt4
-rw-r--r--lib/cmake/Modules/Packaging.cmake41
-rwxr-xr-xlib/src/CMakeLists.txt2
-rwxr-xr-xlibtransport/CMakeLists.txt14
-rwxr-xr-xlibtransport/cmake/Modules/Packager.cmake197
-rwxr-xr-xlibtransport/cmake/Modules/Packaging.cmake80
-rwxr-xr-xlibtransport/src/hicn/transport/CMakeLists.txt8
-rw-r--r--scripts/build-packages.sh14
-rw-r--r--scripts/checkstyle.sh14
-rwxr-xr-xutils/CMakeLists.txt9
-rw-r--r--utils/cmake/Modules/Packaging.cmake28
19 files changed, 321 insertions, 247 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c47f8e640..a362a4005 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,8 +27,10 @@ set(LIBHICN_SHARED hicn.shared)
set(LIBHICN_LIGHT hicn-light)
set(HICN_LIGHT_CONTROL hicnLightControl)
set(HICN_LIGHT_DAEMON hicnLightDaemon)
-set(LIBTRANSPORT transport)
-set(LIBTRANSPORT_SHARED transport.shared)
+set(HICN_PLUGIN hicn-plugin)
+set(LIBTRANSPORT hicntransport)
+set(LIBTRANSPORT_SHARED hicntransport.shared)
+set(HICN_UTILS hicn-utils)
## HEADER FILES
set(LIBHICN_HEADER_FILES)
@@ -48,4 +50,7 @@ endif()
foreach(dir ${SUBDIRS})
add_subdirectory(${dir})
-endforeach() \ No newline at end of file
+endforeach()
+
+include(Packager)
+make_packages() \ No newline at end of file
diff --git a/cmake/Modules/BuildMacros.cmake b/cmake/Modules/BuildMacros.cmake
index 276659525..a1977f980 100755
--- a/cmake/Modules/BuildMacros.cmake
+++ b/cmake/Modules/BuildMacros.cmake
@@ -54,7 +54,7 @@ endmacro()
macro(build_library lib)
cmake_parse_arguments(ARG
"SHARED;STATIC"
- "COMPONENT"
+ "COMPONENT;"
"SOURCES;LINK_LIBRARIES;INSTALL_HEADERS;DEPENDS;INCLUDE_DIRS;DEFINITIONS;INSTALL_ROOT_DIR"
${ARGN}
)
@@ -76,6 +76,11 @@ macro(build_library lib)
add_library(${lib} STATIC ${ARG_SOURCES})
endif()
+ # install .so
+ if(NOT ARG_COMPONENT)
+ set(ARG_COMPONENT hicn)
+ endif()
+
foreach(library ${TARGET_LIBS})
target_compile_options(${library} PRIVATE -Wall)
@@ -107,10 +112,6 @@ macro(build_library lib)
)
endif()
- # install .so
- if(NOT ARG_COMPONENT)
- set(ARG_COMPONENT hicn)
- endif()
install(
TARGETS ${library}
DESTINATION lib
@@ -129,6 +130,10 @@ macro(build_library lib)
set(ARG_INSTALL_ROOT_DIR "hicn")
endif()
+ list(APPEND local_comps
+ ${ARG_COMPONENT}-dev
+ )
+
foreach(file ${ARG_INSTALL_HEADERS})
get_filename_component(_dir ${file} DIRECTORY)
get_filename_component(dir ${_dir} NAME)
diff --git a/cmake/Modules/Packager.cmake b/cmake/Modules/Packager.cmake
index 58530fa72..f060bfa4b 100755
--- a/cmake/Modules/Packager.cmake
+++ b/cmake/Modules/Packager.cmake
@@ -19,15 +19,10 @@ 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(add_package name)
- cmake_parse_arguments(ARG
- ""
- "NAME;DESCRIPION;DEPENDENCIES"
- ""
- ${ARGN}
- )
+# macro(set)
- if (0)
+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})
@@ -41,6 +36,7 @@ macro(add_package name)
# extract version from git
execute_process(
COMMAND git describe --long --match v*
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE VER
OUTPUT_STRIP_TRAILING_WHITESPACE
)
@@ -70,34 +66,38 @@ macro(add_package name)
set(CPACK_GENERATOR "DEB")
set(type "DEBIAN")
set(CPACK_PACKAGE_VERSION "${deb_ver}")
- set(CPACK_DEBIAN_PACKAGE_MAINTAINER "VPP Team")
- set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
+ set(CPACK_${type}_FILE_NAME DEB-DEFAULT)
foreach(lc ${components})
string(TOUPPER ${lc} uc)
- set(CPACK_DEBIAN_${uc}_PACKAGE_NAME "${lc}")
+ set(CPACK_${type}_${uc}_PACKAGE_DEPENDS "${${lc}_DEB_DEPENDENCIES}")
+ 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")
set(CPACK_PACKAGE_VERSION "${rpm_ver}")
- set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
+ set(CPACK_${type}_FILE_NAME RPM-DEFAULT)
foreach(lc ${components})
string(TOUPPER ${lc} uc)
if(${lc} MATCHES ".*-dev")
- set(CPACK_RPM_${uc}_DEBUGINFO_PACKAGE ON)
+ set(CPACK_${type}_${uc}_DEBUGINFO_PACKAGE ON)
set(lc ${lc}el)
endif()
- set(CPACK_RPM_${uc}_PACKAGE_NAME "${lc}")
+
+ set(CPACK_${type}_${uc}_PACKAGE_NAME "${lc}")
+ set(CPACK_${type}_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
+ set(CPACK_${type}_${uc}_PACKAGE_REQUIRES "${${lc}_RPM_DEPENDENCIES}")
endforeach()
endif()
if(CPACK_GENERATOR)
set(CPACK_PACKAGE_NAME ${ARG_NAME})
set(CPACK_STRIP_FILES OFF)
- set(CPACK_PACKAGE_VENDOR "${ARG_VENDOR}")
+ set(CPACK_PACKAGE_VENDOR "${PACKAGE_VENDOR}")
set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
set(CPACK_${CPACK_GENERATOR}_COMPONENT_INSTALL ON)
- set(CPACK_${type}_PACKAGE_DESCRIPTION "${ARG_DESCRIPTION}")
+ set(CPACK_${type}_PACKAGE_MAINTAINER "HICN Team")
set(CPACK_${type}_PACKAGE_RELEASE 1)
include(CPack)
endif()
diff --git a/hicn-light/CMakeLists.txt b/hicn-light/CMakeLists.txt
index ca290aee8..1a5a7f9e2 100755
--- a/hicn-light/CMakeLists.txt
+++ b/hicn-light/CMakeLists.txt
@@ -10,6 +10,7 @@ endif()
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules"
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
)
set(CMAKE_C_STANDARD 11)
@@ -43,6 +44,8 @@ else()
)
endif()
+include( Packaging )
+
find_package(Threads REQUIRED)
set(HICN_LIGHT_LINK_LIBRARIES
diff --git a/hicn-light/cmake/Modules/Packaging.cmake b/hicn-light/cmake/Modules/Packaging.cmake
new file mode 100644
index 000000000..386c9e985
--- /dev/null
+++ b/hicn-light/cmake/Modules/Packaging.cmake
@@ -0,0 +1,31 @@
+# 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.
+
+######################
+# Packages section
+######################
+
+set(${LIBHICN_LIGHT}_DESCRIPTION
+ "hicn-light is a socket based forwarder"
+ CACHE STRING "Description for deb/rpm package."
+)
+
+set(${LIBHICN_LIGHT}_DEB_DEPENDENCIES
+ "libhicn (>= 1.0), libparc (>= 1.0)"
+ CACHE STRING "Dependencies for deb/rpm package."
+)
+
+set(${LIBHICN_LIGHT}_RPM_DEPENDENCIES
+ "libhicn >= 1.0, libparc >= 1.0"
+ CACHE STRING "Dependencies for deb/rpm package."
+) \ No newline at end of file
diff --git a/hicn-light/src/CMakeLists.txt b/hicn-light/src/CMakeLists.txt
index 939f38a34..1951d00f7 100755
--- a/hicn-light/src/CMakeLists.txt
+++ b/hicn-light/src/CMakeLists.txt
@@ -38,7 +38,7 @@ build_library(${LIBHICN_LIGHT}
INSTALL_HEADERS ${TO_INSTALL_HEADERS}
LINK_LIBRARIES ${LIBRARIES}
DEPENDS ${DEPENDENCIES}
- COMPONENT hicn-light
+ COMPONENT ${LIBHICN_LIGHT}
INCLUDE_DIRS ${HICN_LIGHT_INCLUDE_DIRS}
INSTALL_ROOT_DIR hicn/hicn-light
DEFINITIONS ${COMPILER_DEFINITIONS}
diff --git a/hicn-plugin/CMakeLists.txt b/hicn-plugin/CMakeLists.txt
index f58ecb061..aaa4136ff 100755
--- a/hicn-plugin/CMakeLists.txt
+++ b/hicn-plugin/CMakeLists.txt
@@ -13,7 +13,12 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(hicn-plugin)
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../cmake/Modules/")
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
+ "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/"
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/"
+)
+
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_C_STANDARD 11)
@@ -24,6 +29,12 @@ if ( HAVE_MEMFD_CREATE )
add_definitions ( -DHAVE_MEMFD_CREATE )
endif()
+if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
+ set(HICN_PLUGIN hicn-plugin)
+endif()
+
+include (Packaging)
+
# Dependencies
find_package(Vpp REQUIRED)
@@ -222,14 +233,21 @@ set_target_properties(hicn_api_test_plugin
LINKER_LANGUAGE C
PREFIX "")
-install(DIRECTORY DESTINATION ${VPP_INSTALL_PLUGIN})
+install(DIRECTORY
+ DESTINATION ${VPP_INSTALL_PLUGIN}
+ COMPONENT ${HICN_PLUGIN})
install(TARGETS hicn_plugin
DESTINATION
- ${VPP_INSTALL_PLUGIN})
+ ${VPP_INSTALL_PLUGIN}
+ COMPONENT ${HICN_PLUGIN})
-install(DIRECTORY DESTINATION ${VPP_INSTALL_API_TEST_PLUGIN})
+install(DIRECTORY
+ DESTINATION ${VPP_INSTALL_API_TEST_PLUGIN}
+ COMPONENT ${HICN_PLUGIN})
install(TARGETS hicn_api_test_plugin
- DESTINATION
- ${VPP_INSTALL_API_TEST_PLUGIN})
+ DESTINATION ${VPP_INSTALL_API_TEST_PLUGIN}
+ COMPONENT ${HICN_PLUGIN})
-install(FILES ${HICN_API_TEST_HEADER_FILES} ${HICN_API_GENERATED_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/vpp_plugins/hicn)
+install(FILES ${HICN_API_TEST_HEADER_FILES} ${HICN_API_GENERATED_FILES}
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/vpp_plugins/hicn
+ COMPONENT ${HICN_PLUGIN}) \ No newline at end of file
diff --git a/hicn-plugin/cmake/Modules/Packaging.cmake b/hicn-plugin/cmake/Modules/Packaging.cmake
new file mode 100644
index 000000000..21ba4138d
--- /dev/null
+++ b/hicn-plugin/cmake/Modules/Packaging.cmake
@@ -0,0 +1,31 @@
+# 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.
+
+######################
+# Packages section
+######################
+
+set(${HICN_PLUGIN}_DESCRIPTION
+ "A high-performance Hybrid ICN forwarder as a plugin to VPP."
+ CACHE STRING "Description for deb/rpm package."
+)
+
+set(${HICN_PLUGIN}_DEB_DEPENDENCIES
+ "libhicn (>= 1.0), vpp (== 19.01-release), vpp-plugins (== 19.01-release)"
+ CACHE STRING "Dependencies for deb/rpm package."
+)
+
+set(${HICN_PLUGIN}_RPM_DEPENDENCIES
+ "libhicn >= 1.0, vpp = 19.01-release, vpp-plugins = 19.01-release"
+ CACHE STRING "Dependencies for deb/rpm package."
+) \ No newline at end of file
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 1be5e67f9..8b0280d7b 100755
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -30,6 +30,8 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(LIBHICN hicn)
endif()
+include (Packaging)
+
set(CMAKE_VERSION_MAJOR 0)
set(CMAKE_VERSION_MINOR 1)
set(CMAKE_VERSION_PATCH 1)
@@ -47,4 +49,4 @@ if (ANDROID_API)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ANDROID_C_FLAGS} -std=c99")
endif ()
-add_subdirectory (src)
+add_subdirectory (src) \ No newline at end of file
diff --git a/lib/cmake/Modules/Packaging.cmake b/lib/cmake/Modules/Packaging.cmake
new file mode 100644
index 000000000..5f946f95d
--- /dev/null
+++ b/lib/cmake/Modules/Packaging.cmake
@@ -0,0 +1,41 @@
+# 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.
+
+######################
+# Packages section
+######################
+
+set(lib${LIBHICN}_DESCRIPTION
+"libhicn provides a support library coded in C \
+designed to help developers embed Hybrid ICN (hICN) \
+functionalities in their applications (eg. forwarder, \
+socket API, etc"
+ CACHE STRING "Description for deb/rpm package."
+)
+
+set(lib${LIBHICN}-dev_DESCRIPTION ${${LIBHICN}_DESCRIPTION}
+ CACHE STRING "Description for deb/rpm package."
+)
+set(lib${LIBHICN}-devel_DESCRIPTION ${${LIBHICN}_DESCRIPTION}
+ CACHE STRING "Description for deb/rpm package."
+)
+
+set(lib${LIBHICN}-dev_DEB_DEPENDENCIES
+ "libhicn (>= 1.0)"
+ CACHE STRING "Dependencies for deb/rpm package."
+)
+
+set(lib${LIBHICN}-devel_DEB_DEPENDENCIES
+ "libhicn >= 1.0"
+ CACHE STRING "Dependencies for deb/rpm package."
+)
diff --git a/lib/src/CMakeLists.txt b/lib/src/CMakeLists.txt
index 0137a16c7..7cd4ccdaa 100755
--- a/lib/src/CMakeLists.txt
+++ b/lib/src/CMakeLists.txt
@@ -56,7 +56,7 @@ include(BuildMacros)
build_library(${LIBHICN}
SHARED STATIC
SOURCES ${LIBHICN_SOURCE_FILES}
- COMPONENT libhicn
+ COMPONENT lib${LIBHICN}
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..
DEFINITIONS ${COMPILER_DEFINITIONS}
INSTALL_ROOT_DIR hicn
diff --git a/libtransport/CMakeLists.txt b/libtransport/CMakeLists.txt
index f2ade4520..097ab03ab 100755
--- a/libtransport/CMakeLists.txt
+++ b/libtransport/CMakeLists.txt
@@ -22,7 +22,6 @@ set(CMAKE_MODULE_PATH
)
include(DefaultConfiguration)
-include(Packager)
include(BuildMacros)
if (NOT CMAKE_BUILD_TYPE)
@@ -69,7 +68,7 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
if (__vpp__)
find_package_wrapper(HicnBinaryApi REQUIRED)
endif()
- set(LIBTRANSPORT transport)
+ set(LIBTRANSPORT hicntransport)
else()
set(HICN_LIBRARIES ${LIBHICN_SHARED})
list(APPEND DEPENDENCIES
@@ -84,6 +83,8 @@ else()
endif()
endif()
+include(Packaging)
+
find_package(Threads REQUIRED)
if (${COMPILE_TESTS})
@@ -112,11 +113,4 @@ list(APPEND LIBTRANSPORT_INCLUDE_DIRS
${ASIO_INCLUDE_DIRS}
)
-add_subdirectory(${TRANSPORT_ROOT_PATH})
-
-# Packaging
-add_package(libtransport
- NAME "libtransport"
- # DEPENDENCIES "fd.io" FIXME
- DESCRIPTION "Shared Memory Interface"
-)
+add_subdirectory(${TRANSPORT_ROOT_PATH}) \ No newline at end of file
diff --git a/libtransport/cmake/Modules/Packager.cmake b/libtransport/cmake/Modules/Packager.cmake
deleted file mode 100755
index 019f18c4e..000000000
--- a/libtransport/cmake/Modules/Packager.cmake
+++ /dev/null
@@ -1,197 +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.
-
-# Generate DEB / RPM packages
-
-# Default variables
-
-if (NOT DEFINED ENV{VENDOR})
- set(VENDOR "Cisco Systems" CACHE STRING "Vendor")
-else ()
- set(VENDOR ENV{VENDOR} CACHE STRING "Vendor")
-endif ()
-
-if (NOT DEFINED ENV{CONTACT})
- set(CONTACT "msardara@cisco.com" CACHE STRING "Contact")
-else ()
- set(CONTACT ENV{CONTACT} CACHE STRING "Contact")
-endif()
-
-if (NOT DEFINED ENV{PACKAGE_MAINTAINER})
- set(PACKAGE_MAINTAINER "Mauro Sardara (msardara@cisco.com)" CACHE STRING "Maintainer")
-else ()
- set(PACKAGE_MAINTAINER ENV{PACKAGE_MAINTAINER} CACHE STRING "Maintainer")
-endif()
-
-if (NOT DEFINED ENV{CPACK_PACKAGING_INSTALL_PREFIX})
- set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
-else ()
- set(CPACK_PACKAGING_INSTALL_PREFIX ENV{CPACK_PACKAGING_INSTALL_PREFIX})
-endif()
-
-set(CPACK_COMPONENTS_ALL library headers utils documentation)
-
-function (make_package_internal PACKAGE_NAME PACKAGE_VERSION ARCHITECTURE GENERATOR TYPE DESCRIPTION HOMEPAGE)
- set(CPACK_GENERATOR ${GENERATOR})
- set(CPACK_PACKAGE_VENDOR ${VENDOR})
- set(CPACK_PACKAGE_CONTACT ${CONTACT})
-
- set(CPACK_${GENERATOR}_COMPONENT_INSTALL ON)
- set(CPACK_${TYPE}_PACKAGE_MAINTAINER ${PACKAGE_MAINTAINER})
- set(CPACK_${TYPE}_PACKAGE_NAME ${PACKAGE_NAME})
- set(CPACK_${TYPE}_PACKAGE_VERSION ${PACKAGE_VERSION})
- set(CPACK_${TYPE}_PACKAGE_ARCHITECTURE ${ARCHITECTURE})
- set(CPACK_${TYPE}_PACKAGE_RELEASE 1)
- set(CPACK_${TYPE}_PACKAGE_VENDOR ${VENDOR})
- set(CPACK_${TYPE}_PACKAGE_DESCRIPTION ${DESCRIPTION})
- set(CPACK_${TYPE}_PACKAGE_HOMEPAGE ${HOMEPAGE})
-
- include(CPack)
-endfunction()
-
-function(make_deb_package PACKAGE_NAME PACKAGE_VERSION ARCHITECTURE DEPS BUILD_DEPS DESCRIPTION HOMEPAGE)
-
- set(TYPE "DEBIAN")
- set(GENERATOR "DEB")
-
- set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}")
- set(CPACK_${TYPE}_UTILS_PACKAGE_NAME "${PACKAGE_NAME}-utils")
- set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-dev")
- set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc")
-
- set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${CPACK_${TYPE}_LIBRARY_PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
- set(CPACK_${TYPE}_UTILS_FILE_NAME "${CPACK_${TYPE}_UTILS_PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
- set(CPACK_${TYPE}_HEADERS_FILE_NAME "${CPACK_${TYPE}_HEADERS_PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
- set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}.deb")
-
- set(CPACK_DEBIAN_LIBRARY_PACKAGE_SHLIBDEPS OFF)
-
- set(CPACK_${TYPE}_LIBRARY_PACKAGE_DEPENDS ${DEPS})
- set(CPACK_${TYPE}_UTILS_PACKAGE_DEPENDS ${CPACK_${TYPE}_LIBRARY_PACKAGE_NAME})
- set(CPACK_${TYPE}_HEADERS_PACKAGE_DEPENDS ${BUILD_DEPS})
- set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_DEPENDS "")
-
- make_package_internal(${PACKAGE_NAME} ${PACKAGE_VERSION} ${ARCHITECTURE} ${GENERATOR} ${TYPE} ${DESCRIPTION} ${HOMEPAGE})
-endfunction()
-
-function(make_rpm_package PACKAGE_NAME PACKAGE_VERSION ARCHITECTURE DEPS BUILD_DEPS DESCRIPTION HOMEPAGE)
- set(TYPE "RPM")
- set(GENERATOR "RPM")
-
- set(CPACK_${TYPE}_LIBRARY_PACKAGE_NAME "${PACKAGE_NAME}")
- set(CPACK_${TYPE}_UTILS_PACKAGE_NAME "${PACKAGE_NAME}-utils")
- set(CPACK_${TYPE}_HEADERS_PACKAGE_NAME "${PACKAGE_NAME}-devel")
- set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME "${PACKAGE_NAME}-doc")
-
- set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${CPACK_${TYPE}_LIBRARY_PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
- set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${CPACK_${TYPE}_UTILS_PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
- set(CPACK_${TYPE}_HEADERS_FILE_NAME "${CPACK_${TYPE}_HEADERS_PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
- set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${CPACK_${TYPE}_DOCUMENTATION_PACKAGE_NAME}-${PACKAGE_VERSION}.${ARCHITECTURE}.rpm")
-
- set(CPACK_${TYPE}_LIBRARY_PACKAGE_AUTOREQ OFF)
-
- set(CPACK_${TYPE}_LIBRARY_PACKAGE_REQUIRES ${DEPS})
- set(CPACK_${TYPE}_UTILS_PACKAGE_DEPENDS ${CPACK_${TYPE}_LIBRARY_PACKAGE_NAME})
- set(CPACK_${TYPE}_HEADERS_PACKAGE_REQUIRES ${BUILD_DEPS})
- set(CPACK_${TYPE}_DOCUMENTATION_PACKAGE_REQUIRES "")
-
- set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages")
-
- make_package_internal(${PACKAGE_NAME} ${PACKAGE_VERSION} ${ARCHITECTURE} ${GENERATOR} ${TYPE} ${DESCRIPTION} ${HOMEPAGE})
-endfunction()
-
-function(make_tgz_package PACKAGE_NAME PACKAGE_VERSION ARCHITECTURE)
-
- set(TYPE "ARCHIVE")
- set(GENERATOR "TGZ")
-
- set(CPACK_${TYPE}_COMPONENT_INSTALL ON)
- set(CPACK_${TYPE}_LIBRARY_FILE_NAME "${PACKAGE_NAME}_${PACKAGE_VERSION}_${ARCHITECTURE}")
- set(CPACK_${TYPE}_UTILS_FILE_NAME "${PACKAGE_NAME}-utils_${PACKAGE_VERSION}_${ARCHITECTURE}")
- set(CPACK_${TYPE}_HEADERS_FILE_NAME "${PACKAGE_NAME}-dev_${PACKAGE_VERSION}_${ARCHITECTURE}")
- set(CPACK_${TYPE}_DOCUMENTATION_FILE_NAME "${PACKAGE_NAME}-doc_${PACKAGE_VERSION}_${ARCHITECTURE}")
-
- set(CPACK_GENERATOR ${GENERATOR})
- set(CPACK_PACKAGE_VENDOR ${VENDOR})
- set(CPACK_PACKAGE_CONTACT ${CONTACT})
-
- include(CPack)
-
-endfunction()
-
-function (make_package DEPS_DEB DEPS_RPM BUILD_DEPS_DEB BUILD_DEPS_RPM DESCRIPTION HOMEPAGE)
-
- if (NOT DEFINED ENV{PACKAGE_NAME})
- string(TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME)
- else ()
- string(TOLOWER $ENV{PACKAGE_NAME} PACKAGE_NAME)
- endif ()
-
- # Get the version
- execute_process(COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/version
- OUTPUT_VARIABLE PACKAGE_VERSION)
-
- if (PACKAGE_VERSION)
- string(STRIP ${PACKAGE_VERSION} PACKAGE_VERSION)
- else ()
- set(PACKAGE_VERSION 1.0)
- endif ()
-
- if (EXISTS "/etc/lsb-release")
- execute_process(COMMAND grep -oP "(?<=DISTRIB_ID=).*" /etc/lsb-release OUTPUT_VARIABLE DISTRIB_ID)
- execute_process(COMMAND grep -oP "(?<=DISTRIB_RELEASE=).*" /etc/lsb-release OUTPUT_VARIABLE DISTRIB_RELEASE)
- execute_process(COMMAND grep -oP "(?<=DISTRIB_CODENAME=).*" /etc/lsb-release OUTPUT_VARIABLE DISTRIB_CODENAME)
- execute_process(COMMAND grep -oP "(?<=DISTRIB_DESCRIPTION=).*" /etc/lsb-release OUTPUT_VARIABLE DISTRIB_DESCRIPTION)
- execute_process(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
-
- if (${ARCHITECTURE} STREQUAL "x86_64")
- set(ARCHITECTURE "amd64")
- endif()
-
- make_deb_package(${PACKAGE_NAME}
- ${PACKAGE_VERSION}
- ${ARCHITECTURE}
- ${DEPS_DEB}
- ${BUILD_DEPS_DEB}
- ${DESCRIPTION}
- ${HOMEPAGE})
-
- elseif(EXISTS "/etc/redhat-release")
- execute_process(COMMAND sudo yum install -y redhat-lsb)
- execute_process(COMMAND lsb_release -si OUTPUT_VARIABLE DISTRIB_ID)
- execute_process(COMMAND lsb_release -sr OUTPUT_VARIABLE DISTRIB_RELEASE)
- execute_process(COMMAND lsb_release -sc OUTPUT_VARIABLE DISTRIB_CODENAME)
- execute_process(COMMAND lsb_release -sd OUTPUT_VARIABLE DISTRIB_DESCRIPTION)
- execute_process(COMMAND uname -m -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
-
- make_rpm_package(${PACKAGE_NAME}
- ${PACKAGE_VERSION}
- ${ARCHITECTURE}
- ${DEPS_RPM}
- ${BUILD_DEPS_RPM}
- ${DESCRIPTION}
- ${HOMEPAGE})
- else()
- execute_process(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
-
- if (${ARCHITECTURE} STREQUAL "x86_64")
- set(ARCHITECTURE "amd64")
- endif()
-
- # Other linux system. Create a tar.gz package
- make_tgz_package(${PACKAGE_NAME}
- ${PACKAGE_VERSION}
- ${ARCHITECTURE})
-
- endif()
-endfunction()
diff --git a/libtransport/cmake/Modules/Packaging.cmake b/libtransport/cmake/Modules/Packaging.cmake
new file mode 100755
index 000000000..6dc0eb457
--- /dev/null
+++ b/libtransport/cmake/Modules/Packaging.cmake
@@ -0,0 +1,80 @@
+# 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.
+
+# Generate DEB / RPM packages
+
+######################
+# Packages section
+######################
+
+set(lib${LIBTRANSPORT}_DESCRIPTION
+"Libhicn-transport provides transport services and \
+socket API for applications willing to communicate \
+using the hICN protocol stack."
+ CACHE STRING "Description for deb/rpm package."
+)
+
+set(lib${LIBTRANSPORT}-dev_DESCRIPTION ${lib${LIBTRANSPORT}_DESCRIPTION}
+ CACHE STRING "Description for deb/rpm package.")
+set(lib${LIBTRANSPORT}-devel_DESCRIPTION ${lib${LIBTRANSPORT}_DESCRIPTION}
+ CACHE STRING "Description for deb/rpm package.")
+
+if ((BUILD_MEMIF_CONNECTOR OR BUILD_VPP_PLUGIN) AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+
+ set(lib${LIBTRANSPORT}_DEB_DEPENDENCIES
+ "libhicn (>= 1.0), libparc (>= 1.0), vpp-lib (== 19.01-release)"
+ CACHE STRING "Dependencies for deb/rpm package."
+ )
+
+ set(lib${LIBTRANSPORT}_RPM_DEPENDENCIES
+ "libhicn >= 1.0, libparc >= 1.0, vpp-lib = 19.01-release"
+ CACHE STRING "Dependencies for deb/rpm package."
+ )
+
+ set(lib${LIBTRANSPORT}-dev_DEB_DEPENDENCIES
+ "libtransport (>= 1.0), libasio-dev (>= 1.10), libhicn-dev (>= 1.0), libparc-dev (>= 1.0), vpp-dev (== 19.01-release)"
+ CACHE STRING "Dependencies for deb/rpm package."
+ )
+
+ set(lib${LIBTRANSPORT}-devel_RPM_DEPENDENCIES
+ "libtransport >= 1.0, asio-devel >= 1.10, libhicn-devel >= 1.0, libparc-devel >= 1.0, vpp-devel = 19.01-release"
+ CACHE STRING "Dependencies for deb/rpm package."
+ )
+
+else()
+<<<<<<< HEAD
+
+=======
+
+>>>>>>> 691dfde... [HICN-3] First version of packaging system based on cmake.
+ set(lib${LIBTRANSPORT}_DEB_DEPENDENCIES
+ "libhicn (>= 1.0), libparc (>= 1.0)"
+ CACHE STRING "Dependencies for deb/rpm package."
+ )
+
+ set(lib${LIBTRANSPORT}_RPM_DEPENDENCIES
+ "libhicn >= 1.0, libparc >= 1.0"
+ CACHE STRING "Dependencies for deb/rpm package."
+ )
+
+ set(lib${LIBTRANSPORT}-dev_DEB_DEPENDENCIES
+ "libtransport (>= 1.0), libasio-dev (>= 1.10), libhicn-dev (>= 1.0), libparc-dev (>= 1.0)"
+ CACHE STRING "Dependencies for deb/rpm package."
+ )
+
+ set(lib${LIBTRANSPORT}-devel_RPM_DEPENDENCIES
+ "libtransport >= 1.0, asio-devel >= 1.10, libhicn-devel >= 1.0, libparc-devel >= 1.0"
+ CACHE STRING "Dependencies for deb/rpm package."
+ )
+
+endif() \ No newline at end of file
diff --git a/libtransport/src/hicn/transport/CMakeLists.txt b/libtransport/src/hicn/transport/CMakeLists.txt
index f3c1cd2dc..fd5721273 100755
--- a/libtransport/src/hicn/transport/CMakeLists.txt
+++ b/libtransport/src/hicn/transport/CMakeLists.txt
@@ -14,7 +14,11 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
configure_file("config.h.in" "config.h" @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION include/hicn/transport COMPONENT libtransport-dev)
+install(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h
+ DESTINATION include/hicn/transport
+ COMPONENT lib${LIBTRANSPORT}
+)
add_subdirectory(core)
add_subdirectory(errors)
@@ -42,7 +46,7 @@ build_library(${LIBTRANSPORT}
INSTALL_HEADERS ${HEADER_FILES}
LINK_LIBRARIES ${LIBRARIES}
DEPENDS ${DEPENDENCIES}
- COMPONENT libtransport
+ COMPONENT lib${LIBTRANSPORT}
INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS}
INSTALL_ROOT_DIR hicn/transport
DEFINITIONS ${COMPILER_DEFINITIONS}
diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh
new file mode 100644
index 000000000..ae775aca9
--- /dev/null
+++ b/scripts/build-packages.sh
@@ -0,0 +1,14 @@
+# 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.
+
+exit 0 \ No newline at end of file
diff --git a/scripts/checkstyle.sh b/scripts/checkstyle.sh
new file mode 100644
index 000000000..ae775aca9
--- /dev/null
+++ b/scripts/checkstyle.sh
@@ -0,0 +1,14 @@
+# 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.
+
+exit 0 \ No newline at end of file
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 95fdd508d..9d05942ed 100755
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -23,15 +23,16 @@ set(CMAKE_MODULE_PATH
)
include(BuildMacros)
-include(Packager)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
find_package(Libtransport REQUIRED)
+ set(HICN_UTILS hicn-utils)
else()
- # TODO Set name of targets in CMakeroot file
set(LIBTRANSPORT_LIBRARIES ${LIBTRANSPORT})
endif()
+include(Packaging)
+
set (COMPILER_DEFINITIONS "-DASIO_STANDALONE")
list(APPEND UTILS_SRC
@@ -47,8 +48,8 @@ foreach(util ${UTILS_SRC})
build_executable(${util_name}
SOURCES ${util}
LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES}
- DEPENDS transport
- COMPONENT utils
+ DEPENDS ${LIBTRANSPORT}
+ COMPONENT hicn-utils
DEFINITIONS ${COMPILER_DEFINITIONS}
)
endforeach() \ No newline at end of file
diff --git a/utils/cmake/Modules/Packaging.cmake b/utils/cmake/Modules/Packaging.cmake
new file mode 100644
index 000000000..cff3d3fb1
--- /dev/null
+++ b/utils/cmake/Modules/Packaging.cmake
@@ -0,0 +1,28 @@
+# 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.
+
+set(${HICN_UTILS}_DESCRIPTION
+"Hicn utils provide the hicn-ping and hiperf applications, \
+useful for testing and debugging within a hicn network."
+ CACHE STRING "Description for deb/rpm package."
+)
+
+set(${HICN_UTILS}_DEB_DEPENDENCIES
+ "libhicntransport (>= 1.0)"
+ CACHE STRING "Dependencies for deb/rpm package."
+)
+
+set(${HICN_UTILS}_RPM_DEPENDENCIES
+ "libhicntransport >= 1.0"
+ CACHE STRING "Dependencies for deb/rpm package."
+) \ No newline at end of file