Skip to content

Commit 7ec7572

Browse files
lucapa17traversaro
andauthored
Add install step (#44)
* add install plugins to CMakeLists files * add install step to CI * change the name of libHandler.so to gz-sim-yarp-handler * enable rpath * include GNUInstallDirs module * delete DESTINATION parameters * Update README.md * Update README of tutorials * Update README.md * Update README.md Co-authored-by: Silvio Traversaro <silvio@traversaro.it> --------- Co-authored-by: Silvio Traversaro <silvio@traversaro.it>
1 parent 011f6fd commit 7ec7572

File tree

21 files changed

+163
-72
lines changed

21 files changed

+163
-72
lines changed

.github/workflows/apt.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ jobs:
120120
env:
121121
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
122122

123-
# This is commented until we fix https://github.com/robotology/gz-yarp-plugins/issues/28
124-
# - name: Install
125-
# run: |
126-
# cd build
127-
# cmake --build . --config ${{ matrix.build_type }} --target install
123+
124+
- name: Install
125+
run: |
126+
cd build
127+
cmake --build . --config ${{ matrix.build_type }} --target install
128128

.github/workflows/conda-forge.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ jobs:
8282
cd build
8383
ctest -E "^LaserTest|^CameraTest" --repeat until-pass:5 --output-on-failure -C ${{ matrix.build_type }} .
8484
85-
# This is commented until we fix https://github.com/robotology/gz-yarp-plugins/issues/28
86-
# - name: Install
87-
# run: |
88-
# cd build
89-
# cmake --build . --config ${{ matrix.build_type }} --target install
85+
- name: Install
86+
run: |
87+
cd build
88+
cmake --build . --config ${{ matrix.build_type }} --target install

CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,21 @@ set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})
1212
gz_find_package(gz-sim7 REQUIRED)
1313
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})
1414

15+
# Defines the CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR and many other useful macros.
16+
# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
17+
include(GNUInstallDirs)
18+
1519
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
1620
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
1721
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
1822

23+
# Enable RPATH support for installed binaries and libraries
24+
include(AddInstallRPATHSupport)
25+
add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_FULL_BINDIR}"
26+
LIB_DIRS "${CMAKE_INSTALL_FULL_LIBDIR}"
27+
INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}"
28+
USE_LINK_PATH)
29+
1930
# Support shared libraries on Windows
2031
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
2132

README.md

+18-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
**This repository contains a preliminary work in progress of integration of Modern Gazebo (gz) and YARP devices, a port of some functionalities of https://github.com/robotology/gazebo-yarp-plugins to Modern Gazebo. The repo is working in progress, and public interfaces can change without warning.**
44

