2019-09-05 22:43:33 -04:00
|
|
|
isAmentPackage() {
|
|
|
|
[ -d "$1/share/ament_index" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
declare -gA _amentPackagesSeen
|
|
|
|
|
|
|
|
_findAmentPackages() {
|
|
|
|
local pkg="$1"
|
|
|
|
# Deduplicate the packages
|
2020-02-05 01:13:29 -05:00
|
|
|
if [ -z "${_amentPackagesSeen["$pkg"]:-}" ] \
|
|
|
|
&& isAmentPackage "$pkg" \
|
|
|
|
&& [ -n "$(shopt -s nullglob; echo $pkg/share/*/local_setup.sh)" ]
|
|
|
|
then
|
|
|
|
# ROS scripts use unbound variables
|
|
|
|
set +u
|
2021-03-11 22:28:30 -05:00
|
|
|
for setup in "$pkg"/share/*/local_setup.sh; do
|
|
|
|
source "$setup"
|
|
|
|
done
|
2020-02-05 01:13:29 -05:00
|
|
|
set -u
|
2019-09-05 22:43:33 -04:00
|
|
|
fi
|
|
|
|
_amentPackagesSeen["$pkg"]=1
|
|
|
|
}
|
2022-09-20 15:26:10 -04:00
|
|
|
addEnvHooks "$targetOffset" _findAmentPackages
|
2021-03-13 12:02:19 -05:00
|
|
|
|
|
|
|
_amentCmakeCorePreConfigureHook() {
|
|
|
|
# Don't create share/ament_index/resource_index/parent_prefix_path resource
|
|
|
|
# that contains references to all dependencies. This file isn't used with Nix
|
|
|
|
# and just bloats the closure.
|
2022-09-20 15:26:10 -04:00
|
|
|
cmakeFlags+=" -DAMENT_CMAKE_ENVIRONMENT_PARENT_PREFIX_PATH_GENERATION:BOOL=OFF"
|
|
|
|
# Point CMake at build platform Python so it can run it at build time
|
|
|
|
cmakeFlags+=" -DPython@python_major@_EXECUTABLE:FILEPATH=@python_executable@"
|
2021-03-13 12:02:19 -05:00
|
|
|
}
|
|
|
|
preConfigureHooks+=(_amentCmakeCorePreConfigureHook)
|