-
Notifications
You must be signed in to change notification settings - Fork 1
/
start.sh
executable file
·56 lines (50 loc) · 1.15 KB
/
start.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
#!/usr/bin/env bash
set -x -e
DEPS_PREFIX=$(pwd)/third-party
mkdir -p "${DEPS_PREFIX}/src"
install_libraries() {
# 安装gtest
if [ "$1"x == "gtest"x ] || [ "$2"x == "gtest"x ]; then
cd "${DEPS_PREFIX}"/src
git clone https://github.com/google/googletest
cd googletest
cmake .
make
sudo cp lib/libgtest*.a /usr/lib
sudo cp -a googletest/include/gtest/ /usr/include
cd -
fi
# 安装boost
if [ "$1"x == "boost"x ] || [ "$2"x == "boost"x ]; then
cd "${DEPS_PREFIX}"/src
if [ ! -f boost_1_71_0.tar.gz ]; then
wget http://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.gz
fi
tar zxvf boost_1_71_0.tar.gz
cd boost_1_71_0
./bootstrap.sh --with-libraries=all --with-toolset=gcc
./b2 toolset=gcc
./b2 install --prefix=/usr/local
ldconfig
cd -
fi
}
usage() {
echo '
install:安装依赖库,后跟依赖库名,多个依赖库用空格分割
示例:
./start.sh install boost gtest 安装boost和gtest'
}
if [ $# == 0 ]; then
usage
exit 1
fi
case $1 in
install)
install_libraries $2 $3
;;
*)
echo "Unknown command $1"
usage
;;
esac