5-
## Install/Uninstall Gazebo Garden
5+
## Quick start
6+
- [Install Gazebo Garden](#install_gazebo)
7+
- [Install YARP](#install_yarp)
8+
- [Install gz-sim-yarp-plugins](#install_gz-sim-yarp-plugins)
9+
10+
11+
### <a name="install_gazebo"></a> Install Gazebo Garden
612
#### Binary Installation in Ubuntu (or WSL)
713
First install some necessary tools:
814
```
@@ -21,7 +27,7 @@ sudo apt-get install gz-garden
2127
sudo apt remove gz-garden && sudo apt autoremove
2228
```
2329

24-
## Install YARP
30+
### <a name="install_yarp"></a> Install YARP
2531

2632
#### Binary Installation in Ubuntu (or WSL)
2733
```
@@ -35,10 +41,18 @@ sudo apt install yarp
3541
sudo apt remove yarp && sudo apt autoremove
3642
```
3743

38-
## Compilation
44+
## <a name="install_gz-sim-yarp-plugins"></a> Install gz-sim-yarp-plugins
3945
~~~
4046
mkdir build
4147
cd build
42-
cmake ..
48+
cmake -DCMAKE_INSTALL_PREFIX=<desired_install_prefix> ..
4349
make
50+
make install
4451
~~~
52+
To notify Gazebo of the new plugins compiled, it is necessary to modify the GZ_SIM_SYSTEM_PLUGIN_PATH environment variable:
53+
```
54+
export GZ_SIM_SYSTEM_PLUGIN_PATH=${GZ_SIM_SYSTEM_PLUGIN_PATH}:/path/to/the/install/folder/lib
55+
```
56+
where `/path/to/the/install/folder/lib` is the directory containing the `libgz-sim-yarp-forcetorque-system.so`, `libgz-sim-yarp-camera-system.so`... files (by default `/usr/local/lib`)
57+
58+
To avoid having to modify this environment variable each time, you can place this command in the `.bashrc` file in your home directory.
+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11

2-
add_library(Handler SHARED Handler.cc Handler.hh)
3-
target_compile_features(Handler PRIVATE cxx_std_17)
2+
add_library(gz-sim-yarp-handler SHARED Handler.cc Handler.hh)
3+
target_compile_features(gz-sim-yarp-handler PRIVATE cxx_std_17)
44

5-
target_link_libraries(Handler
5+
target_link_libraries(gz-sim-yarp-handler
66
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
77
PRIVATE gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
88
PRIVATE
99
${YARP_LIBRARIES}
1010
YARP::YARP_os
11-
YARP::YARP_init)
11+
YARP::YARP_init)
12+
13+
install(TARGETS gz-sim-yarp-handler)

plugins/camera/CMakeLists.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ target_link_libraries(gz-sim-yarp-camera-system
1212
${YARP_LIBRARIES}
1313
YARP::YARP_os
1414
YARP::YARP_init
15-
Handler
16-
HandlerCamera)
15+
gz-sim-yarp-handler
16+
gz-sim-yarp-handler-camera)
17+
18+
# Add install target
19+
install(TARGETS gz-sim-yarp-camera-system)
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
add_library(HandlerCamera SHARED Handler.cc Handler.hh)
2-
target_compile_features(HandlerCamera PRIVATE cxx_std_17)
1+
add_library(gz-sim-yarp-handler-camera SHARED Handler.cc Handler.hh)
2+
target_compile_features(gz-sim-yarp-handler-camera PRIVATE cxx_std_17)
33

4-
target_link_libraries(HandlerCamera
4+
target_link_libraries(gz-sim-yarp-handler-camera
55
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
66
PRIVATE gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
77
PRIVATE
88
${YARP_LIBRARIES}
99
YARP::YARP_os
10-
YARP::YARP_init)
10+
YARP::YARP_init)
11+
12+
# Add install target
13+
install(TARGETS gz-sim-yarp-handler-camera)

plugins/forcetorque/CMakeLists.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ target_link_libraries(gz-sim-yarp-forcetorque-system
1212
${YARP_LIBRARIES}
1313
YARP::YARP_os
1414
YARP::YARP_init
15-
Handler
16-
HandlerForceTorque)
15+
gz-sim-yarp-handler
16+
gz-sim-yarp-handler-forcetorque)
17+
18+
# Add install target
19+
install(TARGETS gz-sim-yarp-forcetorque-system)
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11

2-
add_library(HandlerForceTorque SHARED Handler.cc Handler.hh)
3-
target_compile_features(HandlerForceTorque PRIVATE cxx_std_17)
2+
add_library(gz-sim-yarp-handler-forcetorque SHARED Handler.cc Handler.hh)
3+
target_compile_features(gz-sim-yarp-handler-forcetorque PRIVATE cxx_std_17)
44

5-
target_link_libraries(HandlerForceTorque
5+
target_link_libraries(gz-sim-yarp-handler-forcetorque
66
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
77
PRIVATE gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
88
PRIVATE
99
${YARP_LIBRARIES}
1010
YARP::YARP_os
11-
YARP::YARP_init)
11+
YARP::YARP_init)
12+
13+
install(TARGETS gz-sim-yarp-handler-forcetorque)

plugins/imu/CMakeLists.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ target_link_libraries(gz-sim-yarp-imu-system
1212
${YARP_LIBRARIES}
1313
YARP::YARP_os
1414
YARP::YARP_init
15-
Handler
16-
HandlerIMU)
15+
gz-sim-yarp-handler
16+
gz-sim-yarp-handler-imu)
17+
18+
# Add install target
19+
install(TARGETS gz-sim-yarp-imu-system)
+7-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11

