commit
b3de7d30f3
5 changed files with 148 additions and 25 deletions
|
@ -1,3 +1,6 @@
|
|||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
language: cpp
|
||||
|
||||
compiler:
|
||||
|
@ -8,5 +11,6 @@ before_install:
|
|||
- sudo apt-get install libboost-system-dev libboost-thread-dev
|
||||
|
||||
script:
|
||||
- cmake --version
|
||||
- cmake .
|
||||
- make
|
||||
|
|
122
CMakeLists.txt
122
CMakeLists.txt
|
@ -1,16 +1,30 @@
|
|||
cmake_minimum_required(VERSION 2.8.3)
|
||||
# After installation this project can be found by 'find_package(... CONFIG)' command:
|
||||
#
|
||||
# find_package(libcreate CONFIG REQUIRED)
|
||||
# target_link_libraries(... libcreate::create)
|
||||
#
|
||||
# Reference for this file:
|
||||
# https://github.com/forexample/package-example/blob/cf2ea1d6a209fb9eca2ab83fdd0ac15fe4d3e807/Foo/CMakeLists.txt
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
project(libcreate)
|
||||
|
||||
set(package_version 1.2.0)
|
||||
|
||||
find_package(Boost REQUIRED system thread)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
## Specify additional locations of header files
|
||||
#########
|
||||
# Build #
|
||||
#########
|
||||
|
||||
# Specify locations of header files
|
||||
include_directories(
|
||||
include
|
||||
)
|
||||
|
||||
## Declare cpp library
|
||||
add_library(create
|
||||
# Declare cpp library
|
||||
add_library(create SHARED
|
||||
src/create.cpp
|
||||
src/serial.cpp
|
||||
src/serial_stream.cpp
|
||||
|
@ -20,6 +34,15 @@ add_library(create
|
|||
src/types.cpp
|
||||
)
|
||||
|
||||
# Global includes. Used by all targets
|
||||
# * header can be included by C++ code `#include <create/create.h>`
|
||||
target_include_directories(
|
||||
create PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
|
||||
)
|
||||
|
||||
# Manually link to thread library for build on ARM
|
||||
if(THREADS_HAVE_PTHREAD_ARG)
|
||||
set_property(TARGET create PROPERTY COMPILE_OPTIONS "-pthread")
|
||||
set_property(TARGET create PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread")
|
||||
|
@ -29,16 +52,17 @@ if(CMAKE_THREAD_LIBS_INIT)
|
|||
target_link_libraries(create "${CMAKE_THREAD_LIBS_INIT}")
|
||||
endif()
|
||||
|
||||
# Link to Boost
|
||||
target_link_libraries(create
|
||||
${Boost_LIBRARIES}
|
||||
)
|
||||
|
||||
## Declare example executables
|
||||
# Declare example executables
|
||||
add_executable(create_demo examples/create_demo.cpp)
|
||||
add_executable(bumper_example examples/bumper_example.cpp)
|
||||
add_executable(odom_example examples/odom_example.cpp)
|
||||
|
||||
## Specify libraries to link a library or executable target against
|
||||
# Specify libraries to link executable targets against
|
||||
target_link_libraries(create_demo
|
||||
${Boost_LIBRARIES}
|
||||
create
|
||||
|
@ -52,13 +76,79 @@ target_link_libraries(odom_example
|
|||
create
|
||||
)
|
||||
|
||||
## Install
|
||||
install(TARGETS create DESTINATION lib)
|
||||
install(FILES
|
||||
include/create/create.h
|
||||
include/create/serial.h
|
||||
include/create/types.h
|
||||
include/create/data.h
|
||||
include/create/packet.h
|
||||
include/create/util.h
|
||||
DESTINATION include/create)
|
||||
###########
|
||||
# Install #
|
||||
###########
|
||||
|
||||
# Layout. This works for all platforms:
|
||||
# * <prefix>/lib/cmake/<PROJECT-NAME>
|
||||
# * <prefix>/lib/
|
||||
# * <prefix>/include/
|
||||
set(config_install_dir "lib/cmake/${PROJECT_NAME}")
|
||||
set(include_install_dir "include")
|
||||
|
||||
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
||||
|
||||
# Configuration
|
||||
set(version_config "${generated_dir}/${PROJECT_NAME}-config-version.cmake")
|
||||
set(project_config "${generated_dir}/${PROJECT_NAME}-config.cmake")
|
||||
set(targets_export_name "${PROJECT_NAME}-targets")
|
||||
set(namespace "${PROJECT_NAME}::")
|
||||
|
||||
# Include module with function 'write_basic_package_version_file'
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# Configure '<PROJECT-NAME>-config-version.cmake'
|
||||
write_basic_package_version_file(
|
||||
"${version_config}"
|
||||
VERSION "${package_version}"
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
# Configure '<PROJECT-NAME>-config.cmake'
|
||||
# Use variables:
|
||||
# * targets_export_name
|
||||
# * PROJECT_NAME
|
||||
configure_package_config_file(
|
||||
"config.cmake.in"
|
||||
"${project_config}"
|
||||
INSTALL_DESTINATION "${config_install_dir}"
|
||||
)
|
||||
|
||||
# Install targets
|
||||
install(
|
||||
TARGETS create
|
||||
EXPORT "${targets_export_name}"
|
||||
ARCHIVE DESTINATION "lib"
|
||||
LIBRARY DESTINATION "lib"
|
||||
RUNTIME DESTINATION "bin"
|
||||
INCLUDES DESTINATION "${include_install_dir}"
|
||||
)
|
||||
|
||||
# Install headers
|
||||
install(DIRECTORY include/create
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
# Install config
|
||||
# * <prefix>/lib/cmake/libcreate/libcreate-config.cmake
|
||||
# * <prefix>/lib/cmake/libcreate/libcreate-config-version.cmake
|
||||
install(
|
||||
FILES "${project_config}" "${version_config}"
|
||||
DESTINATION "${config_install_dir}"
|
||||
)
|
||||
|
||||
# Install config
|
||||
# * <prefix>/lib/cmake/libcreate/libcreate-targets.cmake
|
||||
install(
|
||||
EXPORT "${targets_export_name}"
|
||||
NAMESPACE "${namespace}"
|
||||
DESTINATION "${config_install_dir}"
|
||||
)
|
||||
|
||||
# Install package.xml (for catkin)
|
||||
install(FILES package.xml
|
||||
DESTINATION share/${PROJECT_NAME}
|
||||
)
|
||||
|
|
16
README.md
16
README.md
|
@ -1,6 +1,6 @@
|
|||
# libcreate
|
||||
# libcreate #
|
||||
|
||||
C++ library for interfacing with iRobot's [Create 1 and 2](http://www.irobot.com/About-iRobot/STEM/Create-2.aspx) as well as most models of Roombas. This library forms the basis of the ROS driver in [create_autonomy](https://github.com/autonomylab/create_autonomy).
|
||||
C++ library for interfacing with iRobot's [Create 1 and 2](http://www.irobot.com/About-iRobot/STEM/Create-2.aspx) as well as most models of Roomba. [create_autonomy](http://wiki.ros.org/create_autonomy) is a [ROS](http://www.ros.org/) wrapper for this library.
|
||||
|
||||
* Documentation: TODO
|
||||
* Code API: TODO
|
||||
|
@ -11,28 +11,28 @@ C++ library for interfacing with iRobot's [Create 1 and 2](http://www.irobot.com
|
|||
* Author: [Jacob Perron](http://jacobperron.ca) ([Autonomy Lab](http://autonomylab.org), [Simon Fraser University](http://www.sfu.ca))
|
||||
* Contributors: [Mani Monajjemi](http:mani.im), [Ben Wolsieffer](https://github.com/lopsided98)
|
||||
|
||||
## Dependencies
|
||||
## Dependencies ##
|
||||
|
||||
* [Boost System Library](http://www.boost.org/doc/libs/1_59_0/libs/system/doc/index.html)
|
||||
* [Boost Thread Library](http://www.boost.org/doc/libs/1_59_0/doc/html/thread.html)
|
||||
|
||||
## Install
|
||||
## Install ##
|
||||
|
||||
* `cmake CMakeLists.txt`
|
||||
* `make`
|
||||
* `sudo make install`
|
||||
|
||||
## Example
|
||||
## Example ##
|
||||
|
||||
See source for examples.
|
||||
|
||||
Example compile line: `g++ create_demo.cpp -lcreate -lboost_system -lboost_thread`
|
||||
|
||||
## Bugs
|
||||
## Known issues ##
|
||||
|
||||
* _Clock_ and _Schedule_ button presses are not detected. This is a known problem to the developers at iRobot.
|
||||
* _Clock_ and _Schedule_ buttons are not functional. This is a known bug related to the firmware.
|
||||
* Inaccurate odometry angle for Create 1 ([#22](https://github.com/AutonomyLab/libcreate/issues/22))
|
||||
|
||||
## Build Status
|
||||
## Build Status ##
|
||||
|
||||

|
||||
|
|
4
config.cmake.in
Normal file
4
config.cmake.in
Normal file
|
@ -0,0 +1,4 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
25
package.xml
Normal file
25
package.xml
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>libcreate</name>
|
||||
<version>1.2.0</version>
|
||||
<description>C++ library for interfacing with iRobot's Create 1 and Create 2</description>
|
||||
|
||||
<maintainer email="jperron@sfu.ca">Jacob Perron</maintainer>
|
||||
|
||||
<license>BSD</license>
|
||||
|
||||
<url type="website">http://wiki.ros.org/libcreate</url>
|
||||
|
||||
<author email="jperron@sfu.ca">Jacob Perron</author>
|
||||
|
||||
<buildtool_depend>cmake</buildtool_depend>
|
||||
|
||||
<build_depend>boost</build_depend>
|
||||
|
||||
<run_depend>boost</run_depend>
|
||||
<run_depend>catkin</run_depend>
|
||||
|
||||
<export>
|
||||
<build_type>cmake</build_type>
|
||||
</export>
|
||||
</package>
|
Loading…
Add table
Add a link
Reference in a new issue