Skip to content

Commit

Permalink
Add <superbuild_install_prefix>/share to XDG_DATA_DIRS environment va…
Browse files Browse the repository at this point in the history
…riable to support yarp bash autocompletion out of the box (#759)
  • Loading branch information
traversaro authored May 25, 2021
1 parent cfa55e3 commit d3afb69
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .ci/install_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export DEBIAN_FRONTEND=noninteractive
apt-get install -y clang valgrind ccache ninja-build

# Core dependencies
apt-get install -y build-essential cmake cmake-curses-gui coinor-libipopt-dev freeglut3-dev git libace-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libdc1394-22-dev libedit-dev libeigen3-dev libgsl0-dev libjpeg-dev liblua5.1-dev libode-dev libopencv-dev libsdl1.2-dev libtinyxml-dev libv4l-dev libxml2-dev lua5.1 portaudio19-dev qml-module-qt-labs-folderlistmodel qml-module-qt-labs-settings qml-module-qtmultimedia qml-module-qtquick-controls qml-module-qtquick-dialogs qml-module-qtquick-window2 qml-module-qtquick2 qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev swig libspdlog-dev libblas-dev liblapack-dev
apt-get install -y bash-completion build-essential cmake cmake-curses-gui coinor-libipopt-dev freeglut3-dev git libace-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libdc1394-22-dev libedit-dev libeigen3-dev libgsl0-dev libjpeg-dev liblua5.1-dev libode-dev libopencv-dev libsdl1.2-dev libtinyxml-dev libv4l-dev libxml2-dev lua5.1 portaudio19-dev qml-module-qt-labs-folderlistmodel qml-module-qt-labs-settings qml-module-qtmultimedia qml-module-qtquick-controls qml-module-qtquick-dialogs qml-module-qtquick-window2 qml-module-qtquick2 qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev swig libspdlog-dev libblas-dev liblapack-dev

# Dynamics dependencies
apt-get install -y libmatio-dev libirrlicht-dev
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
run: |
# Additional dependencies only useful on Linux
# See https://github.com/robotology/robotology-superbuild/issues/477
mamba install expat-cos6-x86_64 freeglut libdc1394 libselinux-cos6-x86_64 libxau-cos6-x86_64 libxcb-cos6-x86_64 libxdamage-cos6-x86_64 libxext-cos6-x86_64 libxfixes-cos6-x86_64 libxxf86vm-cos6-x86_64 mesalib mesa-libgl-cos6-x86_64
mamba install bash-completion expat-cos6-x86_64 freeglut libdc1394 libselinux-cos6-x86_64 libxau-cos6-x86_64 libxcb-cos6-x86_64 libxdamage-cos6-x86_64 libxext-cos6-x86_64 libxfixes-cos6-x86_64 libxxf86vm-cos6-x86_64 mesalib mesa-libgl-cos6-x86_64
# Ignition Gazebo
mamba install libignition-gazebo4
Expand Down Expand Up @@ -356,7 +356,7 @@ jobs:
brew upgrade
brew install --cask xquartz
# Core dependencies
brew install ace boost cmake eigen gsl ipopt jpeg libedit opencv pkg-config portaudio qt@5 sqlite swig tinyxml
brew install ace bash-completion boost cmake eigen gsl ipopt jpeg libedit opencv pkg-config portaudio qt@5 sqlite swig tinyxml
# ROBOTOLOGY_ENABLE_DYNAMICS dependencies
brew install libmatio irrlicht spdlog
# ROBOTOLOGY_ENABLE_DYNAMICS_FULL_DEPS (qhull and cppad are installed with brew)
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format of this document is based on [Keep a Changelog](https://keepachangelo
### Added
- Add spdlog dependency to the superbuild (https://github.com/robotology/robotology-superbuild/pull/645)
- Add `YARP_telemetry` component to the Dynamics profile (https://github.com/robotology/robotology-superbuild/pull/677).
- Append `<superbuild_install_prefix>/share` to `XDG_DATA_DIRS` to enable YARP auto completion on Bash terminal (https://github.com/robotology/robotology-superbuild/pull/759).

### Removed
- The `icub-gazebo` project was removed from the superbuild (https://github.com/robotology/robotology-superbuild/pull/646).
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ All the software packages are installed using the `install` directory of the bui
### System Dependencies
On Debian based systems (as Ubuntu) you can install the C++ toolchain, Git, CMake and Eigen (and other dependencies necessary for the software include in `robotology-superbuild`) using `apt-get`:
```
sudo apt-get install build-essential cmake cmake-curses-gui coinor-libipopt-dev freeglut3-dev git libace-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libdc1394-22-dev libedit-dev libeigen3-dev libgsl0-dev libjpeg-dev liblua5.1-dev libode-dev libopencv-dev libsdl1.2-dev libtinyxml-dev libv4l-dev libxml2-dev lua5.1 portaudio19-dev qml-module-qt-labs-folderlistmodel qml-module-qt-labs-settings qml-module-qtmultimedia qml-module-qtquick-controls qml-module-qtquick-dialogs qml-module-qtquick-window2 qml-module-qtquick2 qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev swig libmatio-dev libirrlicht-dev libspdlog-dev libblas-dev liblapack-dev
sudo apt-get install bash-completion build-essential cmake cmake-curses-gui coinor-libipopt-dev freeglut3-dev git libace-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libdc1394-22-dev libedit-dev libeigen3-dev libgsl0-dev libjpeg-dev liblua5.1-dev libode-dev libopencv-dev libsdl1.2-dev libtinyxml-dev libv4l-dev libxml2-dev lua5.1 portaudio19-dev qml-module-qt-labs-folderlistmodel qml-module-qt-labs-settings qml-module-qtmultimedia qml-module-qtquick-controls qml-module-qtquick-dialogs qml-module-qtquick-window2 qml-module-qtquick2 qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev swig libmatio-dev libirrlicht-dev libspdlog-dev libblas-dev liblapack-dev
```

For what regards CMake, the robotology-superbuild requires CMake 3.16 . If you are using a recent Debian-based system such as Ubuntu 20.04, the default CMake is recent enough and you do not need to do further steps.
Expand Down Expand Up @@ -166,7 +166,7 @@ If for any reason you do not want to use the provided `setup.sh` script and you
### System Dependencies
To install the system dependencies, it is possible to use [Homebrew](http://brew.sh/):
```
brew install ace boost cmake eigen gsl ipopt jpeg libedit opencv pkg-config portaudio qt@5 sqlite swig tinyxml libmatio irrlicht spdlog
brew install ace bash-completion boost cmake eigen gsl ipopt jpeg libedit opencv pkg-config portaudio qt@5 sqlite swig tinyxml libmatio irrlicht spdlog
```

Since Qt5 is not symlinked in `/usr/local` by default in the homebrew formula, `Qt5_DIR` needs to be properly set to make sure that CMake-based projects are able to find Qt5.
Expand Down
4 changes: 4 additions & 0 deletions cmake/BuildYARP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ if(ROBOTOLOGY_USES_PYTHON)
list(APPEND YARP_CONDA_DEPENDENCIES swig)
list(APPEND YARP_CONDA_DEPENDENCIES python)
endif()

if(NOT WIN32)
list(APPEND YARP_CONDA_DEPENDENCIES bash-completion)
endif()
3 changes: 3 additions & 0 deletions cmake/template/addPathsToUserEnvVariables.ps1.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ Add-ValueToUserEnvVariable GAZEBO_MODEL_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREF
Add-ValueToUserEnvVariable GAZEBO_MODEL_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\iCub\robots"
Add-ValueToUserEnvVariable GAZEBO_MODEL_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share"

# Bash completion
Add-ValueToUserEnvVariable XDG_DATA_DIRS $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share"

@cmakeif ROBOTOLOGY_USES_GAZEBO
# ROBOTOLOGY_USES_GAZEBO-specific lines
Add-ValueToUserEnvVariable GAZEBO_PLUGIN_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\lib";
Expand Down
3 changes: 3 additions & 0 deletions cmake/template/removePathsFromUserEnvVariables.ps1.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Remove-ValueFromUserEnvVariable GAZEBO_MODEL_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL
Remove-ValueFromUserEnvVariable GAZEBO_MODEL_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\iCub\robots"
Remove-ValueFromUserEnvVariable GAZEBO_MODEL_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share"

# Cleanup XDG_DATA_DIRS
Remove-ValueFromUserEnvVariable XDG_DATA_DIRS $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share"

@cmakeif ROBOTOLOGY_USES_GAZEBO
# Cleanup ROBOTOLOGY_USES_GAZEBO-specific lines
Remove-ValueFromUserEnvVariable GAZEBO_PLUGIN_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\lib";
Expand Down
3 changes: 3 additions & 0 deletions cmake/template/setup.bat.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ set "ROS_PACKAGE_PATH=%ROS_PACKAGE_PATH%;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\
set "AMENT_PREFIX_PATH=%AMENT_PREFIX_PATH%;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\share"
set "GAZEBO_MODEL_PATH=%GAZEBO_MODEL_PATH%;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\share\gazebo\models;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\share\iCub\robots;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\share"

rem Bash completion
set "XDG_DATA_DIRS=%XDG_DATA_DIRS%;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\share"

@cmakeif ROBOTOLOGY_USES_GAZEBO
rem ROBOTOLOGY_USES_GAZEBO-specific lines
set "GAZEBO_PLUGIN_PATH=%GAZEBO_PLUGIN_PATH%;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\lib"
Expand Down
2 changes: 2 additions & 0 deletions cmake/template/setup.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH:+${CMAKE_PREFIX_PATH}:}${ROBOTOLOGY
export @SHLIB_ENV_VAR@=${@SHLIB_ENV_VAR@:+${@SHLIB_ENV_VAR@}:}${ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX}/lib
# Setup the path of blockfactory plugins
export BLOCKFACTORY_PLUGIN_PATH=${BLOCKFACTORY_PLUGIN_PATH:+${BLOCKFACTORY_PLUGIN_PATH}:}$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/@BLOCKFACTORY_PLUGIN_PATH_DIRECTORY@/blockfactory
# Extend path for bash completion (see https://github.com/robotology/robotology-superbuild/issues/622#issuecomment-847586406)
export XDG_DATA_DIRS=${XDG_DATA_DIRS:+${XDG_DATA_DIRS}:}$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/share

@cmakeif ROBOTOLOGY_USES_GAZEBO
# ROBOTOLOGY_USES_GAZEBO-specific lines
Expand Down
2 changes: 2 additions & 0 deletions conda/multisheller/yarp_activate.msh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
if_(is_set("COMSPEC")).then_([
sys.list_append("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "Library\\share\\yarp"))
sys.list_append("XDG_DATA_DIRS", path.join(env("CONDA_PREFIX"), "Library\\share"))
]).else_([
sys.list_append("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "share/yarp"))
sys.list_append("XDG_DATA_DIRS", path.join(env("CONDA_PREFIX"), "share"))
])
2 changes: 2 additions & 0 deletions conda/multisheller/yarp_deactivate.msh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
if_(is_set("COMSPEC")).then_([
sys.list_remove("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "Library\\share\\yarp"))
sys.list_remove("XDG_DATA_DIRS", path.join(env("CONDA_PREFIX"), "Library\\share"))
]).else_([
sys.list_remove("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "share/yarp"))
sys.list_remove("XDG_DATA_DIRS", path.join(env("CONDA_PREFIX"), "share"))
])
2 changes: 1 addition & 1 deletion doc/conda-forge.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ conda install -c conda-forge ace asio boost eigen gazebo glew glfw gsl ipopt lib

If you are on **Linux**, you also need to install also the following packages:
~~~
conda install -c conda-forge expat-cos6-x86_64 freeglut libdc1394 libselinux-cos6-x86_64 libxau-cos6-x86_64 libxcb-cos6-x86_64 libxdamage-cos6-x86_64 libxext-cos6-x86_64 libxfixes-cos6-x86_64 libxxf86vm-cos6-x86_64 mesalib mesa-libgl-cos6-x86_64
conda install -c conda-forge bash-completion expat-cos6-x86_64 freeglut libdc1394 libselinux-cos6-x86_64 libxau-cos6-x86_64 libxcb-cos6-x86_64 libxdamage-cos6-x86_64 libxext-cos6-x86_64 libxfixes-cos6-x86_64 libxxf86vm-cos6-x86_64 mesalib mesa-libgl-cos6-x86_64
~~~

If you are on **Windows**, you also need to install also the following packages:
Expand Down
2 changes: 2 additions & 0 deletions doc/environment-variables-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ while on macOS you need to append `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/lib` to
For what regards correctly loading resources in URDF files, you need to append `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX\share` to the
[`ROS_PACKAGE_PATH`](http://wiki.ros.org/ROS/EnvironmentVariables#ROS_PACKAGE_PATH) environment variable for [ROS1](https://www.ros.org/), and to [`AMENT_PREFIX_PATH`](http://design.ros2.org/articles/ament.html) for [ROS2](https://index.ros.org/doc/ros2/)

To enable bash autocompletion, you need to add `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX\share` to `XDG_DATA_DIRS` environment variable.

## Profile-specific configuration steps

This section covers the configuration necessary for a specific profile.
Expand Down

0 comments on commit d3afb69

Please sign in to comment.