2-
add_library(HandlerIMU SHARED Handler.cc Handler.hh)
3-
target_compile_features(HandlerIMU PRIVATE cxx_std_17)
2+
add_library(gz-sim-yarp-handler-imu SHARED Handler.cc Handler.hh)
3+
target_compile_features(gz-sim-yarp-handler-imu PRIVATE cxx_std_17)
44

5-
target_link_libraries(HandlerIMU
5+
target_link_libraries(gz-sim-yarp-handler-imu
66
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
77
PRIVATE gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
88
PRIVATE
99
${YARP_LIBRARIES}
1010
YARP::YARP_os
11-
YARP::YARP_init)
11+
YARP::YARP_init)
12+
13+
# Add install target
14+
install(TARGETS gz-sim-yarp-handler-imu)

plugins/laser/CMakeLists.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ target_link_libraries(gz-sim-yarp-laser-system
1212
${YARP_LIBRARIES}
1313
YARP::YARP_os
1414
YARP::YARP_init
15-
Handler
16-
HandlerLaser)
15+
gz-sim-yarp-handler
16+
gz-sim-yarp-handler-laser)
17+
18+
# Add install target
19+
install(TARGETS gz-sim-yarp-laser-system)
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11

2-
add_library(HandlerLaser SHARED Handler.cc Handler.hh)
3-
target_compile_features(HandlerLaser PRIVATE cxx_std_17)
2+
add_library(gz-sim-yarp-handler-laser SHARED Handler.cc Handler.hh)
3+
target_compile_features(gz-sim-yarp-handler-laser PRIVATE cxx_std_17)
44

5-
target_link_libraries(HandlerLaser
5+
target_link_libraries(gz-sim-yarp-handler-laser
66
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
77
PRIVATE gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
88
PRIVATE
99
${YARP_LIBRARIES}
1010
YARP::YARP_os
1111
YARP::YARP_init)
12+
13+
# Add install target
14+
install(TARGETS gz-sim-yarp-handler-laser)

plugins/robotinterface/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ target_link_libraries(gz-sim-yarp-robotinterface-system
99
${YARP_LIBRARIES}
1010
YARP::YARP_os
1111
YARP::YARP_init
12-
Handler)
12+
gz-sim-yarp-handler)
13+
14+
install(TARGETS gz-sim-yarp-robotinterface-system)
15+

tutorial/camera/model/README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
~~~
99
- 2nd terminal:
1010
~~~
11-
export LIBGL_ALWAYS_SOFTWARE=1
12-
cd build
13-
export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib
14-
cd ../tutorial/camera/model
11+
cd tutorial/camera/model
1512
gz sim model.sdf
1613
~~~
1714
- 3rd terminal:
@@ -29,5 +26,13 @@ Finally start the simulation in Gazebo.
2926
- Gazebo simulation
3027
![Gazebo simulation](imgs/simulation.png "Gazebo simulation")
3128

29+
If you are using Linux on WSLg and you have the following error
30+
~~~
31+
OGRE EXCEPTION(9:UnimplementedException): in GL3PlusTextureGpu::copyTo at ./RenderSystems/GL3Plus/src/OgreGL3PlusTextureGpu.cpp (line 685)
32+
~~~
33+
try forcing software rendering:
34+
~~~
35+
export LIBGL_ALWAYS_SOFTWARE=1
36+
~~~
3237

3338

tutorial/camera/model_horizontal_flip/README.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
~~~
99
- 2nd terminal:
1010
~~~
11-
export LIBGL_ALWAYS_SOFTWARE=1
12-
cd build
13-
export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib
14-
cd ../tutorial/camera/model_horizontal_flip
11+
cd tutorial/camera/model_horizontal_flip
1512
gz sim model.sdf
1613
~~~
1714
- 3rd terminal:
@@ -29,5 +26,12 @@ Finally start the simulation in Gazebo.
2926
- Gazebo simulation
3027
![Gazebo simulation](imgs/simulation.png "Gazebo simulation")
3128

