Skip to content

Commit e574c64

Browse files
committed
use catkin_add_hook for ROSLIB environment
1 parent 9d52b71 commit e574c64

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ project(rosruby)
33

44
find_package(catkin REQUIRED COMPONENTS)
55

6-
find_package(Ruby)
7-
86
catkin_package(
97
CATKIN_DEPENDS roslang rosgraph_msgs
108
DEPENDS ruby
@@ -44,6 +42,7 @@ endmacro()
4442

4543
rosruby_setup()
4644

45+
catkin_add_env_hooks(rosruby SHELLS sh DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks)
4746
rosruby_generate_messages(rosgraph_msgs std_msgs roscpp_tutorials)
4847

4948
add_custom_target(rosruby_devel_mkdir ALL

README.md

+8-18
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ If you want to use groovy,
2929
sudo apt-get install ros-groovy-rosruby
3030
```
3131

32-
and add RUBYLIB environmental variable.
33-
34-
```bash
35-
$ echo "export RUBYLIB=/opt/ros/groovy/lib/ruby/vendor_ruby" >> ~/.bashrc
36-
$ source ~/.bashrc
37-
```
38-
3932
Install from source
4033
---------------
4134
Install ROS and ruby first. ROS document is [http://ros.org/wiki/ROS/Installation](http://ros.org/wiki/ROS/Installation) .
@@ -50,21 +43,18 @@ $ cd ~/catkin_ws
5043
$ catkin_make
5144
```
5245

53-
please add RUBYLIB environment variable, like below (if you are using bash).
5446

55-
```bash
56-
$ echo "export RUBYLIB=~/catkin_ws/devel/lib/ruby/vendor_ruby" >> ~/.bashrc
57-
$ source ~/.bashrc
58-
```
59-
60-
if you want to use install environment, please edit develop -> install
47+
Message generation
48+
-----------------------
49+
You must generate ROS msg/srv files for rosruby.
50+
If you are using catkin package, it is easy.
51+
Please add below to your package CMakeLists.txt.
6152

62-
export RUBYLIB=~/catkin_ws/install/lib/ruby/vendor_ruby
53+
find_package(rosruby)
54+
rosruby_generate_messages(message_pkg1 message_okg2 ...)
6355

6456

65-
Message generation
66-
-----------------------
67-
You must generate ROS msg/srv files for rosruby manually.
57+
You can generate it manually. (not recomended)
6858
Please use the msg/srv generation script (rosruby_genmsg.py) in order to
6959
generage rosruby messages.
7060

env-hooks/rosruby.sh.em

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@[if DEVELSPACE]@
2+
# env variables in develspace
3+
export RUBYLIB="@(CATKIN_DEVEL_PREFIX)/@(CATKIN_GLOBAL_LIB_DESTINATION)/ruby/vendor_ruby":"$RUBYLIB"
4+
@[else]@
5+
# env variables in installspace
6+
export RUBYLIB="$CATKIN_ENV_HOOK_WORKSPACE/@(CATKIN_GLOBAL_LIB_DESTINATION)/ruby/vendor_ruby":"$RUBYLIB"
7+
@[end if]@

0 commit comments

Comments
 (0)