Skip to content

Commit baa7751

Browse files
authored
allow the user to specify build dir. allow user to call compile.sh from anywhere. correct bug when prefix is specified, the executable is not in the correct place. (#746)
1 parent 83e59b5 commit baa7751

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tests/compile_upp.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ while getopts ":p:gwc:vhiId" opt; do
6363
done
6464
cmake_opts=" -DCMAKE_INSTALL_PREFIX=$prefix"${wrfio_opt}${gtg_opt}${ifi_opt}${debug_opt}
6565

66-
source ./detect_machine.sh
6766
if [[ $(uname -s) == Darwin ]]; then
6867
readonly MYDIR=$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)
6968
else
7069
readonly MYDIR=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)
7170
fi
7271
PATHTR=${PATHTR:-$( cd ${MYDIR}/.. && pwd )}
72+
source ${PATHTR}/tests/detect_machine.sh
7373

7474
#Load required modulefiles
7575
if [[ $MACHINE_ID != "unknown" ]]; then
@@ -94,11 +94,12 @@ if [[ $MACHINE_ID != "unknown" ]]; then
9494
module list
9595
fi
9696

97-
rm -rf build install
98-
mkdir build && cd build
99-
cmake $cmake_opts ../..
100-
make -j6 $verbose_opt
97+
BUILD_DIR=${BUILD_DIR:-"build"}
98+
rm -rf ${BUILD_DIR} install
99+
mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
100+
cmake $cmake_opts ${PATHTR}
101+
make -j${BUILD_JOBS:-6} $verbose_opt
101102
make install
102103

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

0 commit comments

Comments
 (0)