summaryrefslogtreecommitdiffstats
path: root/extras/sysrepo
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/sysrepo
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/sysrepo')
-rw-r--r--extras/sysrepo/CMakeLists.txt40
-rw-r--r--extras/sysrepo/sysrepo.patch9
2 files changed, 27 insertions, 22 deletions
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)