-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·22 lines (22 loc) · 909 Bytes
/
make.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
MAKE_SH=$(readlink -f "$0" | sed 's=^/net/home/=/home/=')
[ -z "$SETUP_SH" ] && export SETUP_SH=$(dirname "$MAKE_SH")/setup.sh
[ -z "$RUNDIR" ] && export RUNDIR=$(dirname "$SETUP_SH")/run
[ -z "$BUILD_DIR" ] && export BUILD_DIR=$(dirname "$SETUP_SH")/build
if [ -n "$1" ]; then
export BUILD_TYPE="$1"
shift
elif [ -z "$BUILD_TYPE" ]; then
export BUILD_TYPE=Release
fi
SRCDIR=$(dirname $MAKE_SH)
cd "$SRCDIR"
mkdir -p "$BUILD_DIR" "$RUNDIR"
[ -d $(basename "$BUILD_DIR") ] || ln -nfs "$BUILD_DIR" .
[ -d $(basename "$RUNDIR") ] || ln -nfs "$RUNDIR" .
cd "$BUILD_DIR"
cmake3 "$SRCDIR" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DCMAKE_INSTALL_PREFIX="$RUNDIR" -DCMAKE_INSTALL_MESSAGE=LAZY "$@" || exit
make -j8 install || exit
cd "$RUNDIR"
ln -nfs "$BUILD_DIR/Test"* "$BUILD_DIR/Bench"* "$SRCDIR/test/"*.sh "$SRCDIR/test/"*.py $(dirname "$MAKE_SH")/make*.sh .
ln -nfs "$SETUP_SH" setup.sh