-
Notifications
You must be signed in to change notification settings - Fork 498
Add relocatable setup.bash script #3061
Add relocatable setup.bash script #3061
Conversation
Set GAZEBO_*_PATH environment variables relative to a GAZEBO_INSTALL_PREFIX environment variable if set. Otherwise fall back to configure-time value of CMAKE_INSTALL_PREFIX. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Add setup.bash that * detects path of parent folder folder * sets GAZEBO_INSTALL_PREFIX relative to that folder * sources sibling setup.sh script Signed-off-by: Steve Peters <scpeters@openrobotics.org>
echo "The install prefix ${installPrefix} does not exist." | ||
unset installPrefix | ||
return 1 | ||
elif [ ! -f "${installPrefix}/@GAZEBO_RELATIVE_RESOURCE_PATH@/setup.sh" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this checking for the existing of the setup.sh produced by this file? Under what circumstance might this condition be true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is checking that the path in the installPrefix
variable contains at least one expected file. In this case it resolves to ${installPrefix}/share/gazebo-11/setup.sh
for gazebo11, but I suppose we could equivalently choose ${installPrefix}/share/gazebo-11/worlds/empty.world
. The first if
statement checks that the $installPrefix
path exists; the second checks for some expected content.
I suppose it's possible to confuse matters if you manually set GAZEBO_INSTALL_PREFIX
to one install path but source the setup.sh
from a different install path, but the recommended approach is now to use setup.bash
, which should avoid that type of confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one question above.
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
CI looks ok to me, merging |
This refactors the
setup.sh
script to set theGAZEBO_*_PATH
environment variables relative to a path specified in aGAZEBO_INSTALL_PREFIX
environment variable (defaulting to the current behavior of setting relative to the configure-time install prefix ifGAZEBO_INSTALL_PREFIX
is empty or unset). It also adds a relocatablesetup.bash
script that uses bash-specific syntax to detect the folder containing thesetup.*sh
scripts, setGAZEBO_INSTALL_PREFIX
relative to that folder, and then sourcesetup.sh
.Fixes #3056.