Git Product home page Git Product logo

gtest_ros_example's Introduction

The gtest_ros_example package

This is just a simple bootstraped gtest example inspired by ysonggit to test if applications build with gtest.

Tested with Ubuntu 16.04 and ROS Kinetic.

Build gtest

First of all one as to build gtest, because installing libgtest-dev under Ubuntu only gives you the sources.

sudo apt-get install libgtest-dev
mkdir /tmp/gtest_build && cd /tmp/gtest_build
cmake /usr/src/gtest
make
#copy or symlink libgtest.a and ligtest_main.a to /usr/lib folder
sudo cp *.a /usr/lib

Optional: It could happen that you work on a system where you do not have the rights to copy stuff into system folders. In this case, just create your own library folder for example in your home:

mkdir ~/lib
cp *.a ~/lib

In this case, you have to specify some environment variables before running catkin_make, which is discussed below.

Build this package

First checkout this repository into some src folder of a catkin workspace. Then just build the common execuatbles (which also include a application) via:

catkin_make

Catkin now builds rostalker, roslistener, and simple_test. simple_test is just a gtest example w/o any catkin magic (c.f. CMakeLists.txt). rostalker and roslistener don't have any gtest dependencies at all, and should build out of the box.

To build the test for the talker's add member function, call catkin like this:

catkin_make tests

Catkin now builds talker-test and simple_test_catkin. simple_test_catkin is just a gtest example w/ catkin magic (c.f. CMakeLists.txt).

Running executables

One can run any executable like this (don't forget the roscore):

rosrun gtest_ros_example <the executable name>

Link gtest from non-standard library folders

If one has to install the gtest libraries in some other folder (e.g. into ~/lib/), catkin has to be called like this:

LIBRARY_PATH=~/lib GTEST_ROOT=~/lib catkin_make

LIBRARY_PATH tells the linker where to find the libraries, while GTEST_ROOT gives cmake the location hints for it's checks.

gtest_ros_example's People

Contributors

tik0 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.