forked from jiejieTop/mqttclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·35 lines (29 loc) · 874 Bytes
/
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
#!/bin/bash
mkdir -p build build/bin build/lib
cd build
if [ " $1" == " " ]; then
compiler="gcc"
elif [ $1 == "--help" -o $1 == "-help" -o $1 == "--h" -o $1 == "-h" ]; then
echo "usage: $0 [compiler] [compiler path]"
echo " compiler: specify the compiler you are using, default: gcc"
echo " compiler path: specify the compiler path you are using"
echo " eg:"
echo " ./build.sh"
echo " ./build.sh arm-linux-gnueabihf-gcc"
echo " ./build.sh /usr/bin/arm-linux-gnueabihf-gcc"
echo " ./build.sh arm-linux-gnueabihf-gcc /usr/bin"
exit
else
if [ " $2" == " " ]; then
compiler=$1
else
compiler=$2/$1
fi
fi
path=$(which $compiler)
if [ " $path" == " " ]; then
echo -e "\033[31mNo $compiler compiler found in the system\033[0m"
exit
fi
cmake .. "-DCMAKE_C_COMPILER=$path"
make