Commit f441ebf5 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Merge branch 'packaging'

parents cb443ded 44db200b
image: docker.io/labrobotica/labrobotica
stages:
- build
- test
- deploy
build-package:
stage: build
script:
# Uncomment to install dependencies
# - apt update
# - apt -y install iri-<package_name>-dev
- apt update
- apt -y install iri-iriutils-dev iri-comm-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 *bno055-imu-driver*.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 bno055-imu-driver"
only:
- tags
......@@ -9,6 +9,7 @@ endif(COMMAND cmake_policy)
# The project name and the type of project
PROJECT(bno055_imu_driver)
SET(PACKAGE_NAME bno055-imu-driver)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib)
......@@ -65,4 +66,38 @@ ELSE(UNIX)
)
ENDIF(UNIX)
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
SET (X86 TRUE)
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
ELSE ()
SET (X86 FALSE)
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
ENDIF()
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/labrobotica_how_to")
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}/package_scripts/preinst;${CMAKE_SOURCE_DIR}/package_scripts/postinst;${CMAKE_SOURCE_DIR}/package_scripts/prerm;${CMAKE_SOURCE_DIR}/package_scripts/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})")
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(bno055_imu_driver_INCLUDE_DIR bno055_imu_driver.h /usr/include/iridrivers /usr/local/include/iridrivers)
FIND_PATH(bno055_imu_driver_INCLUDE_DIRS bno055_imu_driver.h bno055_imu_exceptions.h bno055_common.h bno055_imu_sim.h /usr/local/include/iri/bno055_imu_driver /usr/include/iri/bno055_imu_driver)
FIND_LIBRARY(bno055_imu_driver_LIBRARY
FIND_LIBRARY(bno055_imu_driver_LIBRARIES_aux
NAMES bno055_imu_driver
PATHS /usr/lib /usr/local/lib /usr/local/lib/iridrivers)
PATHS /usr/local/lib/iri/bno055_imu_driver /usr/lib/iri/bno055_imu_driver)
IF (bno055_imu_driver_INCLUDE_DIR AND bno055_imu_driver_LIBRARY)
FIND_LIBRARY(bno055_imu_sim_LIBRARIES_aux
NAMES bno055_imu_sim
PATHS /usr/local/lib/iri/bno055_imu_driver /usr/lib/iri/bno055_imu_driver)
IF (bno055_imu_driver_LIBRARIES_aux AND bno055_imu_sim_LIBRARIES_aux)
SET(bno055_imu_driver_LIBRARIES ${bno055_imu_driver_LIBRARIES_aux} ${bno055_imu_sim_LIBRARIES_aux})
ELSE (bno055_imu_driver_LIBRARIES_aux AND bno055_imu_sim_LIBRARIES_aux)
MESSAGE(FATAL_ERROR "Could not find bn055_imu_driver ${bno055_imu_driver_LIBRARIES_aux} or bno055_imu_sim ${bno055_imu_sim_LIBRARIES_aux}")
ENDIF (bno055_imu_driver_LIBRARIES_aux AND bno055_imu_sim_LIBRARIES_aux)
SET(bno055_imu_driver_INCLUDE_DIR ${bno055_imu_driver_INCLUDE_DIRS})
SET(bno055_imu_driver_LIBRARY ${bno055_imu_driver_LIBRARIES})
IF (bno055_imu_driver_INCLUDE_DIRS AND bno055_imu_driver_LIBRARIES)
SET(bno055_imu_driver_FOUND TRUE)
ENDIF (bno055_imu_driver_INCLUDE_DIR AND bno055_imu_driver_LIBRARY)
ENDIF (bno055_imu_driver_INCLUDE_DIRS AND bno055_imu_driver_LIBRARIES)
IF (bno055_imu_driver_FOUND)
IF (NOT bno055_imu_driver_FIND_QUIETLY)
MESSAGE(STATUS "Found bno055_imu_driver: ${bno055_imu_driver_LIBRARY}")
MESSAGE(STATUS "Found bno055_imu_driver: ${bno055_imu_driver_LIBRARIES}")
ENDIF (NOT bno055_imu_driver_FIND_QUIETLY)
ELSE (bno055_imu_driver_FOUND)
IF (bno055_imu_driver_FIND_REQUIRED)
......
BNO055_imu_driver {#mainpage}
=================
Bno055\_imu\_driver library {#mainpage}
## Description
This is a C++ driver for the [BNO055 IMU](https://www.bosch-sensortec.com/products/smart-sensors/bno055.html) from Bosch. This driver implements all the features of the sensor, and provides support for all operation modes.
This is a driver library for a [bno055 imu sensor](https://www.bosch-sensortec.com/bst/products/all_products/bno055).
This driver provides a set of functions to configure and get the information provided by the sensor.
## Installation
* Add the labrobotica repository if it is not already added:
``` sudo sh -c 'echo "deb [arch=amd64] http://147.83.76.226/~irilabo/packages xenial main" > /etc/apt/sources.list.d/labrobotica_repo.list' ```
``` wget -O - http://147.83.76.226/~irilabo/labrobotica_repo.gpg.key | sudo apt-key add - ```
* Install the package:
``` sudo apt update && sudo apt install iri-bno055-imu-driver-dev ```
## Disclaimer
Copyright (C) 2009-2019 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
Mantainer IRI labrobotics (labrobotica@iri.upc.edu)
This package is distributed in the hope that it will be useful, but without any warranty. It is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. should the program prove defective, the GMR group does not assume the cost of any necessary servicing, repair or correction.
In no event unless required by applicable law the author will be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if the author has been advised of the possibility of such damages.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
## For developers
<details><summary>click here</summary>
<p>
## Dependencies
This package requires of the following system libraries and packages
* [cmake](https://www.cmake.org "CMake's Homepage"), a cross-platform build system.
* [doxygen](http://www.doxygen.org "Doxygen's Homepage") and [graphviz](http://www.graphviz.org "Graphviz's Homepage") to generate the documentation.
* stdc++ and pthread libraries.
* [cmake](https://www.cmake.org "CMake's Homepage"), a cross-platform build system.
* [doxygen](http://www.doxygen.org "Doxygen's Homepage") and [graphviz](http://www.graphviz.org "Graphviz's Homepage") to generate the documentation.
* stdc++.
All this packages can be installed in Ubuntu using the apt-get install command.
Under linux all of these utilities are available in ready-to-use packages.
This package also requires of the following IRI libraries:
Under MacOS most of the packages are available via [fink](http://www.finkproject.org/ "Fink's Homepage")
* [iriutils](https://gitlab.iri.upc.edu/labrobotica/algorithms/iriutils), a library with basic tools developed a IRI.
* [comm](https://gitlab.iri.upc.edu/labrobotica/drivers/comm), a library with drivers for basic communication interfaces developed at IRI.
This package also requires of the following IRI libraries:
To install all these dependencies, follow the instructions on the corresponding links.
* [iriutils](https://gitlab.iri.upc.edu/labrobotica/algorithms/iriutils "iriutils gitlab page"), a set of basic tools.
* [comm](https://gitlab.iri.upc.edu/labrobotica/drivers/comm "comm gitlab page"), a set of drivers for standard communication devices.
## Compilation and installation
Download this repository and create a build folder inside:
Clone this repository and create a build folder inside:
``` mkdir build ```
......@@ -39,7 +68,7 @@ The RELEASE build mode optimizes for speed. To build in this mode execute instea
The release mode will be kept until next time cmake is executed.
``` make ```
``` make -j $(nproc)```
In case no errors are reported, the generated libraries (if any) will be located at the
_lib_ folder and the executables (if any) will be located at the _bin_ folder.
......@@ -49,9 +78,9 @@ To do that, execute
``` make install ```
as root and the shared libraries will be copied to */usr/local/lib/iridrivers* directory
and the header files will be copied to */usr/local/include/iridrivers* dierctory. At
this point, the library may be used by any user.
as root and the shared libraries will be copied to */usr/local/lib/iri/bno055_imu_driver* directory
and the header files will be copied to */usr/local/include/iri/bno055_imu_driver* dierctory.
At this point, the library may be used by any user.
To remove the library from the system, exceute
......@@ -71,21 +100,16 @@ To use this library in an other library or application, in the CMakeLists.txt fi
In the case that the package is present, it is necessary to add the header files directory to the include directory path by using
``` INCLUDE_DIRECTORIES(${bno055_imu_driver_INCLUDE_DIR}) ```
``` INCLUDE_DIRECTORIES(bno055_imu_driver_INCLUDE_DIRS}) ```
and it is also necessary to link with the desired libraries by using the following command
``` TARGET_LINK_LIBRARIES(<executable name> ${bno055_imu_driver_LIBRARY}) ```
## Disclaimer
## Examples
Copyright (C) 2009-2018 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
Mantainer IRI labrobotics (labrobotica@iri.upc.edu)
This package is distributed in the hope that it will be useful, but without any warranty. It is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. should the program prove defective, the GMR group does not assume the cost of any necessary servicing, repair or correction.
In no event unless required by applicable law the author will be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if the author has been advised of the possibility of such damages.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
There is an example called _bno055\_imu\_driver\_test_.
In this example the imu is calibrated and is printed on the terminal all the information received.
</p>
</details>
# driver source files
SET(sources bno055_imu_driver.cpp bno055_imu_exceptions.cpp)
# application header files
SET(headers bno055_imu_driver.h bno055_imu_exceptions.h bno055_common.h)
SET(headers ../include/bno055_imu_driver.h ../include/bno055_imu_exceptions.h ../include/bno055_common.h)
# locate the necessary dependencies
FIND_PACKAGE(iriutils REQUIRED)
FIND_PACKAGE(comm REQUIRED)
# add the necessary include directories
INCLUDE_DIRECTORIES(.)
INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${comm_INCLUDE_DIR})
INCLUDE_DIRECTORIES(../include)
INCLUDE_DIRECTORIES(${iriutils_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${comm_INCLUDE_DIRS})
# create the shared library
ADD_LIBRARY(bno055_imu_driver SHARED ${sources})
# link necessary libraries
TARGET_LINK_LIBRARIES(bno055_imu_driver ${iriutils_LIBRARY})
TARGET_LINK_LIBRARIES(bno055_imu_driver ${comm_LIBRARY})
TARGET_LINK_LIBRARIES(bno055_imu_driver ${iriutils_LIBRARIES})
TARGET_LINK_LIBRARIES(bno055_imu_driver ${comm_LIBRARIES})
INSTALL(TARGETS bno055_imu_driver
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib/iridrivers
ARCHIVE DESTINATION lib/iridrivers)
INSTALL(FILES ${headers} DESTINATION include/iridrivers)
LIBRARY DESTINATION lib/iri/${PROJECT_NAME}
ARCHIVE DESTINATION lib/iri/${PROJECT_NAME})
INSTALL(FILES ${headers} DESTINATION include/iri/${PROJECT_NAME})
INSTALL(FILES ../Findbno055_imu_driver.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
ADD_SUBDIRECTORY(examples)
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