Files
cuda/env.sh
Ronan Desplanques 2f7d2c27d6 Trim variable definitions in env.sh
Some of the environment variable definitions in env.sh were not needed.
This patch removes them.
2023-11-06 10:00:28 +00:00

33 lines
1.1 KiB
Bash

# shellcheck shell=sh
# this file is SUPPOSED TO BE SOURCED
# so, no shebang, no set -e
# https://stackoverflow.com/a/28776166
# Cannot detect if the script is being sourced from within a script
# in that case set the env var NO_SOURCED_CHECK
is_sourced() {
if [ -n "$ZSH_VERSION" ]; then
case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac
else # Add additional POSIX-compatible shell names here, if needed.
case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac
fi
return 1 # NOT sourced.
}
if [ -z "$NO_SOURCED_CHECK" ]; then
if ! is_sourced || ! [ -f "$PWD/env.sh" ] ; then
echo "This script is meant to be sourced from its own directory"
exit 2
fi
fi
CURRENT=$(pwd)
ROOT="$CURRENT/.."
# being sourced, must be super careful with error return value
CUDA_ROOT=$("$SHELL" "$CURRENT/locate_cuda_root.sh") || return 2
export CUDA_ROOT # direct export would gobble up eventual error
export GPR_PROJECT_PATH="$ROOT/cuda/api/install/share/gpr"
export PATH="$ROOT/llvm-ads/bin:$ROOT/uwrap/bin:$PATH:$ROOT/gnat-llvm/bin"