-
Notifications
You must be signed in to change notification settings - Fork 7
/
INSTALL.sh
executable file
·66 lines (55 loc) · 1.06 KB
/
INSTALL.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
#!/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
flagdebug=""
if [[ "$1" = "debug" || "$2" = "debug" ]]
then
flagdebug="-DCMAKE_BUILD_TYPE=Debug"
else
flagdebug="-DCMAKE_BUILD_TYPE=Release"
fi
flagtestnet=""
if [[ "$1" = "testnet" || "$2" = "testnet" ]]
then
flagtestnet="-DTESTNET=on"
else
flagtestnet="-DTESTNET=off"
fi
cmake .. $flagdebug $flagtestnet
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}
if [ $? -ne 0 ]; then
exit 1
fi
else
cores=`nproc --all`
if [ "${cores}" == "" ]; then
cores = 1
fi
echo "make -j${cores}"
make -j${cores}
if [ $? -ne 0 ]; then
exit 1
fi
echo "sudo make install"
sudo make install
fi
cd $origin_path