aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/Modules
diff options
context:
space:
mode:
authorLuca Muscariello <muscariello@ieee.org>2021-04-15 09:05:46 +0200
committerMauro Sardara <msardara@cisco.com>2021-04-15 16:36:16 +0200
commite92e9e839ca2cf42b56322b2489ccc0d8bf767af (patch)
tree9f1647c83a87fbf982ae329e800af25dbfb226b5 /cmake/Modules
parent3e541d7c947cc2f9db145f26c9274efd29a6fb56 (diff)
[HICN-690] Transport Library Major Refactory
The current patch provides a major refactory of the transportlibrary. A summary of the different components that underwent major modifications is reported below. - Transport protocol updates The hierarchy of classes has been optimized to have common transport services across different transport protocols. This can allow to customize a transport protocol with new features. - A new real-time communication protocol The RTC protocol has been optimized in terms of algorithms to reduce consumer-producer synchronization latency. - A novel socket API The API has been reworked to be easier to consumer but also to have a more efficient integration in L4 proxies. - Several performance improvements A large number of performance improvements have been included in particular to make the entire stack zero-copy and optimize cache miss. - New memory buffer framework Memory management has been reworked entirely to provide a more efficient infra with a richer API. Buffers are now allocated in blocks and a single buffer holds the memory for (1) the shared_ptr control block, (2) the metadata of the packet (e.g. name, pointer to other buffers if buffer is chained and relevant offsets), and (3) the packet itself, as it is sent/received over the network. - A new slab allocator Dynamic memory allocation is now managed by a novel slab allocator that is optimised for packet processing and connection management. Memory is organized in pools of blocks all of the same size which are used during the processing of outgoing/incoming packets. When a memory block Is allocated is always taken from a global pool and when it is deallocated is returned to the pool, thus avoiding the cost of any heap allocation in the data path. - New transport connectors Consumer and producer end-points can communication either using an hicn packet forwarder or with direct connector based on shared memories or sockets. The usage of transport connectors typically for unit and funcitonal testing but may have additional usage. - Support for FEC/ECC for transport services FEC/ECC via reed solomon is supported by default and made available to transport services as a modular component. Reed solomon block codes is a default FEC model that can be replaced in a modular way by many other codes including RLNC not avaiable in this distribution. The current FEC framework support variable size padding and efficiently makes use of the infra memory buffers to avoid additiona copies. - Secure transport framework for signature computation and verification Crypto support is nativelty used in hICN for integrity and authenticity. Novel support that includes RTC has been implemented and made modular and reusable acrosso different transport protocols. - TLS - Transport layer security over hicn Point to point confidentiality is provided by integrating TLS on top of hICN reliable and non-reliable transport. The integration is common and makes a different use of the TLS record. - MLS - Messaging layer security over hicn MLS integration on top of hICN is made by using the MLSPP implemetation open sourced by Cisco. We have included instrumentation tools to deploy performance and functional tests of groups of end-points. - Android support The overall code has been heavily tested in Android environments and has received heavy lifting to better run natively in recent Android OS. Co-authored-by: Mauro Sardara <msardara@cisco.com> Co-authored-by: Michele Papalini <micpapal@cisco.com> Co-authored-by: Olivier Roques <oroques+fdio@cisco.com> Co-authored-by: Giulio Grassi <gigrassi@cisco.com> Change-Id: If477ba2fa686e6f47bdf96307ac60938766aef69 Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/BuildMacros.cmake87
-rw-r--r--cmake/Modules/FindLibFec.cmake24
-rw-r--r--cmake/Modules/FindLibRely.cmake24
-rw-r--r--cmake/Modules/FindLibconfig++.cmake43
-rw-r--r--cmake/Modules/FindLibconfig.cmake43
-rw-r--r--cmake/Modules/FindLibhicn.cmake2
-rw-r--r--cmake/Modules/GTestImport.cmake7
-rw-r--r--cmake/Modules/ServiceScript.cmake2
8 files changed, 212 insertions, 20 deletions
diff --git a/cmake/Modules/BuildMacros.cmake b/cmake/Modules/BuildMacros.cmake
index 7119541dd..4c55f32fe 100644
--- a/cmake/Modules/BuildMacros.cmake
+++ b/cmake/Modules/BuildMacros.cmake
@@ -21,7 +21,7 @@ macro(build_executable exec)
cmake_parse_arguments(ARG
"NO_INSTALL"
"COMPONENT"
- "SOURCES;LINK_LIBRARIES;DEPENDS;INCLUDE_DIRS;DEFINITIONS;LINK_FLAGS"
+ "SOURCES;LINK_LIBRARIES;DEPENDS;INCLUDE_DIRS;DEFINITIONS;COMPILE_OPTIONS;LINK_FLAGS"
${ARGN}
)
@@ -48,6 +48,10 @@ macro(build_executable exec)
add_dependencies(${exec}-bin ${ARG_DEPENDS})
endif()
+ if (ARG_COMPILE_OPTIONS)
+ target_compile_options(${exec}-bin ${ARG_COMPILE_OPTIONS})
+ endif()
+
if(ARG_DEFINITIONS)
target_compile_definitions(${exec}-bin PRIVATE ${ARG_DEFINITIONS})
endif()
@@ -71,12 +75,17 @@ endmacro()
macro(build_library lib)
cmake_parse_arguments(ARG
- "SHARED;STATIC;MODULE;NO_DEV"
+ "SHARED;STATIC;NO_DEV"
"COMPONENT;"
- "SOURCES;LINK_LIBRARIES;INSTALL_HEADERS;DEPENDS;INCLUDE_DIRS;DEFINITIONS;INSTALL_ROOT_DIR;INSTALL_FULL_PATH_DIR;EMPTY_PREFIX;"
+ "SOURCES;LINK_LIBRARIES;INSTALL_HEADERS;DEPENDS;INCLUDE_DIRS;DEFINITIONS;HEADER_ROOT_DIR;LIBRARY_ROOT_DIR;INSTALL_FULL_PATH_DIR;EMPTY_PREFIX;COMPILE_OPTIONS;VERSION"
${ARGN}
)
+ message(STATUS "Building library ${lib}")
+
+ # Clear target_libs
+ unset(TARGET_LIBS)
+
if (ARG_SHARED)
list(APPEND TARGET_LIBS
${lib}.shared
@@ -91,13 +100,6 @@ macro(build_library lib)
add_library(${lib}.static STATIC ${ARG_SOURCES})
endif()
- if(ARG_MODULE)
- list(APPEND TARGET_LIBS
- ${lib}.module
- )
- add_library(${lib}.module MODULE ${ARG_SOURCES})
- endif()
-
if(NOT ARG_COMPONENT)
set(ARG_COMPONENT hicn)
endif()
@@ -135,13 +137,13 @@ macro(build_library lib)
endif()
if (WIN32)
- target_compile_options(${library} PRIVATE)
+ target_compile_options(${library} PRIVATE ${ARG_COMPILE_OPTIONS})
set_target_properties(${library}
PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
)
else ()
- target_compile_options(${library} PRIVATE -Wall)
+ target_compile_options(${library} PRIVATE -Wall ${ARG_COMPILE_OPTIONS})
set_target_properties(${library}
PROPERTIES
OUTPUT_NAME ${lib}
@@ -164,7 +166,14 @@ macro(build_library lib)
)
endif()
- set(INSTALL_LIB_PATH ${CMAKE_INSTALL_LIBDIR})
+ if(ARG_VERSION)
+ set_target_properties(${library}
+ PROPERTIES
+ VERSION ${ARG_VERSION}
+ )
+ endif()
+
+ set(INSTALL_LIB_PATH "${CMAKE_INSTALL_LIBDIR}/${ARG_LIBRARY_ROOT_DIR}")
if (ARG_INSTALL_FULL_PATH_DIR)
set(INSTALL_LIB_PATH ${ARG_INSTALL_FULL_PATH_DIR})
@@ -185,8 +194,8 @@ macro(build_library lib)
# install headers
if(ARG_INSTALL_HEADERS)
- if (NOT ARG_INSTALL_ROOT_DIR)
- set(ARG_INSTALL_ROOT_DIR "hicn")
+ if (NOT ARG_HEADER_ROOT_DIR)
+ set(ARG_HEADER_ROOT_DIR "hicn")
endif()
list(APPEND local_comps
@@ -204,7 +213,7 @@ macro(build_library lib)
if ("${dir}" STREQUAL includes)
set(dir "")
endif()
- if ("${dir}" STREQUAL ${ARG_INSTALL_ROOT_DIR})
+ if ("${dir}" STREQUAL ${ARG_HEADER_ROOT_DIR})
set(dir "")
endif()
else()
@@ -217,12 +226,56 @@ macro(build_library lib)
endif()
install(
FILES ${file}
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${ARG_INSTALL_ROOT_DIR}/${dir}
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${ARG_HEADER_ROOT_DIR}/${dir}
COMPONENT ${COMPONENT}
)
endforeach()
endif()
endmacro()
+macro (build_module module)
+ cmake_parse_arguments(ARG
+ "SHARED;STATIC;NO_DEV"
+ "COMPONENT;"
+ "SOURCES;LINK_LIBRARIES;INSTALL_HEADERS;DEPENDS;INCLUDE_DIRS;DEFINITIONS;HEADER_ROOT_DIR;LIBRARY_ROOT_DIR;INSTALL_FULL_PATH_DIR;EMPTY_PREFIX;COMPILE_OPTIONS;VERSION"
+ ${ARGN}
+ )
+
+ message(STATUS "Building module ${module}")
+
+ build_library(${module}
+ SHARED
+ SOURCES ${ARG_SOURCES}
+ LINK_LIBRARIES ${ARG_LINK_LIBRARIES}
+ INSTALL_HEADERS ${ARG_INSTALL_HEADERS}
+ DEPENDS ${ARG_DEPENDS}
+ COMPONENT lib${LIBTRANSPORT}
+ INCLUDE_DIRS ${ARG_INCLUDE_DIRS}
+ HEADER_ROOT_DIR ${ARG_HEADER_ROOT_DIR}
+ LIBRARY_ROOT_DIR ${ARG_LIBRARY_ROOT_DIR}
+ INSTALL_FULL_PATH_DIR ${ARG_INSTALL_FULL_PATH_DIR}
+ DEFINITIONS ${ARG_DEFINITIONS}
+ EMPTY_PREFIX ${ARG_EMPTY_PREFIX}
+ COMPILE_OPTIONS ${ARG_COMPILE_OPTIONS}
+ VERSION ${ARG_VERSION}
+ )
+
+ if (${CMAKE_SYSTEM_NAME} MATCHES Darwin)
+ set(LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES Linux)
+ set(LINK_FLAGS "-Wl,-unresolved-symbols=ignore-all")
+ else()
+ message(FATAL_ERROR "Trying to build module on a not supportd platform. Aborting.")
+ endif()
+
+ set_target_properties(${module}.shared
+ PROPERTIES
+ LINKER_LANGUAGE C
+ PREFIX ""
+ LINK_FLAGS ${LINK_FLAGS}
+ )
+
+endmacro(build_module)
+
include(IosMacros)
include(WindowsMacros)
diff --git a/cmake/Modules/FindLibFec.cmake b/cmake/Modules/FindLibFec.cmake
new file mode 100644
index 000000000..f8b33ad6b
--- /dev/null
+++ b/cmake/Modules/FindLibFec.cmake
@@ -0,0 +1,24 @@
+set(LIBFEC_SEARCH_PATH_LIST
+ ${LIBFEC_HOME}
+ $ENV{DEPENDENCIES}
+ $ENV{LIBFEC_HOME}
+ /usr/local
+ /opt
+ /usr
+ )
+
+find_path(LIBFEC_INCLUDE_DIR fec/version.h
+ HINTS ${LIBFEC_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the LibFec includes" )
+
+find_library(LIBFEC_LIBRARY NAMES fec
+ HINTS ${LIBFEC_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the LibFec libraries" )
+
+set(LIBFEC_LIBRARIES ${LIBFEC_LIBRARY})
+set(LIBFEC_INCLUDE_DIRS ${LIBFEC_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibFec DEFAULT_MSG LIBFEC_LIBRARY LIBFEC_INCLUDE_DIR) \ No newline at end of file
diff --git a/cmake/Modules/FindLibRely.cmake b/cmake/Modules/FindLibRely.cmake
new file mode 100644
index 000000000..4b8960041
--- /dev/null
+++ b/cmake/Modules/FindLibRely.cmake
@@ -0,0 +1,24 @@
+set(LIBRELY_SEARCH_PATH_LIST
+ ${LIBRELY_HOME}
+ $ENV{DEPENDENCIES}
+ $ENV{LIBRELY_HOME}
+ /usr/local
+ /opt
+ /usr
+ )
+
+find_path(LIBRELY_INCLUDE_DIR rely/version.hpp
+ HINTS ${LIBRELY_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the LibRely includes" )
+
+find_library(LIBRELY_LIBRARY NAMES rely
+ HINTS ${LIBRELY_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the LibRely libraries" )
+
+set(LIBRELY_LIBRARIES ${LIBRELY_LIBRARY})
+set(LIBRELY_INCLUDE_DIRS ${LIBRELY_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibRely DEFAULT_MSG LIBRELY_LIBRARY LIBRELY_INCLUDE_DIR) \ No newline at end of file
diff --git a/cmake/Modules/FindLibconfig++.cmake b/cmake/Modules/FindLibconfig++.cmake
new file mode 100644
index 000000000..865f75078
--- /dev/null
+++ b/cmake/Modules/FindLibconfig++.cmake
@@ -0,0 +1,43 @@
+set(LIBCONFIG_SEARCH_PATH_LIST
+ ${LIBCONFIG_HOME}
+ $ENV{LIBCONFIG_HOME}
+ /usr/local
+ /opt
+ /usr
+)
+
+find_path(LIBCONFIG_INCLUDE_DIR libconfig.h++
+ HINTS ${LIBCONFIG_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the libconfig include"
+)
+
+if (WIN32)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ find_library(LIBCONFIG_LIBRARY NAMES libconfig.lib
+ HINTS ${LIBCONFIG_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib/x64
+ DOC "Find the libconfig libraries"
+ )
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ find_library(LIBCONFIG_LIBRARY NAMES libconfig.lib
+ HINTS ${LIBCONFIG_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib/x32
+ DOC "Find the libconfig libraries"
+ )
+ endif()
+else()
+ find_library(LIBCONFIG_CPP_LIBRARY NAMES config++
+ HINTS ${LIBCONFIG_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the libconfig++ libraries"
+ )
+endif()
+
+set(LIBCONFIG_CPP_LIBRARIES ${LIBCONFIG_CPP_LIBRARY})
+set(LIBCONFIG_INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libconfig++ LIBCONFIG_CPP_LIBRARIES LIBCONFIG_INCLUDE_DIRS)
+
+mark_as_advanced(LIBCONFIG_CPP_LIBRARIES LIBCONFIG_INCLUDE_DIRS)
diff --git a/cmake/Modules/FindLibconfig.cmake b/cmake/Modules/FindLibconfig.cmake
new file mode 100644
index 000000000..55d2a0fad
--- /dev/null
+++ b/cmake/Modules/FindLibconfig.cmake
@@ -0,0 +1,43 @@
+set(LIBCONFIG_SEARCH_PATH_LIST
+ ${LIBCONFIG_HOME}
+ $ENV{LIBCONFIG_HOME}
+ /usr/local
+ /opt
+ /usr
+)
+
+find_path(LIBCONFIG_INCLUDE_DIR libconfig.h
+ HINTS ${LIBCONFIG_SEARCH_PATH_LIST}
+ PATH_SUFFIXES include
+ DOC "Find the libconfig include"
+)
+
+if (WIN32)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ find_library(LIBCONFIG_LIBRARY NAMES libconfig.lib
+ HINTS ${LIBCONFIG_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib/x64
+ DOC "Find the libconfig libraries"
+ )
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ find_library(LIBCONFIG_LIBRARY NAMES libconfig.lib
+ HINTS ${LIBCONFIG_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib/x32
+ DOC "Find the libconfig libraries"
+ )
+ endif()
+else()
+ find_library(LIBCONFIG_LIBRARY NAMES config
+ HINTS ${LIBCONFIG_SEARCH_PATH_LIST}
+ PATH_SUFFIXES lib
+ DOC "Find the libconfig libraries"
+ )
+endif()
+
+set(LIBCONFIG_LIBRARIES ${LIBCONFIG_LIBRARY})
+set(LIBCONFIG_INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libconfig LIBCONFIG_LIBRARIES LIBCONFIG_INCLUDE_DIRS)
+
+mark_as_advanced(LIBCONFIG_LIBRARIES LIBCONFIG_INCLUDE_DIRS)
diff --git a/cmake/Modules/FindLibhicn.cmake b/cmake/Modules/FindLibhicn.cmake
index 38775be6a..5f241a6cd 100644
--- a/cmake/Modules/FindLibhicn.cmake
+++ b/cmake/Modules/FindLibhicn.cmake
@@ -44,7 +44,7 @@ find_library(HICN_LIBRARY NAMES hicn
set(HICN_LIBRARIES ${HICN_LIBRARY})
if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
-set(HICN_LIBRARIES ${HICN_LIBRARIES} log)
+ set(HICN_LIBRARIES ${HICN_LIBRARIES} log)
endif()
set(HICN_INCLUDE_DIRS ${HICN_INCLUDE_DIR})
diff --git a/cmake/Modules/GTestImport.cmake b/cmake/Modules/GTestImport.cmake
index 4e2e18dc9..d9d182578 100644
--- a/cmake/Modules/GTestImport.cmake
+++ b/cmake/Modules/GTestImport.cmake
@@ -18,6 +18,11 @@ include(ExternalProject)
ExternalProject_Add(gtest
URL https://github.com/google/googletest/archive/v1.10.x.zip
PREFIX ${CMAKE_BINARY_DIR}/gtest
+ BUILD_BYPRODUCTS
+ ${CMAKE_BINARY_DIR}/gtest/src/gtest-build/lib/libgmock_main.a
+ ${CMAKE_BINARY_DIR}/gtest/src/gtest-build/lib/libgmock.a
+ ${CMAKE_BINARY_DIR}/gtest/src/gtest-build/lib/libgtest_main.a
+ ${CMAKE_BINARY_DIR}/gtest/src/gtest-build/lib/libgtest.a
INSTALL_COMMAND ""
)
@@ -37,4 +42,4 @@ macro(add_test_internal test)
endif()
endmacro(add_test_internal)
-enable_testing() \ No newline at end of file
+enable_testing()
diff --git a/cmake/Modules/ServiceScript.cmake b/cmake/Modules/ServiceScript.cmake
index 110aa816b..8e7056a5a 100644
--- a/cmake/Modules/ServiceScript.cmake
+++ b/cmake/Modules/ServiceScript.cmake
@@ -39,4 +39,4 @@ cmake_parse_arguments(ARG
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr")
install (FILES ${script} DESTINATION ${SYSTEMD_SERVICE_FOLDER} COMPONENT ${ARG_COMPONENT})
endif()
-endmacro(install_service_script) \ No newline at end of file
+endmacro(install_service_script)