From 5f933ba294efeabe1e9feff776668386d084943c Mon Sep 17 00:00:00 2001 From: robbybp Date: Thu, 14 Dec 2023 14:57:29 -0700 Subject: [PATCH] only set PETSC_DIR if it is not already set --- scripts/compile_solvers.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/compile_solvers.sh b/scripts/compile_solvers.sh index 5366724c..3a3caa50 100755 --- a/scripts/compile_solvers.sh +++ b/scripts/compile_solvers.sh @@ -41,13 +41,19 @@ export CC="gcc" export CXX="g++" # set PETSc location -if [ ${osname} = "windows" ] -then - export PETSC_DIR=/c/repo/petsc-dist -elif [ ${osname} = "darwin" ]; then - export PETSC_DIR="$HOME/src/petsc-dist" -else - export PETSC_DIR=/repo/petsc-dist +# These petsc environment variables are used by the makefile +# in the $IDAES_EXT/petsc subdirectory. +if [ -z $PETSC_DIR ]; then + # We only set PETSC_DIR if it is not already set. This is useful when + # running this script locally (i.e. not via Docker) + if [ ${osname} = "windows" ] + then + export PETSC_DIR=/c/repo/petsc-dist + elif [ ${osname} = "darwin" ]; then + export PETSC_DIR="$HOME/src/petsc-dist" + else + export PETSC_DIR=/repo/petsc-dist + fi fi export PETSC_ARCH=""