32-
29+
If you are using Linux on WSLg and you have the following error
30+
~~~
31+
OGRE EXCEPTION(9:UnimplementedException): in GL3PlusTextureGpu::copyTo at ./RenderSystems/GL3Plus/src/OgreGL3PlusTextureGpu.cpp (line 685)
32+
~~~
33+
try forcing software rendering:
34+
~~~
35+
export LIBGL_ALWAYS_SOFTWARE=1
36+
~~~
3337

tutorial/camera/model_vertical_flip/README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
~~~
99
- 2nd terminal:
1010
~~~
11-
export LIBGL_ALWAYS_SOFTWARE=1
12-
cd build
13-
export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib
14-
cd ../tutorial/camera/model_vertical_flip
11+
cd tutorial/camera/model_vertical_flip
1512
gz sim model.sdf
1613
~~~
1714
- 3rd terminal:
@@ -27,4 +24,13 @@ Finally start the simulation in Gazebo.
2724
- yarpview window
2825
![yarpview window](imgs/yarpview_vertical_flip.png "yarpview window")
2926
- Gazebo simulation
30-
![Gazebo simulation](imgs/simulation.png "Gazebo simulation")
27+
![Gazebo simulation](imgs/simulation.png "Gazebo simulation")
28+
29+
If you are using Linux on WSLg and you have the following error
30+
~~~
31+
OGRE EXCEPTION(9:UnimplementedException): in GL3PlusTextureGpu::copyTo at ./RenderSystems/GL3Plus/src/OgreGL3PlusTextureGpu.cpp (line 685)
32+
~~~
33+
try forcing software rendering:
34+
~~~
35+
export LIBGL_ALWAYS_SOFTWARE=1
36+
~~~

tutorial/forcetorque/model_one_sensor/README.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
~~~
99
- 2nd terminal:
1010
~~~
11-
export LIBGL_ALWAYS_SOFTWARE=1
12-
cd build
13-
export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib
14-
cd ../tutorial/forcetorque/model_one_sensor
11+
cd tutorial/forcetorque/model_one_sensor
1512
gz sim model.sdf
1613
~~~
1714
- 3rd terminal:
@@ -29,6 +26,15 @@ Finally start the simulation in Gazebo. The output is:
2926
...
3027
~~~
3128

29+
If you are using Linux on WSLg and you have the following error
30+
~~~
31+
OGRE EXCEPTION(9:UnimplementedException): in GL3PlusTextureGpu::copyTo at ./RenderSystems/GL3Plus/src/OgreGL3PlusTextureGpu.cpp (line 685)
32+
~~~
33+
try forcing software rendering:
34+
~~~
35+
export LIBGL_ALWAYS_SOFTWARE=1
36+
~~~
37+
3238
## Run model in Gazebo Garden without YARP integration
3339
Run the model:
3440
```

tutorial/forcetorque/model_two_sensors/README.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
~~~
99
- 2nd terminal:
1010
~~~
11-
export LIBGL_ALWAYS_SOFTWARE=1
12-
cd build
13-
export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib
14-
cd ../tutorial/forcetorque/model_two_sensors
11+
cd tutorial/forcetorque/model_two_sensors
1512
gz sim model2sensors.sdf
1613
~~~
1714
- 3rd terminal:
@@ -42,3 +39,12 @@
4239
() () () () () (((0.0 0.0 -98.0 0.0 0.0 0.0) 8.68900000000000005684)) () () () ()
4340
() () () () () (((0.0 0.0 -98.0 0.0 0.0 0.0) 8.77299999999999968736)) () () () ()
4441
~~~
42+
43+
If you are using Linux on WSLg and you have the following error
44+
~~~
45+
OGRE EXCEPTION(9:UnimplementedException): in GL3PlusTextureGpu::copyTo at ./RenderSystems/GL3Plus/src/OgreGL3PlusTextureGpu.cpp (line 685)
46+
~~~
47+
try forcing software rendering:
48+
~~~
49+
export LIBGL_ALWAYS_SOFTWARE=1
50+
~~~

0 commit comments

Comments
 (0)