From 96076682fc97d5588e63f2b569fc8a034f0ee7f5 Mon Sep 17 00:00:00 2001 From: fherrero <fherrero@iri.upc.edu> Date: Tue, 19 May 2020 11:39:54 +0200 Subject: [PATCH] Add dependencies (expected from IRI) to CMakeLists as CPACK_DEBIAN_PACKAGE_DEPENDS and to .gitlab-ci.yml as apt -y install iri-name-dev --- .gitlab-ci_template.yml | 2 +- CMakeLists_template.txt | 4 ++-- new_project.sh | 30 ++++++++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci_template.yml b/.gitlab-ci_template.yml index 6044eb9..046cc25 100644 --- a/.gitlab-ci_template.yml +++ b/.gitlab-ci_template.yml @@ -15,7 +15,7 @@ #- git submodule update --init --recursive - apt update ##Install dependencies - #- apt -y install iri-iriutils-dev iri-comm-dev iri-dynamixel-dev + #- apt -y install iri-dep1-dev iri-dep2-dev - mkdir -pv build - cd build - cmake -DCMAKE_BUILD_TYPE=RELEASE -DCPACK_PACKAGE_VERSION=$CI_COMMIT_TAG .. diff --git a/CMakeLists_template.txt b/CMakeLists_template.txt index 636978d..dcccd30 100755 --- a/CMakeLists_template.txt +++ b/CMakeLists_template.txt @@ -80,8 +80,8 @@ IF (UNIX) #SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/scripts/debian/preinst;${CMAKE_SOURCE_DIR}/scripts/debian/postinst;${CMAKE_SOURCE_DIR}/scripts/debian/prerm;${CMAKE_SOURCE_DIR}/scripts/debian/postrm") #Uncomment to add dependencies comma separated - #SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-<package_name>-dev (>= 1.0~${DISTRIB})") - #SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-iriutils-dev (>= 1.0~${DISTRIB}), iri-comm-dev (>= 1.0~${DISTRIB})") + #SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-dep1-dev (>= 1.0~${DISTRIB}), iri-dep2-dev (>= 1.0~${DISTRIB})") + INCLUDE(CPack) ELSE(UNIX) ADD_CUSTOM_COMMAND( diff --git a/new_project.sh b/new_project.sh index 84fadb0..21d0188 100755 --- a/new_project.sh +++ b/new_project.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash DEP= TYPE= @@ -204,6 +204,20 @@ else rm temp1.txt fi +#Add to CMakeLists.txt line wit dependencies like SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-dep1-dev (>= 1.0~${DISTRIB}), iri-dep2-dev (>= 1.0~${DISTRIB})") +cpack_depends="SET(CPACK_DEBIAN_PACKAGE_DEPENDS \"" +for x in $arr +do + dep_line="iri-$x-dev (>= 1.0~\${DISTRIB})" + cpack_depends="$cpack_depends$dep_line, " +done +cpack_depends=${cpack_depends%??} #remove last ', ' +cpack_depends="$cpack_depends\")" +line_to_add="\ \ $cpack_depends" +file=./CMakeLists.txt +comment="#Uncomment to add dependencies comma separated" +sed -i "/${comment}/ a ${line_to_add}" ${file} + rm CMakeLists_test_template.txt rm CMakeLists_template.txt @@ -341,6 +355,18 @@ fi sed 's/library-name/'$NAME_WITH_DASHES'/g' <.gitlab-ci_template.yml >./.gitlab-ci.yml +#Add to .gitlab-ci.yml apt install dependencies like - apt -y install iri-dep1-dev iri-dep2-dev +apt_deps="" +for x in $arr +do + dep_line="iri-$x-dev" + apt_deps="$apt_deps$dep_line " +done +line_to_add="\ \ \ \ \ \ - apt -y install $apt_deps" +file=./.gitlab-ci.yml +comment="##Install dependencies" +sed -i "/${comment}/ a ${line_to_add}" ${file} + if [ $TEST = 1 ] then Library_name=$(echo $NAME | sed 's/\([a-zA-Z]\)\([a-zA-Z0-9]*\)/\u\1\2/g') @@ -360,4 +386,4 @@ rm driver_example_src_template.cpp rm Findlib_template.cmake rm .gitlab-ci_template.yml rm new_project.sh -rm -rf .git +rm -rf .git \ No newline at end of file -- GitLab