-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathINSTALL.sh
More file actions
executable file
·51 lines (43 loc) · 826 Bytes
/
INSTALL.sh
File metadata and controls
executable file
·51 lines (43 loc) · 826 Bytes
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
#!/bin/bash
origin_path=$(cd `dirname $0`; pwd)
cd `dirname $0`
# create build directory
if [ ! -d "build/" ]; then
mkdir build
fi
# go to build
cd build
# cmake
flag=""
if [ "$1" == "debug" ]; then
flag="-DCMAKE_BUILD_TYPE=Debug"
else
flag="-DCMAKE_BUILD_TYPE=Release"
fi
cmake .. $flag
if [ $? -ne 0 ]; then
cd $origin_path
exit 1
fi
# make & install
os=`uname`
if [ "$os" == "Darwin" ]; then
cores=`sysctl -n hw.logicalcpu`
if [ "${cores}" == "" ]; then
cores = 1
fi
echo "make install -j${cores}"
make install -j${cores}
else
cores=`nproc --all`
if [ "${cores}" == "" ]; then
cores = 1
fi
echo "make -j${cores}"
make -j${cores}
if [ $? == 0 ]; then
echo "sudo make install"
sudo make install
fi
fi
cd $origin_path