From 19734fc5b68e51c0808f440a6a591c882367ec65 Mon Sep 17 00:00:00 2001 From: Hansung Kim Date: Thu, 24 Aug 2023 13:53:44 -0700 Subject: [PATCH] Accept build dir and avoid dup run in env script --- env.vortex-prebuilt.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/env.vortex-prebuilt.sh b/env.vortex-prebuilt.sh index 667f8db8..5ffa41ca 100644 --- a/env.vortex-prebuilt.sh +++ b/env.vortex-prebuilt.sh @@ -1,4 +1,23 @@ -BUILDDIR=$HOME/build +if [ $# -lt 1 ] +then + echo "Usage: source env.vortex-prebuilt.sh build-dir" + return +fi + +if [ -n "$VORTEX_ENV" ] +then + echo "VORTEX_ENV already set. Exiting." + return +fi + +BUILDDIR=$1 + +if ! [ -d "$BUILDDIR/vortex-toolchain-prebuilt" ] +then + echo "error: $BUILDDIR/vortex-toolchain-prebuilt does not exist." + return 1 +fi + export VORTEX_ENV="vortex-prebuilt" export LLVM_PREFIX=$BUILDDIR/vortex-toolchain-prebuilt/llvm-riscv/ export POCL_CC_PATH=$BUILDDIR/vortex-toolchain-prebuilt/pocl/compiler