aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara+fdio@cisco.com>2017-03-27 16:31:41 +0200
committerMauro Sardara <msardara+fdio@cisco.com>2017-03-27 16:45:44 +0200
commit0bb48911095fb2dc34a15c42d287a7fd046a6b76 (patch)
tree80343ab3b178caf5397cdfea2d27103f1d697e4d
parentf936493d920ba7e6e1a628e2932c61495a7eb3ca (diff)
Adding support for creating DEB and RPM packages
Change-Id: If2ba80f4b7f75cbdaa56349ccfe26663289a403a Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
-rw-r--r--CMakeLists.txt58
-rwxr-xr-xapps/consumers/CMakeLists.txt2
-rw-r--r--icnet/CMakeLists.txt28
3 files changed, 72 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e93cf4d..fed2c166 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,11 +12,11 @@
# limitations under the License.
cmake_minimum_required(VERSION 3.2)
-project(libicnet)
+project(Libicnet)
set(CMAKE_CXX_STANDARD 11)
-set(CP_Api_VERSION_MAJOR 0)
-set(CP_Api_VERSION_MINOR 1)
+set(${CMAKE_PROJECT_NAME}_VERSION_MAJOR 1)
+set(${CMAKE_PROJECT_NAME}_VERSION_MINOR 0)
## Set build folders
#set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
@@ -70,12 +70,8 @@ include_directories(${CMAKE_THREADS_INCLUDE_DIRS})
find_package(Threads REQUIRED)
-find_package(Boost 1.54.0 COMPONENTS system REQUIRED)
-include_directories(SYSTEM ${Boost_INCLUDE_DIR})
-
set(CMAKE_VERBOSE_MAKEFILE off)
-
if(ANDROID_API)
include_directories(${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.9/include)
include_directories(${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include)
@@ -83,6 +79,8 @@ if(ANDROID_API)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} ${ANDROID_C_FLAGS} -std=c++11 -Wall -fpermissive -O3")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fpermissive -O3")
+ find_package(Boost 1.54.0 COMPONENTS system REQUIRED)
+ include_directories(SYSTEM ${Boost_INCLUDE_DIR})
if (BUILD_APPS)
set(SUBFOLDERS ${APPS})
endif (BUILD_APPS)
@@ -100,3 +98,49 @@ set(LIBRARIES
set(SUBFOLDERS ${SUBFOLDERS} icnet)
subdirs(${SUBFOLDERS})
+
+# Generate DEB / RPM packages
+
+option(DEB_PACKAGE "Create deb package" OFF)
+option(RPM_PACKAGE "Create deb package" OFF)
+
+SET(VENDOR "Cisco Systems" CACHE STRING "Vendor")
+SET(CONTACT "msardara@cisco.com" CACHE STRING "Contact")
+SET(DISTRIBUTION "xenial" CACHE STRING "Distribution")
+SET(ARCHITECTURE "amd64" CACHE STRING "Architecture")
+SET(PACKAGE_MAINTAINER "Mauro Sardara" CACHE STRING "Maintainer")
+SET(PACKAGE_VERSION "1.0" CACHE STRING "Version")
+SET(BUILD_NUMBER "1" CACHE STRING "Build Number")
+STRING(TOLOWER ${CMAKE_PROJECT_NAME} PACKAGE_NAME)
+
+SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
+SET(CPACK_PACKAGE_VERSION_MAJOR ${${CMAKE_PROJECT_NAME}_VERSION_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${${CMAKE_PROJECT_NAME}_VERSION_MINOR})
+SET(CPACK_PACKAGE_VENDOR ${VENDOR})
+SET(CPACK_PACKAGE_CONTACT ${CONTACT})
+
+if(DEB_PACKAGE)
+ SET(TYPE "DEBIAN")
+ SET(GENERATOR "DEB")
+ SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${BUILD_NUMBER}~${DISTRIBUTION}_${ARCHITECTURE}")
+ SET(CPACK_${TYPE}_PACKAGE_REQUIRES "longbow >= 1.0, libevent-2.0-5, libssl1.0.0, libparc >= 1.0, libccnx-common >= 1.0, libccnx-transport-rta >= 1.0, libccnx-portal >= 1.0, libboost-system-dev >= 1.58")
+elseif(RPM_PACKAGE)
+ SET(TYPE "RPM")
+ SET(GENERATOR "RPM")
+ SET(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${BUILD_NUMBER}.${DISTRIBUTION}.${ARCHITECTURE}")
+ SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/etc" "/usr/lib/python2.7" "/usr/lib/python2.7/site-packages")
+ SET(CPACK_${TYPE}_PACKAGE_REQUIRES "longbow >= 1.0, libevent >= 2.0, openssl >= 1.0, libparc >= 1.0, libccnx-common >= 1.0, boost-system >= 1.53")
+else()
+ RETURN()
+endif()
+
+SET(CPACK_GENERATOR ${GENERATOR})
+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 "This library is designed to provide a transport layer for applications willing to communicate using an ICN protocol stack.")
+
+INCLUDE(CPack)
diff --git a/apps/consumers/CMakeLists.txt b/apps/consumers/CMakeLists.txt
index de9c254f..b9314060 100755
--- a/apps/consumers/CMakeLists.txt
+++ b/apps/consumers/CMakeLists.txt
@@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cmake_minimum_required(VERSION 3.4)
+cmake_minimum_required(VERSION 3.2)
set(CONSUMER_SOURCE_FILES icnet_consumer_test.cc)
set(IGET_SOURCE_FILES icnet_iget.cc)
diff --git a/icnet/CMakeLists.txt b/icnet/CMakeLists.txt
index 76e45f69..6c164498 100644
--- a/icnet/CMakeLists.txt
+++ b/icnet/CMakeLists.txt
@@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.2)
file(GLOB HEADER_FILES "ccnx/*.h")
file(GLOB SOURCE_FILES "ccnx/*.cc")
-set(CP_API_HEADER_FILES
+set(ICNET_HEADER_FILES
${CMAKE_BINARY_DIR}/config.hpp
transport/icnet_rate_estimation.h
transport/icnet_download_observer.h
@@ -33,7 +33,7 @@ set(CP_API_HEADER_FILES
transport/icnet_transport_vegas_rto_estimator.h
transport/icnet_transport_raaqm_data_path.h)
-set(CP_API_SOURCE_FILES
+set(ICNET_SOURCE_FILES
transport/icnet_socket_producer.cc
transport/icnet_socket_consumer.cc
transport/icnet_transport_vegas.cc
@@ -44,17 +44,29 @@ set(CP_API_SOURCE_FILES
transport/icnet_rate_estimation.cc
transport/icnet_transport_raaqm_data_path.cc)
-set(CP_API_CONFIG
+set(ICNET_CONFIG
transport/consumer.conf)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
-add_library(icnet SHARED ${SOURCE_FILES} ${CP_API_SOURCE_FILES})
+add_library(icnet STATIC ${SOURCE_FILES} ${ICNET_SOURCE_FILES} ${HEADER_FILES} ${ICNET_HEADER_FILES})
+add_library(icnet.shared SHARED ${SOURCE_FILES} ${ICNET_SOURCE_FILES})
+target_link_libraries(icnet.shared ${LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
target_link_libraries(icnet ${LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
-install(TARGETS icnet DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
+set_target_properties(icnet.shared PROPERTIES
+ SOVERSION 1
+ VERSION 1.0
+ OUTPUT_NAME icnet)
+
+set(libicnet_libraries
+ icnet
+ icnet.shared)
+
+foreach(lib ${libicnet_libraries})
+ install(TARGETS ${lib} LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
+endforeach()
-install(FILES ${COMMON_HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/icnet)
install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/icnet)
-install(FILES ${CP_API_HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/icnet)
-install(FILES ${CP_API_CONFIG} DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/)
+install(FILES ${ICNET_HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/icnet)
+install(FILES ${ICNET_CONFIG} DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/)