Skip to content

Commit

Permalink
Fix Torch install path check
Browse files Browse the repository at this point in the history
Path expansion was not working as expected
  • Loading branch information
Bckempa committed Nov 7, 2023
1 parent 5a4570e commit 3b4d9c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/setup/dependencies/build_install_torch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ sudo unzip -q libtorch-cxx11-abi-shared-with-deps-1.5.0+cpu.zip -d /usr/include
# if zsh is in use. We'll just add a conditional extension to every shell
# rc file we find (currently only looking at .bashrc and .zshrc)
cmake_isaac_torch_path=/usr/include/libtorch/share/cmake/Torch
for shell_cfg in "~/.bashrc" "~/.zshrc"; do
for shell_cfg in "${HOME}/.bashrc" "${HOME}/.zshrc"; do
if [[ -f ${shell_cfg} ]] && [ $(grep -cF ${cmake_isaac_torch_path} ${shell_cfg}) -eq 0 ]; then
echo "Adding Torch CMAKE Prefix path to ${shell_cfg}"
echo -e '\n## ISAAC Dependency - Torch CMAKE Path\n' >> ${shell_cfg}
echo 'if [[ ":$CMAKE_PREFIX_PATH:" != *":'${cmake_isaac_torch_path}':"* ]]; then CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH:+"$CMAKE_PREFIX_PATH:"}'${cmake_isaac_torch_path}'"; fi' >> ${shell_cfg}
fi
done

echo "Torch added to CMAKE_PREFIX_PATH in shell config file, source ~/.$(basename ${SHELL})rc before building"

0 comments on commit 3b4d9c3

Please sign in to comment.