aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-12-06 18:25:28 +0100
committerMauro Sardara <msardara@cisco.com>2019-12-10 17:50:49 +0100
commit3f21100e1d2ec47b64670a8b08d0c9d067bf9ef3 (patch)
tree6774ce7f2bc020b646366503eaa6acf2f0af13eb /extras
parente8eda2c819b36555d9d6b080eaf8b4b1109d7646 (diff)
[HICN-430] Rework on CMake
Change way targets are defined: each project defines targets. Fix project BUILD flags Add build-extras bash script Rework build tree of extras folder, using ExternalProject_Add Change-Id: I82fa29896e54c8a033490eba013c3f0431bec9d0 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'extras')
-rw-r--r--extras/CMakeLists.txt33
-rw-r--r--extras/libmemif/CMakeLists.txt72
-rw-r--r--extras/libmemif/CMakeLists1.patch11
-rw-r--r--extras/libyang/CMakeLists.txt37
-rw-r--r--extras/libyang/libyang.patch60
-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.txt40
-rw-r--r--extras/sysrepo/sysrepo.patch9
22 files changed, 125 insertions, 157 deletions
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)