-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·124 lines (98 loc) · 2.53 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
COLOR_CYAN="\e[96m"
COLOR_GREEN="\e[92m"
COLOR_RED="\e[91m"
COLOR_YELLOW="\e[93m"
COLOR_RESET="\e[0m"
BUILD_PATH="build"
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == "x86_64" ]; then
DEBUG_PATH="$BUILD_PATH/x64/Debug"
RELEASE_PATH="$BUILD_PATH/x64/Release"
else
DEBUG_PATH="$BUILD_PATH/x32/Debug"
RELEASE_PATH="$BUILD_PATH/x32/Release"
fi
build_debug() {
mkdir -p ${DEBUG_PATH}
echo
echo -e "$COLOR_CYAN ---------- GENERATING MAKEFILE ----------"
echo
cd $DEBUG_PATH
cmake -DCMAKE_BUILD_TYPE=Debug "../../.."
echo
echo -e "$COLOR_CYAN ---------- BUILDING SHARED AND STATIC LIBRARY IN DEBUG CONFIG ----------"
echo
make -j 4
cd "../../.."
}
build_release() {
mkdir -p ${RELEASE_PATH}
echo
echo -e "$COLOR_CYAN ---------- GENERATING MAKEFILE ----------"
echo
cd $RELEASE_PATH
cmake -DCMAKE_BUILD_TYPE=Release "../../.."
echo
echo -e "$COLOR_CYAN ---------- BUILDING SHARED AND STATIC LIBRARY IN RELEASE CONFIG ----------"
echo
make -j 4
cd "../../.."
}
build_all() {
#build_debug
build_release
cp build/x64/Release/libmpeg7.so java/libs
cd java/libs
ls -la
cd ..
mvn exec:exec
}
clean_project() {
echo -e "$COLOR_CYAN Cleaning project..."
if [ -d "${DEBUG_PATH}" ]; then
rm -r ${DEBUG_PATH}
fi
if [ -d "${RELEASE_PATH}" ]; then
rm -r ${RELEASE_PATH}
fi
echo -e "$COLOR_GREEN Project has been cleaned."
}
unknown_command() {
echo -e "$COLOR_RED Unknown command (forgot to set a flag?)"
echo -e "$COLOR_RESET Type 'build.sh -h' to show help."
}
ascii_art() {
cat << "EOF"
_ _ _ ______
| (_) | |____ |
| |_| |__ _ __ ___ _ __ ___ __ _ / /
| | | '_ \| '_ ` _ \| '_ \ / _ \/ _` | / /
| | | |_) | | | | | | |_) | __/ (_| |/ /
|_|_|_.__/|_| |_| |_| .__/ \___|\__, /_/
| | __/ |
|_| |___/
EOF
}
if [ "$1" == "-c" ]; then
clean_project
elif [ "$1" == "-dbg" ]; then
ascii_art
build_debug
elif [ "$1" == "-rel" ]; then
ascii_art
build_release
elif [ "$1" == "-all" ]; then
ascii_art
build_all
elif [ "$1" == "-h" ]; then
echo
echo "------------- HELP -------------"
echo "-c - Clear project."
echo "-dbg - Debug configuration build."
echo "-rel - Release configuration build."
echo "-all - Debug and Release configuration build"
else
unknown_command
fi
echo -e $COLOR_RESET