forked from yhx/enlarge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·68 lines (57 loc) · 1.45 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
SCRIPT_PATH=`dirname "$0"`
MODE=$(echo $1 | tr [A-Z] [a-z])
PREC=$(echo $2 | tr [A-Z] [a-z])
THREAD_NUM=$3
C_MODE="Release"
USE_DOUBLE="OFF"
USE_LOG="OFF"
VERBOSE=0
TOTAL_THREAD_NUM=`getconf _NPROCESSORS_ONLN`
if [ x"$THREAD_NUM" = x ]; then
((THREAD_NUM=TOTAL_THREAD_NUM/2))
fi
if [ "$MODE" = "debug" ]; then
C_MODE="Debug"
VERBOSE=1
USE_PROF="ON"
USE_LOG="ON"
elif [ "$MODE" = "log" ]; then
C_MODE="Release"
VERBOSE=1
USE_PROF="ON"
USE_LOG="ON"
elif [ "$MODE" = "test" ]; then
C_MODE="Debug"
USE_LOG="ON"
USE_PROF="ON"
USE_DOUBLE="ON"
VERBOSE=1
# THREAD_NUM=1
elif [ "$MODE" = "prof" ]; then
C_MODE="Release"
USE_LOG="OFF"
VERBOSE=0
USE_PROF="ON"
USE_LOG="OFF"
# THREAD_NUM=1
else
C_MODE="Release"
USE_LOG="OFF"
USE_PROF="OFF"
VERBOSE=0
fi
if [ "$PREC" = "double" ]; then
USE_DOUBLE="ON"
fi
if [ ! -d $SCRIPT_PATH/build ]; then
mkdir $SCRIPT_PATH/build
fi
set -x
if [ "$MODE" = "clean" ]; then
cd $SCRIPT_PATH/build && make clean-all
elif [ "$MODE" = "test" ]; then
cd $SCRIPT_PATH/build && cmake -DCMAKE_BUILD_TYPE="Debug" -DUSE_DOUBLE=$USE_DOUBLE -DUSE_LOG=$USE_LOG -DUSE_PROF=$USE_PROF -lpthread .. 2> >(tee error.err) && make -j$THREAD_NUM VERBOSE=$VERBOSE 2> >(tee -a error.err) && make test
else
cd $SCRIPT_PATH/build && cmake -DCMAKE_BUILD_TYPE=$C_MODE -DUSE_DOUBLE=$USE_DOUBLE -DUSE_LOG=$USE_LOG -DUSE_PROF=$USE_PROF -lpthread .. 2> >(tee error.err) && make -j$THREAD_NUM VERBOSE=$VERBOSE 2> >(tee -a error.err)
fi