Skip to content

Commit

Permalink
Fix RobotecGPULidar library linking (#11)
Browse files Browse the repository at this point in the history
* Create install step for cmake

* Update README

* Downgrade cmake version to Ubuntu20 default (3.16)

* Simplify rpath setting mechanism
  • Loading branch information
msz-rai authored Apr 3, 2023
1 parent ea888f3 commit f2c5b35
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@

.idea
build
install
cmake-build-debug
RGLServerPlugin/include/rgl
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.16)
project(RGLGazeboPlugin)

set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/install")

add_subdirectory(RGLServerPlugin)
add_subdirectory(RGLVisualize)
add_subdirectory(RGLVisualize)
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,30 @@ Key features:
- Move libraries to the plugin's directories.
```shell
# If Gazebo installed from apt:
cp libRobotecGPULidar.so /usr/lib/x86_64-linux-gnu/ign-gazebo-6/plugins/
cp libRGLServerPluginInstance.so /usr/lib/x86_64-linux-gnu/ign-gazebo-6/plugins/
cp libRGLServerPluginManager.so /usr/lib/x86_64-linux-gnu/ign-gazebo-6/plugins/
cp libRGLVisualize.so /usr/lib/x86_64-linux-gnu/ign-gazebo-6/plugins/gui/
```
- Or set environment variables:
```shell
# Assuming that libRGLServerPluginInstance.so and libRGLServerPluginManager.so
# are located in RGLServerPlugins directory,
# and libRGLVisualize.so in RGLGuiPlugins.
export IGN_GAZEBO_SYSTEM_PLUGIN_PATH=`pwd`/RGLServerPlugins:$IGN_GAZEBO_SYSTEM_PLUGIN_PATH
export IGN_GUI_PLUGIN_PATH=`pwd`/RGLGuiPlugins:$IGN_GUI_PLUGIN_PATH
# Assuming that libraries:
# libRGLServerPluginInstance.so, libRGLServerPluginManager.so and libRobotecGPULidar.so
# are located in RGLServerPlugin directory,
# and libRGLVisualize.so in RGLGuiPlugin.
export IGN_GAZEBO_SYSTEM_PLUGIN_PATH=`pwd`/RGLServerPlugin:$IGN_GAZEBO_SYSTEM_PLUGIN_PATH
export IGN_GUI_PLUGIN_PATH=`pwd`/RGLGuiPlugin:$IGN_GUI_PLUGIN_PATH
```
### Building from source
```shell
mkdir build
cd build
cmake ..
make -j
export IGN_GAZEBO_SYSTEM_PLUGIN_PATH=`pwd`/RGLServerPlugin:$IGN_GAZEBO_SYSTEM_PLUGIN_PATH
export IGN_GUI_PLUGIN_PATH=`pwd`/RGLVisualize:$IGN_GUI_PLUGIN_PATH
make install
cd ..
export IGN_GAZEBO_SYSTEM_PLUGIN_PATH=`pwd`/install/RGLServerPlugin:$IGN_GAZEBO_SYSTEM_PLUGIN_PATH
export IGN_GUI_PLUGIN_PATH=`pwd`/install/RGLVisualize:$IGN_GUI_PLUGIN_PATH
```
## Demo:

Expand Down
13 changes: 12 additions & 1 deletion RGLServerPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.18)
cmake_minimum_required(VERSION 3.16)
project(RGLServerPlugin)
set(CMAKE_CXX_STANDARD 20)

Expand Down Expand Up @@ -33,10 +33,21 @@ target_link_libraries(RGLServerPluginManager
ignition-plugin1::ignition-plugin1
${RobotecGPULidar}
)
set_target_properties(RGLServerPluginManager PROPERTIES INSTALL_RPATH "$ORIGIN")

add_library(RGLServerPluginInstance SHARED src/RGLServerPluginInstance.cc src/Lidar.cc src/Utils.cc src/LidarPatternLoader.cc)
target_link_libraries(RGLServerPluginInstance
ignition-gazebo6::ignition-gazebo6
ignition-plugin1::ignition-plugin1
${RobotecGPULidar}
)
set_target_properties(RGLServerPluginInstance PROPERTIES INSTALL_RPATH "$ORIGIN")

## Install libraries

install(TARGETS RGLServerPluginInstance RGLServerPluginManager
DESTINATION RGLServerPlugin
)
install(FILES ${RobotecGPULidar}
DESTINATION RGLServerPlugin
)
10 changes: 8 additions & 2 deletions RGLVisualize/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ QT5_ADD_RESOURCES(resources_RCC RGLVisualize.qrc)
add_library(RGLVisualize SHARED
RGLVisualize.cc
${resources_RCC}
)
)

target_link_libraries(RGLVisualize
PRIVATE
ignition-gui6::ignition-gui6
ignition-rendering6::ignition-rendering6
ignition-msgs8::ignition-msgs8
)
)

## Install libraries

install(TARGETS RGLVisualize
DESTINATION RGLVisualize
)

0 comments on commit f2c5b35

Please sign in to comment.