diff options
-rw-r--r-- | CMakeLists.txt | 86 | ||||
-rw-r--r-- | apps/CMakeLists.txt | 4 | ||||
-rw-r--r-- | cmake/Modules/Packager.cmake | 2 | ||||
-rw-r--r-- | ctrl/facemgr/CMakeLists.txt | 5 | ||||
-rw-r--r-- | ctrl/libhicnctrl/CMakeLists.txt | 34 | ||||
-rw-r--r-- | ctrl/sysrepo-plugins/CMakeLists.txt | 34 | ||||
-rw-r--r-- | extras/CMakeLists.txt | 33 | ||||
-rw-r--r-- | extras/libmemif/CMakeLists.txt | 72 | ||||
-rw-r--r-- | extras/libmemif/CMakeLists1.patch | 11 | ||||
-rw-r--r-- | extras/libyang/CMakeLists.txt | 37 | ||||
-rw-r--r-- | extras/libyang/libyang.patch | 60 | ||||
-rw-r--r-- | extras/router-plugin/CMakeLists.txt (renamed from extras/hicn-extra-plugin/CMakeLists.txt) | 20 | ||||
-rw-r--r-- | extras/router-plugin/README.md (renamed from extras/hicn-extra-plugin/README.md) | 0 | ||||
-rw-r--r-- | extras/router-plugin/cmake/Modules/Packaging.cmake (renamed from extras/hicn-extra-plugin/cmake/Modules/Packaging.cmake) | 0 | ||||
-rw-r--r-- | extras/router-plugin/devices/rtnetlink/mapper.c (renamed from extras/hicn-extra-plugin/devices/rtnetlink/mapper.c) | 0 | ||||
-rw-r--r-- | extras/router-plugin/devices/rtnetlink/mapper.h (renamed from extras/hicn-extra-plugin/devices/rtnetlink/mapper.h) | 0 | ||||
-rw-r--r-- | extras/router-plugin/devices/rtnetlink/netns.c (renamed from extras/hicn-extra-plugin/devices/rtnetlink/netns.c) | 0 | ||||
-rw-r--r-- | extras/router-plugin/devices/rtnetlink/netns.h (renamed from extras/hicn-extra-plugin/devices/rtnetlink/netns.h) | 0 | ||||
-rw-r--r-- | extras/router-plugin/devices/rtnetlink/rtnl.c (renamed from extras/hicn-extra-plugin/devices/rtnetlink/rtnl.c) | 0 | ||||
-rw-r--r-- | extras/router-plugin/devices/rtnetlink/rtnl.h (renamed from extras/hicn-extra-plugin/devices/rtnetlink/rtnl.h) | 0 | ||||
-rw-r--r-- | extras/router-plugin/devices/rtnetlink/test.c (renamed from extras/hicn-extra-plugin/devices/rtnetlink/test.c) | 0 | ||||
-rw-r--r-- | extras/router-plugin/rtinject/tap_inject.c (renamed from extras/hicn-extra-plugin/rtinject/tap_inject.c) | 0 | ||||
-rw-r--r-- | extras/router-plugin/rtinject/tap_inject.h (renamed from extras/hicn-extra-plugin/rtinject/tap_inject.h) | 0 | ||||
-rw-r--r-- | extras/router-plugin/rtinject/tap_inject_netlink.c (renamed from extras/hicn-extra-plugin/rtinject/tap_inject_netlink.c) | 0 | ||||
-rw-r--r-- | extras/router-plugin/rtinject/tap_inject_node.c (renamed from extras/hicn-extra-plugin/rtinject/tap_inject_node.c) | 0 | ||||
-rw-r--r-- | extras/router-plugin/rtinject/tap_inject_tap.c (renamed from extras/hicn-extra-plugin/rtinject/tap_inject_tap.c) | 0 | ||||
-rw-r--r-- | extras/sysrepo/CMakeLists.txt | 40 | ||||
-rw-r--r-- | extras/sysrepo/sysrepo.patch | 9 | ||||
-rw-r--r-- | hicn-light/CMakeLists.txt | 7 | ||||
-rw-r--r-- | hicn-plugin/CMakeLists.txt | 9 | ||||
-rw-r--r-- | lib/CMakeLists.txt | 8 | ||||
-rw-r--r-- | libtransport/CMakeLists.txt | 24 | ||||
-rw-r--r-- | scripts/build-extras.sh (renamed from scripts/build-sysrepo.sh) | 44 | ||||
-rw-r--r-- | scripts/build-packages.sh | 40 | ||||
-rw-r--r-- | utils/CMakeLists.txt | 4 |
35 files changed, 281 insertions, 302 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 68b7e10ab..ab764906f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,10 +27,30 @@ option(BUILD_UTILS "Build the hicn utils" ON) option(BUILD_APPS "Build the hicn apps" OFF) option(BUILD_CTRL "Build the hicn control tools" ON) option(BUILD_HICNPLUGIN "Build the hicn vpp plugin" OFF) -option(BUILD_HICNEXTRAPLUGIN "Build the hicn extra plugin" OFF) option(BUILD_SYSREPOPLUGIN "Build the sysrepo plugin" OFF) -option(BUILD_SYSREPOP "Build the sysrepo plugin" OFF) -option(BUILD_LIBYANG "Build the sysrepo plugin" OFF) +option(BUILD_EXTRAS "Build external projects." OFF) + +if ((BUILD_APPS OR BUILD_UTILS) AND NOT BUILD_LIBTRANSPORT) + message(STATUS "Libhicntransport required. Enabled by default.") + set (BUILD_LIBTRANSPORT ON) +endif() + +if (BUILD_SYSREPOPLUGIN AND NOT BUILD_HICNPLUGIN) + message(STATUS "Hicn-plugin required. Enabled by default.") + set (BUILD_HICNPLUGIN ON) +endif() + +if ((BUILD_HICNLIGHT OR + BUILD_LIBTRANSPORT OR + BUILD_UTILS OR + BUILD_APPS OR + BUILD_CTRL OR + BUILD_HICNPLUGIN OR + BUILD_SYSREPOPLUGIN) + AND NOT BUILD_LIBHICN) + message(STATUS "Libhicn required. Enabled by default.") + set(BUILD_LIBHICN ON) +endif() list(APPEND dir_options BUILD_LIBHICN @@ -40,11 +60,8 @@ list(APPEND dir_options BUILD_UTILS BUILD_APPS BUILD_CTRL - BUILD_HICNEXTRAPLUGIN BUILD_SYSREPOPLUGIN - BUILD_SYSREPO - BUILD_LIBYANG - BUILD_LIBMEMIF + BUILD_EXTRAS ) set(BUILD_LIBHICN_DIR lib) @@ -55,11 +72,7 @@ set(BUILD_APPS_DIR apps) set(BUILD_CTRL_DIR ctrl) set(BUILD_HICNPLUGIN_DIR hicn-plugin) set(BUILD_SYSREPOPLUGIN_DIR ctrl/sysrepo-plugins) -set(BUILD_SYSREPO_DIR extras/sysrepo) -set(BUILD_LIBYANG_DIR extras/libyang) -set(BUILD_HICNEXTRAPLUGIN_DIR extras/hicn-extra-plugin) -set(BUILD_LIBMEMIF_DIR extras/libmemif) - +set(BUILD_EXTRAS_DIR extras/) ## Add enabled components foreach (opt ${dir_options}) @@ -70,55 +83,6 @@ foreach (opt ${dir_options}) endif() endforeach() -## Static targets -set(LIBHICN hicn) -set(HICN_LIGHT hicn-light) -set(HICN_LIGHT_CONTROL hicn-light-control) -set(HICN_LIGHT_DAEMON hicn-light-daemon) -set(HICN_PLUGIN hicn-plugin) -set(HICN_EXTRA_PLUGIN hicn-extra-plugin) -set(LIBTRANSPORT hicntransport) -set(HICN_UTILS hicn-utils) -set(HICNCTRL hicnctrl) -set(LIBHICNCTRL hicnctrl) -set(HICN_APPS hicn-apps) -set(LIBFACEMGR facemgr) -set(FACEMGR facemgr) -set(LIBMEMIF memif) - -if (BUILD_HICNPLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - find_package(Libmemif) - - if (NOT Libmemif_FOUND) - message(STATUS "Libmemif not found in the system. Building it as external project.") - list(INSERT subdirs 0 - ${BUILD_LIBMEMIF_DIR} - ) - - unset(LIBMEMIF_INCLUDE_DIRS) - unset(LIBMEMIF_LIBRARIES) - endif() - - set(LIBTRANSPORT ${LIBTRANSPORT}-memif) - set(LIBHICNCTRL ${LIBHICNCTRL}-memif) -endif() - -## Libraries targets -set(LIBHICN_SHARED ${LIBHICN}.shared) -set(LIBTRANSPORT_SHARED ${LIBTRANSPORT}.shared) -set(LIBHICNCTRL_SHARED ${LIBHICNCTRL}.shared) -set(LIBMEMIF_SHARED ${LIBMEMIF}.shared) - -set(LIBHICN_STATIC ${LIBHICN}.static) -set(LIBTRANSPORT_STATIC ${LIBTRANSPORT}.static) -set(LIBHICNCTRL_STATIC ${LIBHICNCTRL}.static) -set(LIBMEMIF_STATIC ${LIBMEMIF}.static) - -## HEADER FILES -set(HICN_INCLUDE_DIRS "" "" CACHE INTERNAL "" FORCE) -set(LIBTRANSPORT_INCLUDE_DIRS "" "" CACHE INTERNAL "" FORCE) -set(LIBHICNCTRL_INCLUDE_DIRS "" "" CACHE INTERNAL "" FORCE) - if (NOT WIN32) add_compile_options(-Wall -Werror) endif () diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index c74be92ba..1778ba557 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -25,11 +25,12 @@ set(CMAKE_MODULE_PATH include(BuildMacros) include(WindowsMacros) +set(HICN_APPS hicn-apps CACHE INTERNAL "" FORCE) + if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) find_package(Libtransport REQUIRED) find_package(Threads REQUIRED) include_directories(${LIBTRANSPORT_INCLUDE_DIRS}) - set(HICN_APPS hicn-apps) else() if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") find_package(OpenSSL REQUIRED) @@ -38,6 +39,7 @@ else() else () set(LIBTRANSPORT_LIBRARIES ${LIBTRANSPORT_SHARED}) endif () + list(APPEND DEPENDENCIES ${LIBTRANSPORT_LIBRARIES} ) diff --git a/cmake/Modules/Packager.cmake b/cmake/Modules/Packager.cmake index 56221fcca..fdda9a203 100644 --- a/cmake/Modules/Packager.cmake +++ b/cmake/Modules/Packager.cmake @@ -55,7 +55,7 @@ macro(extract_version) message(STATUS "Git describe output: ${VER}") - string(REGEX REPLACE "v([0-9]+).([0-9]+)-([0-9]+)-(g[0-9a-f]+)" "\\1;\\2;\\3;\\4" VER ${VER}) + string(REGEX REPLACE "v([0-9]+).([0-9]+).*-([0-9]+)-(g[0-9a-f]+)" "\\1;\\2;\\3;\\4" VER ${VER}) list(GET VER 0 VERSION_MAJOR) list(GET VER 1 VERSION_MINOR) list(GET VER 2 VERSION_REVISION) diff --git a/ctrl/facemgr/CMakeLists.txt b/ctrl/facemgr/CMakeLists.txt index 63a5f3c84..db40eade3 100644 --- a/ctrl/facemgr/CMakeLists.txt +++ b/ctrl/facemgr/CMakeLists.txt @@ -62,11 +62,12 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) find_package_wrapper(Config REQUIRED) find_package_wrapper(LibEvent REQUIRED) +set(FACEMGR facemgr CACHE INTERNAL "" FORCE) +set(LIBFACEMGR facemgr CACHE INTERNAL "" FORCE) + if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) find_package_wrapper(Libhicn REQUIRED) find_package_wrapper(Libhicnctrl REQUIRED) - set(FACEMGR facemgr) - set(LIBFACEMGR facemgr) else() if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") set(HICN_LIBRARIES ${LIBHICN_STATIC} log) diff --git a/ctrl/libhicnctrl/CMakeLists.txt b/ctrl/libhicnctrl/CMakeLists.txt index 08441075b..d0a4bbef3 100644 --- a/ctrl/libhicnctrl/CMakeLists.txt +++ b/ctrl/libhicnctrl/CMakeLists.txt @@ -33,22 +33,29 @@ set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_MACOSX_RPATH ON) + +set(LIBHICNCTRL hicnctrl) + +if (BUILD_HICNPLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set(LIBHICNCTRL ${LIBHICNCTRL}-memif PARENT_SCOPE) + set(LINK_FLAGS "-Wl,-unresolved-symbols=ignore-in-shared-libs") + list(APPEND HICN_LIBRARIES ${HICNPLUGIN_LIBRARIES}) +endif() + +set(LIBHICNCTRL ${LIBHICNCTRL} CACHE INTERNAL "" FORCE) +set(LIBHICNCTRL_SHARED ${LIBHICNCTRL}.shared CACHE INTERNAL "" FORCE) +set(LIBHICNCTRL_STATIC ${LIBHICNCTRL}.static CACHE INTERNAL "" FORCE) +set(HICNCTRL hicnctrl CACHE INTERNAL "" FORCE) +set(LIBHICNCTRL_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/includes CACHE INTERNAL "" FORCE) + if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(HICNCTRL hicnctrl) - set(LIBHICNCTRL hicnctrl) if (BUILD_HICNPLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - set(LIBHICNCTRL ${LIBHICNCTRL}-memif) find_package_wrapper(HicnPlugin REQUIRED) - list(APPEND HICN_LIBRARIES ${HICNPLUGIN_LIBRARIES}) - set(LINK_FLAGS "-Wl,-unresolved-symbols=ignore-in-shared-libs") endif() find_package_wrapper(Libhicn REQUIRED) list(APPEND HICN_LIBRARIES ${LIBHICN_SHARED}) - set(LIBHICNCTRL_SHARED ${LIBHICNCTRL}.shared) - set(LIBHICNCTRL_STATIC ${LIBHICNCTRL}.static) - set(HICN_INCLUDE_DIRS ${HICN_INCLUDE_DIRS} ${HICNPLUGIN_INCLUDE_DIRS}) @@ -60,12 +67,11 @@ else() ${LIBHICN_STATIC} ) elseif (BUILD_HICNPLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - set(HICN_INCLUDE_DIRS - ${HICN_INCLUDE_DIRS} - ${HICNPLUGIN_INCLUDE_DIRS}) - - set(HICN_LIBRARIES ${HICNPLUGIN_LIBRARIES}) - set(LINK_FLAGS "-Wl,-unresolved-symbols=ignore-in-shared-libs") + set( + HICN_INCLUDE_DIRS + ${HICN_INCLUDE_DIRS} + ${HICNPLUGIN_INCLUDE_DIRS} + ) list(APPEND DEPENDENCIES hicn_plugin diff --git a/ctrl/sysrepo-plugins/CMakeLists.txt b/ctrl/sysrepo-plugins/CMakeLists.txt index d87319f06..1a9bca18c 100644 --- a/ctrl/sysrepo-plugins/CMakeLists.txt +++ b/ctrl/sysrepo-plugins/CMakeLists.txt @@ -26,30 +26,34 @@ include(BuildMacros) find_package(PkgConfig REQUIRED) find_package(Sysrepo REQUIRED) +if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + message(FATAL_ERROR "Sysrepo plugin supported only on Linux systems") +endif() + if (NOT SRPD_PLUGINS_PATH) - if (PKG_CONFIG_FOUND) - execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} "--variable=SRPD_PLUGINS_PATH" "libsysrepo" OUTPUT_VARIABLE SRPD_PLUGINS_PATH) - string(STRIP ${SRPD_PLUGINS_PATH} SRPD_PLUGINS_PATH) - endif() + if (PKG_CONFIG_FOUND) + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} "--variable=SRPD_PLUGINS_PATH" "libsysrepo" OUTPUT_VARIABLE SRPD_PLUGINS_PATH) + string(STRIP ${SRPD_PLUGINS_PATH} SRPD_PLUGINS_PATH) + endif() endif() + if (NOT SRPD_PLUGINS_PATH) - message(FATAL_ERROR "Cannot get sysrepo plugins directory due to missing pkg-config, set SRPD_PLUGINS_PATH manually.") + message(FATAL_ERROR "Cannot get sysrepo plugins directory due to missing pkg-config, set SRPD_PLUGINS_PATH manually.") endif() if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - find_package(Vpp REQUIRED) - find_package(HicnPlugin REQUIRED) - find_package(Libhicn REQUIRED) - add_subdirectory(hicn-plugin) + find_package(Vpp REQUIRED) + find_package(HicnPlugin REQUIRED) + find_package(Libhicn REQUIRED) else() - if (BUILD_HICNPLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - list(APPEND DEPENDENCIES - hicn_plugin) - add_subdirectory(hicn-plugin) - endif () + list(APPEND DEPENDENCIES + ${LIBHICN_SHARED} + ${LIBHICN_STATIC} + hicn_plugin + ) endif() -# add subdirectories +add_subdirectory(hicn-plugin) include(Packaging) if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) diff --git a/extras/CMakeLists.txt b/extras/CMakeLists.txt new file mode 100644 index 000000000..71a598326 --- /dev/null +++ b/extras/CMakeLists.txt @@ -0,0 +1,33 @@ +# 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. + +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) + +project(extras) + +list(APPEND CMAKE_MODULE_PATH + ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules +) + +set (DESTDIR ${CMAKE_BINARY_DIR}/extras-root) + +add_subdirectory(router-plugin) +add_subdirectory(libmemif) +add_subdirectory(libyang) +add_subdirectory(sysrepo) + + +if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + include(Packager) + make_packages() +endif()
\ No newline at end of file diff --git a/extras/libmemif/CMakeLists.txt b/extras/libmemif/CMakeLists.txt index 3b2b87729..8d141510a 100644 --- a/extras/libmemif/CMakeLists.txt +++ b/extras/libmemif/CMakeLists.txt @@ -11,58 +11,34 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(CMAKE_MODULE_PATH - ${CMAKE_MODULE_PATH} - "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Modules" - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" -) - -include(ExternalProject) -include(Packaging) - -if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(LIBMEMIF memif) -endif() - -execute_process( - COMMAND bash -c "if [ ! -d vpp ]; then - git clone https://github.com/FDio/vpp.git -b stable/1908 --depth 1 vpp; - else - pushd vpp && git pull && popd; - fi" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) +cmake_minimum_required(VERSION 3.5) +project(libmemif) -execute_process( - COMMAND ${CMAKE_COMMAND} -E - remove_directory ${CMAKE_CURRENT_BINARY_DIR}/libmemif - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) - -execute_process( - COMMAND ${CMAKE_COMMAND} -E - copy_directory vpp/extras/libmemif ${CMAKE_CURRENT_BINARY_DIR}/libmemif - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +list(APPEND MODULE_PATH + ${CMAKE_MODULE_PATH} + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules ) -execute_process( - COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/libmemif/src - ${CMAKE_CURRENT_BINARY_DIR}/libmemif/memif - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) +string(REPLACE ";" "|" MODULE_PATH "${MODULE_PATH}") -execute_process( - COMMAND - ${CMAKE_COMMAND} -E - copy ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists1.patch libmemif/CMakeLists.txt - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) +include(ExternalProject) -execute_process( - COMMAND ${CMAKE_COMMAND} -E - copy ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists2.patch libmemif/memif/CMakeLists.txt - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +ExternalProject_Add(libmemif + GIT_REPOSITORY https://github.com/FDio/vpp.git + GIT_TAG v19.08.1 + GIT_SHALLOW TRUE + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libmemif + PATCH_COMMAND bash -c "cp ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists1.patch ./extras/libmemif/CMakeLists.txt && cp ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists2.patch ./extras/libmemif/src/CMakeLists.txt" + # Use the alternate list separator + # (https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#lists) + LIST_SEPARATOR | + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_MODULE_PATH=${MODULE_PATH} + SOURCE_SUBDIR ./extras/libmemif + BUILD_COMMAND make package + INSTALL_COMMAND make DESTDIR=${DESTDIR} install ) -include(Packaging) -add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/libmemif ${CMAKE_CURRENT_BINARY_DIR}/libmemif)
\ No newline at end of file +if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + include(Packager) + make_packages() +endif() diff --git a/extras/libmemif/CMakeLists1.patch b/extras/libmemif/CMakeLists1.patch index 012dc606c..91da8a7c9 100644 --- a/extras/libmemif/CMakeLists1.patch +++ b/extras/libmemif/CMakeLists1.patch @@ -16,7 +16,9 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(memif) set(CMAKE_C_STANDARD 11) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +list(APPEND CMAKE_MODULE_PATH + ${CMAKE_CURRENT_SOURCE_DIR}/cmake +) include(CheckCCompilerFlag) include(CheckFunctionExists) @@ -62,4 +64,9 @@ set(LIBMEMIF_LIBRARIES "" FORCE ) -add_subdirectory(memif)
\ No newline at end of file +add_subdirectory(src) + +if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + include(Packager) + make_packages() +endif()
\ No newline at end of file diff --git a/extras/libyang/CMakeLists.txt b/extras/libyang/CMakeLists.txt index 734e14641..70218f643 100644 --- a/extras/libyang/CMakeLists.txt +++ b/extras/libyang/CMakeLists.txt @@ -10,35 +10,32 @@ # 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 2.8) +cmake_minimum_required(VERSION 3.5) project(libyang) -set(CMAKE_MODULE_PATH +list(APPEND MODULE_PATH ${CMAKE_MODULE_PATH} - "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Modules" - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules ) -include(ExternalProject) -include(Packaging) +string(REPLACE ";" "|" MODULE_PATH "${MODULE_PATH}") -if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(LIBYANG libyang) -endif() +include(ExternalProject) -execute_process( - COMMAND bash -c "if [ ! -d libyang ]; then - git clone https://github.com/CESNET/libyang.git -b devel --depth 1 libyang; - cd libyang; git apply ${CMAKE_CURRENT_SOURCE_DIR}/libyang.patch; - else - pushd libyang && git pull && popd; - fi" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +ExternalProject_Add(libyang + GIT_REPOSITORY https://github.com/CESNET/libyang.git + GIT_TAG devel + GIT_SHALLOW TRUE + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libyang + PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/libyang.patch + # Use the alternate list separator + # (https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#lists) + LIST_SEPARATOR | + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_MODULE_PATH=${MODULE_PATH} + BUILD_COMMAND make package + INSTALL_COMMAND make DESTDIR=${DESTDIR} install ) -add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/libyang ${CMAKE_CURRENT_BINARY_DIR}/libyang) - -include(Packaging) if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) include(Packager) make_packages() diff --git a/extras/libyang/libyang.patch b/extras/libyang/libyang.patch index b5e5c8858..ac6a63746 100644 --- a/extras/libyang/libyang.patch +++ b/extras/libyang/libyang.patch @@ -1,28 +1,16 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 19b7eb96..6567851f 100644 +index 3e0fe79..037d60b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -1,5 +1,11 @@ - cmake_minimum_required(VERSION 2.8.12) - -+set(CMAKE_MODULE_PATH -+ ${CMAKE_MODULE_PATH} -+ "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" -+) -+ -+ - # force out-of-source build - if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "In-source build is not allowed. Please make a standalone build directory and run CMake from there. You may need to remove CMakeCache.txt.") -@@ -306,14 +312,14 @@ find_package(PCRE REQUIRED) +@@ -317,14 +317,14 @@ find_package(PCRE REQUIRED) include_directories(${PCRE_INCLUDE_DIRS}) target_link_libraries(yang ${PCRE_LIBRARIES}) - + -install(TARGETS yang DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install(FILES ${headers} ${PROJECT_BINARY_DIR}/src/libyang.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libyang) +install(TARGETS yang DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libyang) +install(FILES ${headers} ${PROJECT_BINARY_DIR}/src/libyang.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libyang COMPONENT libyang) - + find_package(PkgConfig) if(PKG_CONFIG_FOUND) # generate and install pkg-config file @@ -32,7 +20,7 @@ index 19b7eb96..6567851f 100644 # check that pkg-config includes the used path execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable pc_path pkg-config RESULT_VARIABLE RETURN OUTPUT_VARIABLE PC_PATH ERROR_QUIET) if(RETURN EQUAL 0) -@@ -399,14 +405,14 @@ configure_file(${PROJECT_SOURCE_DIR}/src/plugin_config.h.in ${PROJECT_BINARY_DIR +@@ -410,14 +410,14 @@ configure_file(${PROJECT_SOURCE_DIR}/src/plugin_config.h.in ${PROJECT_BINARY_DIR # yanglint add_executable(yanglint ${lintsrc}) target_link_libraries(yanglint yang) @@ -40,7 +28,7 @@ index 19b7eb96..6567851f 100644 -install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) +install(TARGETS yanglint DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libyang) +install(FILES ${PROJECT_SOURCE_DIR}/tools/lint/yanglint.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT libyang) - + #yangre add_executable(yangre ${resrc}) target_link_libraries(yangre yang) @@ -48,43 +36,15 @@ index 19b7eb96..6567851f 100644 -install(FILES ${PROJECT_SOURCE_DIR}/tools/re/yangre.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) +install(TARGETS yangre DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libyang) +install(FILES ${PROJECT_SOURCE_DIR}/tools/re/yangre.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT libyang) - + # yang2yin add_executable(yang2yin ${yang2yinsrc}) -@@ -435,3 +441,10 @@ endif(ENABLE_BUILD_FUZZ_TARGETS) +@@ -446,3 +446,8 @@ endif(ENABLE_BUILD_FUZZ_TARGETS) if(GEN_LANGUAGE_BINDINGS AND GEN_CPP_BINDINGS) add_subdirectory(swig) endif() + + +include(Packaging) -+if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) -+ include(Packager) -+ make_packages() -+endif() -diff --git a/src/extensions/CMakeLists.txt b/src/extensions/CMakeLists.txt -index e2c18b5e..48885302 100644 ---- a/src/extensions/CMakeLists.txt -+++ b/src/extensions/CMakeLists.txt -@@ -2,7 +2,7 @@ macro(EXTENSION_PLUGIN PLUGIN_NAME SRCS) - add_library(${PLUGIN_NAME} SHARED ${SRCS}) - set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "") - target_link_libraries(${PLUGIN_NAME} yang) -- install(TARGETS ${PLUGIN_NAME} DESTINATION ${EXTENSIONS_PLUGINS_DIR_MACRO}) -+ install(TARGETS ${PLUGIN_NAME} DESTINATION ${EXTENSIONS_PLUGINS_DIR_MACRO} COMPONENT libyang) - endmacro(EXTENSION_PLUGIN) - - foreach(EXTENSION ${EXTENSIONS_LIST}) -diff --git a/src/user_types/CMakeLists.txt b/src/user_types/CMakeLists.txt -index 74aae322..e5f67bd7 100644 ---- a/src/user_types/CMakeLists.txt -+++ b/src/user_types/CMakeLists.txt -@@ -2,7 +2,7 @@ macro(USER_TYPE_PLUGIN PLUGIN_NAME SRCS) - add_library(${PLUGIN_NAME} SHARED ${SRCS}) - set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "") - target_link_libraries(${PLUGIN_NAME} yang) -- install(TARGETS ${PLUGIN_NAME} DESTINATION ${USER_TYPES_PLUGINS_DIR_MACRO}) -+ install(TARGETS ${PLUGIN_NAME} DESTINATION ${USER_TYPES_PLUGINS_DIR_MACRO} COMPONENT libyang) - endmacro(USER_TYPE_PLUGIN) - - foreach(USER_TYPE ${USER_TYPE_LIST}) ++include(Packager) ++make_packages() diff --git a/extras/hicn-extra-plugin/CMakeLists.txt b/extras/router-plugin/CMakeLists.txt index 6147afa1b..bbff755d4 100644 --- a/extras/hicn-extra-plugin/CMakeLists.txt +++ b/extras/router-plugin/CMakeLists.txt @@ -12,7 +12,7 @@ # limitations under the License. cmake_minimum_required(VERSION 3.5 FATAL_ERROR) -project(extra-plugin) +project(router-plugin) include(GNUInstallDirs) @@ -21,21 +21,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/" ) -set (CMAKE_CXX_STANDARD 11) set (CMAKE_C_STANDARD 11) include (Packaging) -# Check for memfd_create syscall -include(CheckSymbolExists) -CHECK_SYMBOL_EXISTS ( "__NR_memfd_create" "sys/syscall.h" HAVE_MEMFD_CREATE ) -if ( HAVE_MEMFD_CREATE ) - add_definitions ( -DHAVE_MEMFD_CREATE ) -endif() - -if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(HICN_EXTRA_PLUGIN extra-plugin) -endif() +set(HICN_EXTRA_PLUGIN hicn-router-plugin) # Dependencies @@ -84,7 +74,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DEXTRA_VPP_PLUGIN=1") -add_library(hicn_extra_plugin SHARED +add_library(hicn_router_plugin SHARED ${HICN_EXTRA_PLUGIN_SOURCE_FILES} ) @@ -92,7 +82,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins) set(VPP_INSTALL_PLUGIN ${EXTRA_INSTALL_PREFIX}/vpp_plugins) -set_target_properties(hicn_extra_plugin +set_target_properties(hicn_router_plugin PROPERTIES LINKER_LANGUAGE C INSTALL_RPATH ${VPP_INSTALL_PLUGIN} @@ -105,7 +95,7 @@ install(DIRECTORY COMPONENT ${HICN_EXTRA_PLUGIN} ) -install(TARGETS hicn_extra_plugin +install(TARGETS hicn_router_plugin DESTINATION ${VPP_INSTALL_PLUGIN} COMPONENT ${HICN_EXTRA_PLUGIN} diff --git a/extras/hicn-extra-plugin/README.md b/extras/router-plugin/README.md index 40363ef18..40363ef18 100644 --- a/extras/hicn-extra-plugin/README.md +++ b/extras/router-plugin/README.md diff --git a/extras/hicn-extra-plugin/cmake/Modules/Packaging.cmake b/extras/router-plugin/cmake/Modules/Packaging.cmake index 69f63971f..69f63971f 100644 --- a/extras/hicn-extra-plugin/cmake/Modules/Packaging.cmake +++ b/extras/router-plugin/cmake/Modules/Packaging.cmake diff --git a/extras/hicn-extra-plugin/devices/rtnetlink/mapper.c b/extras/router-plugin/devices/rtnetlink/mapper.c index ed4fa5634..ed4fa5634 100644 --- a/extras/hicn-extra-plugin/devices/rtnetlink/mapper.c +++ b/extras/router-plugin/devices/rtnetlink/mapper.c diff --git a/extras/hicn-extra-plugin/devices/rtnetlink/mapper.h b/extras/router-plugin/devices/rtnetlink/mapper.h index 32e95d48f..32e95d48f 100644 --- a/extras/hicn-extra-plugin/devices/rtnetlink/mapper.h +++ b/extras/router-plugin/devices/rtnetlink/mapper.h diff --git a/extras/hicn-extra-plugin/devices/rtnetlink/netns.c b/extras/router-plugin/devices/rtnetlink/netns.c index 19adb469a..19adb469a 100644 --- a/extras/hicn-extra-plugin/devices/rtnetlink/netns.c +++ b/extras/router-plugin/devices/rtnetlink/netns.c diff --git a/extras/hicn-extra-plugin/devices/rtnetlink/netns.h b/extras/router-plugin/devices/rtnetlink/netns.h index 53effe5ce..53effe5ce 100644 --- a/extras/hicn-extra-plugin/devices/rtnetlink/netns.h +++ b/extras/router-plugin/devices/rtnetlink/netns.h diff --git a/extras/hicn-extra-plugin/devices/rtnetlink/rtnl.c b/extras/router-plugin/devices/rtnetlink/rtnl.c index ed3db9e72..ed3db9e72 100644 --- a/extras/hicn-extra-plugin/devices/rtnetlink/rtnl.c +++ b/extras/router-plugin/devices/rtnetlink/rtnl.c diff --git a/extras/hicn-extra-plugin/devices/rtnetlink/rtnl.h b/extras/router-plugin/devices/rtnetlink/rtnl.h index 3f96252c1..3f96252c1 100644 --- a/extras/hicn-extra-plugin/devices/rtnetlink/rtnl.h +++ b/extras/router-plugin/devices/rtnetlink/rtnl.h diff --git a/extras/hicn-extra-plugin/devices/rtnetlink/test.c b/extras/router-plugin/devices/rtnetlink/test.c index 031748dd3..031748dd3 100644 --- a/extras/hicn-extra-plugin/devices/rtnetlink/test.c +++ b/extras/router-plugin/devices/rtnetlink/test.c diff --git a/extras/hicn-extra-plugin/rtinject/tap_inject.c b/extras/router-plugin/rtinject/tap_inject.c index f41ae86c8..f41ae86c8 100644 --- a/extras/hicn-extra-plugin/rtinject/tap_inject.c +++ b/extras/router-plugin/rtinject/tap_inject.c diff --git a/extras/hicn-extra-plugin/rtinject/tap_inject.h b/extras/router-plugin/rtinject/tap_inject.h index ec5121a09..ec5121a09 100644 --- a/extras/hicn-extra-plugin/rtinject/tap_inject.h +++ b/extras/router-plugin/rtinject/tap_inject.h diff --git a/extras/hicn-extra-plugin/rtinject/tap_inject_netlink.c b/extras/router-plugin/rtinject/tap_inject_netlink.c index a221e8eaa..a221e8eaa 100644 --- a/extras/hicn-extra-plugin/rtinject/tap_inject_netlink.c +++ b/extras/router-plugin/rtinject/tap_inject_netlink.c diff --git a/extras/hicn-extra-plugin/rtinject/tap_inject_node.c b/extras/router-plugin/rtinject/tap_inject_node.c index 73c296451..73c296451 100644 --- a/extras/hicn-extra-plugin/rtinject/tap_inject_node.c +++ b/extras/router-plugin/rtinject/tap_inject_node.c diff --git a/extras/hicn-extra-plugin/rtinject/tap_inject_tap.c b/extras/router-plugin/rtinject/tap_inject_tap.c index a3ec9ffef..a3ec9ffef 100644 --- a/extras/hicn-extra-plugin/rtinject/tap_inject_tap.c +++ b/extras/router-plugin/rtinject/tap_inject_tap.c diff --git a/extras/sysrepo/CMakeLists.txt b/extras/sysrepo/CMakeLists.txt index 071c7f5bd..c4b74e07b 100644 --- a/extras/sysrepo/CMakeLists.txt +++ b/extras/sysrepo/CMakeLists.txt @@ -10,37 +10,33 @@ # 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 2.8) +cmake_minimum_required(VERSION 3.5) project(sysrepo) -set(CMAKE_MODULE_PATH +list(APPEND MODULE_PATH ${CMAKE_MODULE_PATH} - "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Modules" - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules" + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules ) -include(ExternalProject) -include(Packaging) +string(REPLACE ";" "|" MODULE_PATH "${MODULE_PATH}") -if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(SYSREPO sysrepo) -endif() +include(ExternalProject) -execute_process( - COMMAND bash -c "if [ ! -d sysrepo ]; then - git clone https://github.com/sysrepo/sysrepo.git -b devel --depth 1 sysrepo; - cd sysrepo; git apply ${CMAKE_CURRENT_SOURCE_DIR}/sysrepo.patch; - else - pushd sysrepo && git pull && popd; - fi" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +ExternalProject_Add(sysrepo + GIT_REPOSITORY https://github.com/sysrepo/sysrepo.git + GIT_TAG devel + GIT_SHALLOW TRUE + DEPENDS libyang + PREFIX ${CMAKE_CURRENT_BINARY_DIR}/sysrepo + PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/sysrepo.patch + # Use the alternate list separator + # (https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#lists) + LIST_SEPARATOR | + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_MODULE_PATH=${MODULE_PATH} -DBUILD_EXAMPLES=OFF -DCMAKE_PREFIX_PATH=${DESTDIR}/usr + BUILD_COMMAND make package + INSTALL_COMMAND make DESTDIR=${DESTDIR} install ) -add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/sysrepo ${CMAKE_CURRENT_BINARY_DIR}/sysrepo) - - -include(Packaging) if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) include(Packager) make_packages() diff --git a/extras/sysrepo/sysrepo.patch b/extras/sysrepo/sysrepo.patch index 3412c5e17..ef3fa510d 100644 --- a/extras/sysrepo/sysrepo.patch +++ b/extras/sysrepo/sysrepo.patch @@ -14,6 +14,15 @@ index 181387b0..356bf32c 100644 # osx specific set(CMAKE_MACOSX_RPATH TRUE) +@@ -81,7 +86,7 @@ endif() + option(GEN_LANGUAGE_BINDINGS "Enable library bindings for different languages." OFF) + + option(GEN_CPP_BINDINGS "Enable C++ bindings." ON) +-option(BUILD_CPP_EXAMPLES "Enable C++ example application compilation." ON) ++option(BUILD_CPP_EXAMPLES "Enable C++ example application compilation." OFF) + + option(GEN_PYTHON_BINDINGS "Enable Python bindings." ON) + option(ENABLE_PYTHON_TESTS "Enable Python tests." ON) @@ -206,13 +211,13 @@ add_executable(sysrepo-plugind ${SYSREPOPLUGIND_SRC}) target_link_libraries(sysrepo-plugind sysrepo dl) diff --git a/hicn-light/CMakeLists.txt b/hicn-light/CMakeLists.txt index 14a7b9710..41eeb5d84 100644 --- a/hicn-light/CMakeLists.txt +++ b/hicn-light/CMakeLists.txt @@ -52,11 +52,12 @@ include(WindowsMacros) find_package_wrapper(Libparc REQUIRED) +set(HICN_LIGHT hicn-light CACHE INTERNAL "" FORCE) +set(HICN_LIGHT_CONTROL ${HICN_LIGHT}-control CACHE INTERNAL "" FORCE) +set(HICN_LIGHT_DAEMON ${HICN_LIGHT}-daemon CACHE INTERNAL "" FORCE) + if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) find_package_wrapper(Libhicn REQUIRED) - set(HICN_LIGHT hicn-light) - set(HICN_LIGHT_CONTROL ${HICN_LIGHT}-control) - set(HICN_LIGHT_DAEMON ${HICN_LIGHT}-daemon) else() if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") set(HICN_LIBRARIES ${LIBHICN_STATIC} log) diff --git a/hicn-plugin/CMakeLists.txt b/hicn-plugin/CMakeLists.txt index e0b06663f..01ac26c7c 100644 --- a/hicn-plugin/CMakeLists.txt +++ b/hicn-plugin/CMakeLists.txt @@ -31,9 +31,7 @@ if ( HAVE_MEMFD_CREATE ) add_definitions ( -DHAVE_MEMFD_CREATE ) endif() -if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(HICN_PLUGIN hicn-plugin) -endif() +set(HICN_PLUGIN hicn-plugin CACHE INTERNAL "" FORCE) include (Packaging) @@ -314,5 +312,6 @@ install(FILES ${HICN_VAPI_GENERATED_FILES} #Set variables for other project depending on hicn-plugin set(HICNPLUGIN_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins PARENT_SCOPE) -set(HICNPLUGIN_LIBRARIES ${VPP_LIBRARIES} PARENT_SCOPE)
\ No newline at end of file + ${CMAKE_CURRENT_BINARY_DIR}/vpp_plugins + CACHE INTERNAL "" FORCE) +set(HICNPLUGIN_LIBRARIES ${VPP_LIBRARIES} CACHE INTERNAL "" FORCE)
\ No newline at end of file diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 4df09c0dd..3cc40bb7f 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -26,10 +26,10 @@ if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() -if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(LIBHICN hicn) - set(LIBHICN_STATIC ${LIBHICN}.static) -endif() +set(LIBHICN hicn CACHE INTERNAL "" FORCE) +set(LIBHICN_SHARED ${LIBHICN}.shared CACHE INTERNAL "" FORCE) +set(LIBHICN_STATIC ${LIBHICN}.static CACHE INTERNAL "" FORCE) +set(HICN_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/includes CACHE INTERNAL "" FORCE) include (Packaging) diff --git a/libtransport/CMakeLists.txt b/libtransport/CMakeLists.txt index 690b86cd8..cc302d09a 100644 --- a/libtransport/CMakeLists.txt +++ b/libtransport/CMakeLists.txt @@ -55,8 +55,10 @@ set(TRANSPORT_INTERFACES ${TRANSPORT_ROOT_PATH}/interfaces) # Install includes set(INSTALL_INCLUDE_DIR include/hicn/transport) +set(LIBTRANSPORT hicntransport) if ((BUILD_HICNPLUGIN OR BUILD_MEMIF_CONNECTOR) AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") set(__vpp__ 1) + set(LIBTRANSPORT ${LIBTRANSPORT}-memif) find_package(Vpp REQUIRED) list(APPEND LIBTRANSPORT_INTERNAL_INCLUDE_DIRS @@ -64,18 +66,24 @@ if ((BUILD_HICNPLUGIN OR BUILD_MEMIF_CONNECTOR) AND "${CMAKE_SYSTEM_NAME}" STREQ ) endif () +set(LIBTRANSPORT ${LIBTRANSPORT} CACHE INTERNAL "" FORCE) +set(LIBTRANSPORT_SHARED ${LIBTRANSPORT}.shared CACHE INTERNAL "" FORCE) +set(LIBTRANSPORT_STATIC ${LIBTRANSPORT}.static CACHE INTERNAL "" FORCE) +set(LIBTRANSPORT_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src CACHE INTERNAL "" FORCE) + include(WindowsMacros) include(IosMacros) find_package_wrapper(Libparc REQUIRED) find_package_wrapper(Asio REQUIRED) +if (__vpp__) + find_package(Libmemif REQUIRED) +endif() + if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(LIBTRANSPORT hicntransport) if (__vpp__) find_package(HicnPlugin REQUIRED) - find_package(Libmemif REQUIRED) find_package(Libhicnctrl REQUIRED) - set(LIBTRANSPORT ${LIBTRANSPORT}-memif) list(APPEND LIBRARIES ${LIBMEMIF_LIBRARIES} @@ -84,9 +92,6 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) endif() find_package_wrapper(Libhicn REQUIRED) - - set(LIBTRANSPORT_SHARED ${LIBTRANSPORT}.shared) - set(LIBTRANSPORT_STATIC ${LIBTRANSPORT}.static) else() if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") set(HICN_LIBRARIES ${LIBHICN_STATIC} log) @@ -105,12 +110,6 @@ else() ${LIBHICNCTRL_SHARED} ) - if (NOT Libmemif_FOUND) - list(APPEND DEPENDENCIES - ${LIBMEMIF_SHARED} - ) - endif() - set(LIBHICNCTRL_LIBRARIES ${LIBHICNCTRL_SHARED}) list(APPEND LIBRARIES ${LIBMEMIF_LIBRARIES} @@ -121,6 +120,7 @@ endif() list(APPEND LIBTRANSPORT_INTERNAL_INCLUDE_DIRS ${LIBMEMIF_INCLUDE_DIRS} + ${LIBHICNCTRL_INCLUSE_DIRS} ) include(Packaging) diff --git a/scripts/build-sysrepo.sh b/scripts/build-extras.sh index e51b25f4a..17e443890 100644 --- a/scripts/build-sysrepo.sh +++ b/scripts/build-extras.sh @@ -18,7 +18,6 @@ SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P ) APT_PATH=`which apt-get` || true apt_get=${APT_PATH:-"/usr/local/bin/apt-get"} - PACKAGECLOUD_RELEASE_REPO_DEB="https://packagecloud.io/install/repositories/fdio/release/script.deb.sh" PACKAGECLOUD_RELEASE_REPO_RPM="https://packagecloud.io/install/repositories/fdio/release/script.rpm.sh" @@ -30,10 +29,18 @@ VPP_VERSION_RPM="19.08.1-release.x86_64" BUILD_TOOLS_UBUNTU="build-essential doxygen" LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev" -DEPS_UBUNTU="hicn-light libhicn-dev libhicnctrl libhicnctrl-dev hicn-plugin hicn-plugin-dev libvppinfra=${VPP_VERSION_DEB} libvppinfra-dev=${VPP_VERSION_DEB} vpp=${VPP_VERSION_DEB} vpp-dev=${VPP_VERSION_DEB} vpp-plugin-core=${VPP_VERSION_DEB}" +DEPS_UBUNTU="libvppinfra=${VPP_VERSION_DEB} \ + libvppinfra-dev=${VPP_VERSION_DEB} \ + vpp=${VPP_VERSION_DEB} \ + vpp-dev=${VPP_VERSION_DEB} \ + vpp-plugin-core=${VPP_VERSION_DEB}" # BUILD_TOOLS_GROUP_CENTOS="'Development Tools'" -DEPS_CENTOS="vpp-devel-${VPP_VERSION_RPM} vpp-lib-${VPP_VERSION_RPM} libparc-devel asio-devel centos-release-scl devtoolset-7" +DEPS_CENTOS="vpp-devel-${VPP_VERSION_RPM} \ + vpp-lib-${VPP_VERSION_RPM} \ + centos-release-scl \ + devtoolset-7" + LATEST_EPEL_REPO="http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" install_cmake() { @@ -47,7 +54,6 @@ install_cmake() { CMAKE_INSTALL_SCRIPT="/tmp/install_cmake.sh" curl ${CMAKE_INSTALL_SCRIPT_URL} > ${CMAKE_INSTALL_SCRIPT} - sudo mkdir -p /opt/cmake sudo bash ${CMAKE_INSTALL_SCRIPT} --skip-license --prefix=/opt/cmake export PATH=/opt/cmake/bin:${PATH} @@ -73,7 +79,7 @@ setup_fdio_repo() { fi } - setup() { +setup() { # Figure out what system we are running on if [ -f /etc/os-release ]; then . /etc/os-release @@ -132,26 +138,22 @@ build_package() { mkdir -p build && pushd build rm -rf * - cmake -DCMAKE_INSTALL_PREFIX=/usr ${SCRIPT_PATH}/../extras/libyang - make install + cmake -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_LIBHICN=OFF \ + -DBUILD_UTILS=OFF \ + -DBUILD_HICNPLUGIN=OFF \ + -DBUILD_HICNLIGHT=OFF \ + -DBUILD_LIBTRANSPORT=OFF \ + -DBUILD_APPS=OFF \ + -DBUILD_CTRL=OFF \ + -DBUILD_SYSREPOPLUGIN=OFF \ + -DBUILD_EXTRAS=ON \ + ${SCRIPT_PATH}/.. make package - find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true + find . -type d -iname '_CPack_Packages' -print0 | xargs -0 rm -rf -- || true rm *Unspecified* || true - cmake -DCMAKE_INSTALL_PREFIX=/usr ${SCRIPT_PATH}/../extras/sysrepo - make install - make package - - find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true - rm *Unspecified* || true - - cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_HICNPLUGIN=ON -DBUILD_HICNLIGHT=OFF \ - -DBUILD_LIBTRANSPORT=OFF -DBUILD_UTILS=OFF -DBUILD_CTRL=OFF \ - -DBUILD_SYSREPOPLUGIN=ON ${SCRIPT_PATH}/.. - make install - make package - popd echo "*******************************************************************" diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh index 76aa7b389..2205d6277 100644 --- a/scripts/build-packages.sh +++ b/scripts/build-packages.sh @@ -29,12 +29,43 @@ VPP_VERSION_RPM="19.08.1-release.x86_64" BUILD_TOOLS_UBUNTU="build-essential doxygen" LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev" -DEPS_UBUNTU="libparc-dev libasio-dev libconfig-dev libcurl4-openssl-dev vpp=${VPP_VERSION_DEB} vpp-dev=${VPP_VERSION_DEB} libvppinfra=${VPP_VERSION_DEB} libvppinfra-dev=${VPP_VERSION_DEB} vpp-plugin-core=${VPP_VERSION_DEB} python3-ply" +DEPS_UBUNTU="libparc-dev \ + libmemif-dev \ + libmemif \ + libasio-dev \ + libconfig-dev \ + libcurl4-openssl-dev \ + vpp=${VPP_VERSION_DEB} \ + vpp-dev=${VPP_VERSION_DEB} \ + libvppinfra=${VPP_VERSION_DEB} \ + libvppinfra-dev=${VPP_VERSION_DEB} \ + vpp-plugin-core=${VPP_VERSION_DEB} \ + python3-ply" + DEPS_CMAKE_UBUNTU="curl" # BUILD_TOOLS_GROUP_CENTOS="'Development Tools'" -DEPS_CENTOS="vpp-devel-${VPP_VERSION_RPM} vpp-lib-${VPP_VERSION_RPM} libparc-devel libcurl-devel asio-devel libconfig-devel centos-release-scl devtoolset-7" -DEPS_CENTOS_NOVERSION="vpp-devel vpp-lib libparc-devel libcurl-devel asio-devel centos-release-scl devtoolset-7" +DEPS_CENTOS="vpp-devel-${VPP_VERSION_RPM} \ + vpp-lib-${VPP_VERSION_RPM} \ + libparc-devel \ + libmemif-devel \ + libmemif \ + libcurl-devel \ + asio-devel \ + libconfig-devel \ + centos-release-scl \ + devtoolset-7" + +DEPS_CENTOS_NOVERSION="vpp-devel \ + vpp-lib \ + libparc-devel \ + libcurl-devel \ + asio-devel \ + libmemif-devel \ + libmemif \ + centos-release-scl \ + devtoolset-7" + LATEST_EPEL_REPO="http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" install_cmake() { @@ -143,11 +174,10 @@ build_package() { cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_APPS=ON ${SCRIPT_PATH}/.. make -j8 package - rm -rf libtransport + rm -rf libtransport ctrl/libctrl cmake -DCMAKE_INSTALL_PREFIX=/usr \ -DBUILD_HICNPLUGIN=ON \ - -DBUILD_HICNEXTRAPLUGIN=ON \ -DBUILD_LIBTRANSPORT=ON \ -DBUILD_APPS=ON \ ${SCRIPT_PATH}/.. diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 0e5430356..3216582c2 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -30,9 +30,10 @@ endif () include(BuildMacros) include(WindowsMacros) +set(HICN_UTILS hicn-utils CACHE INTERNAL "" FORCE) + if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) find_package(Libtransport REQUIRED) - set(HICN_UTILS hicn-utils) else() if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") set(LIBTRANSPORT_LIBRARIES ${LIBTRANSPORT_STATIC}) @@ -45,6 +46,7 @@ else() endif() set(SUFFIX "") +message("~~~~~~~~~~~~~~~~~~~~~~> ${LIBTRANSPORT_LIBRARIES}") if (${LIBTRANSPORT_LIBRARIES} MATCHES ".*-memif.*") set(SUFFIX "-memif") set(LINK_FLAGS "-Wl,-unresolved-symbols=ignore-in-shared-libs") |