Skip to content

Commit

Permalink
allow the user to specify build dir. allow user to call compile.sh fr…
Browse files Browse the repository at this point in the history
…om anywhere. correct bug when prefix is specified, the executable is not in the correct place. (#746)
  • Loading branch information
aerorahul committed Jul 17, 2023
1 parent 83e59b5 commit baa7751
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/compile_upp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ while getopts ":p:gwc:vhiId" opt; do
done
cmake_opts=" -DCMAKE_INSTALL_PREFIX=$prefix"${wrfio_opt}${gtg_opt}${ifi_opt}${debug_opt}

source ./detect_machine.sh
if [[ $(uname -s) == Darwin ]]; then
readonly MYDIR=$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)
else
readonly MYDIR=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)
fi
PATHTR=${PATHTR:-$( cd ${MYDIR}/.. && pwd )}
source ${PATHTR}/tests/detect_machine.sh

#Load required modulefiles
if [[ $MACHINE_ID != "unknown" ]]; then
Expand All @@ -94,11 +94,12 @@ if [[ $MACHINE_ID != "unknown" ]]; then
module list
fi

rm -rf build install
mkdir build && cd build
cmake $cmake_opts ../..
make -j6 $verbose_opt
BUILD_DIR=${BUILD_DIR:-"build"}
rm -rf ${BUILD_DIR} install
mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
cmake $cmake_opts ${PATHTR}
make -j${BUILD_JOBS:-6} $verbose_opt
make install

rm -rf $PATHTR/exec && mkdir $PATHTR/exec
cp $PATHTR/tests/install/bin/upp.x $PATHTR/exec/.
rm -rf $PATHTR/exec && mkdir -p $PATHTR/exec
cp $prefix/bin/upp.x $PATHTR/exec/.

0 comments on commit baa7751

Please sign in to comment.