Commit f39c062a authored by Fernando Herrero's avatar Fernando Herrero
Browse files

Packaging updates: moved headers to include, set plural cmake variables,...

Packaging updates: moved headers to include, set plural cmake variables, install path changed from to /iri/libraryname, add debian package creation, package scripts
parent 77cb2c36
image: docker.io/alopeziri/labrobotica
stages:
- build
- test
- deploy
build-package:
stage: build
script:
- apt update
- apt -y install iri-iriutils-dev iri-comm-dev iri-dynamixel-dev
- mkdir -pv build
- cd build
- cmake -D CMAKE_BUILD_TYPE=RELEASE -DCPACK_PACKAGE_VERSION=$CI_COMMIT_TAG ..
- make package -j $(nproc)
artifacts:
paths:
- build/*.deb
expire_in: 2 weeks
only:
- tags
update_repo:
stage: deploy
script:
- cd build
- "scp -i /root/.ssh/iriLabKeyNopwd -r *battery-monitor*.deb irilabo@147.83.76.226:packages/"
- "ssh irilabo@147.83.76.226 -i /root/.ssh/iriLabKeyNopwd -tt /home/irilabo/repo_scripts/update_repo.sh name-with-dashes"
only:
- tags
......@@ -9,6 +9,7 @@ endif(COMMAND cmake_policy)
# The project name and the type of project
PROJECT(battery_monitor)
SET(PACKAGE_NAME battery-monitor)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
......@@ -65,4 +66,26 @@ ELSE(UNIX)
)
ENDIF(UNIX)
IF (UNIX)
SET(CPACK_PACKAGE_FILE_NAME "iri-${PACKAGE_NAME}-dev-${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
SET(CPACK_PACKAGE_NAME "iri-${PACKAGE_NAME}-dev")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Part of IRI-laboratory libraries. More information at https://gitlab.iri.upc.edu/labrobotica")
SET(CPACK_PACKAGING_INSTALL_PREFIX /usr)
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica - labrobotica@iri.upc.edu")
# Uncomment to add the necessary mantainer scripts
# 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")
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}), iri-dynamixel-dev (>= 1.0~${DISTRIB})")
INCLUDE(CPack)
ELSE(UNIX)
ADD_CUSTOM_COMMAND(
COMMENT "packaging only implemented in unix"
TARGET uninstall
)
ENDIF(UNIX)
#edit the following line to add the librarie's header files
FIND_PATH(battery_monitor_INCLUDE_DIR battery_monitor.h /usr/include/iri/battery_monitor /usr/local/include/iri/battery_monitor)
SET(name battery_monitor)
FIND_PATH(${name}_INCLUDE_DIRS ${name}.h /usr/include/iri/${name} /usr/local/include/iri/${name})
FIND_LIBRARY(battery_monitor_LIBRARY
NAMES battery_monitor
PATHS /usr/lib /usr/lib/iri/battery_monitor /usr/local/lib /usr/local/lib/iri/battery_monitor)
FIND_LIBRARY(${name}_LIBRARIES
NAMES ${name}
PATHS /usr/lib /usr/lib/iri/${name} /usr/local/lib /usr/local/lib/iri/${name})
SET(battery_monitor_INCLUDE_DIRS ${battery_monitor_INCLUDE_DIR})
SET(battery_monitor_LIBRARIES ${battery_monitor_LIBRARY})
SET(${name}_INCLUDE_DIR ${${name}_INCLUDE_DIRS})
SET(${name}_LIBRARY ${${name}_LIBRARIES})
IF (battery_monitor_INCLUDE_DIR AND battery_monitor_LIBRARY)
SET(battery_monitor_FOUND TRUE)
ENDIF (battery_monitor_INCLUDE_DIR AND battery_monitor_LIBRARY)
IF (${name}_INCLUDE_DIRS AND ${name}_LIBRARIES)
SET(${name}_FOUND TRUE)
ENDIF (${name}_INCLUDE_DIRS AND ${name}_LIBRARIES)
IF (battery_monitor_FOUND)
IF (NOT battery_monitor_FIND_QUIETLY)
MESSAGE(STATUS "Found battery_monitor: ${battery_monitor_LIBRARY}")
ENDIF (NOT battery_monitor_FIND_QUIETLY)
ELSE (battery_monitor_FOUND)
IF (battery_monitor_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find battery_monitor")
ENDIF (battery_monitor_FIND_REQUIRED)
ENDIF (battery_monitor_FOUND)
\ No newline at end of file
IF (${name}_FOUND)
IF (NOT ${name}_FIND_QUIETLY)
MESSAGE(STATUS "Found ${name}: ${${name}_LIBRARIES}")
ENDIF (NOT ${name}_FIND_QUIETLY)
ELSE (${name}_FOUND)
IF (${name}_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find ${name}")
ENDIF (${name}_FIND_REQUIRED)
ENDIF (${name}_FOUND)
#!/bin/bash
set -e
case "$1" in
configure)
#echo "I'm a postinst script"
;;
abort-upgrade)
;;
abort-remove)
;;
abort-deconfigure)
;;
esac
exit 0
#!/bin/bash
set -e
case "$1" in
remove)
#echo "I'm a postrm script"
;;
purge)
;;
upgrade)
;;
disappear)
;;
failed-upgrade)
;;
abort-install)
;;
abort-upgrade)
;;
esac
exit 0
#!/bin/bash
set -e
case "$1" in
install)
#echo "I'm a preinst script"
;;
upgrade)
;;
abort-upgrade)
;;
esac
exit 0
#!/bin/bash
set -e
case "$1" in
remove)
#echo "I'm a prerm script"
;;
upgrade)
;;
deconfigure)
;;
failed-upgrade)
;;
esac
exit 0
# driver source files
SET(sources battery_monitor.cpp)
# application header files
SET(headers battery_monitor.h)
SET(headers ../include/battery_monitor.h)
# locate the necessary dependencies
FIND_PACKAGE(iriutils REQUIRED)
......@@ -9,17 +9,17 @@ FIND_PACKAGE(comm REQUIRED)
FIND_PACKAGE(dynamixel REQUIRED)
# add the necessary include directories
INCLUDE_DIRECTORIES(.)
INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${comm_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${dynamixel_INCLUDE_DIR})
INCLUDE_DIRECTORIES(../include)
INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${comm_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${dynamixel_INCLUDE_DIRS})
# create the shared library
ADD_LIBRARY(battery_monitor SHARED ${sources})
TARGET_LINK_LIBRARIES(battery_monitor ${iriutils_LIBRARY})
TARGET_LINK_LIBRARIES(battery_monitor ${comm_LIBRARY})
TARGET_LINK_LIBRARIES(battery_monitor ${dynamixel_LIBRARY})
TARGET_LINK_LIBRARIES(battery_monitor ${iriutils_LIBRARIES})
TARGET_LINK_LIBRARIES(battery_monitor ${comm_LIBRARIES})
TARGET_LINK_LIBRARIES(battery_monitor ${dynamixel_LIBRARIES})
# link necessary libraries
INSTALL(TARGETS battery_monitor
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment