-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetupenv.sh
56 lines (43 loc) · 1.15 KB
/
setupenv.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
#!/bin/bash
# Helper for adding a directory to the stack and echoing the result
enterDir() {
echo "Entering $1"
pushd $1 > /dev/null
}
# Helper for popping a directory off the stack and echoing the result
leaveDir() {
echo "Leaving `pwd`"
popd > /dev/null
}
function clone_proj {
local proj_url=$1
local local_dir=$2
local branch=$3
git clone $proj_url $local_dir
enterDir $local_dir
git checkout $branch
leaveDir
}
function build_install_module {
local module_dir=$1
local module_build_dir=$module_dir/_build
mkdir $module_build_dir
enterDir $module_dir/_build
cmake .. && make && make install
leaveDir
}
if [ ! -d "modules" ]; then
mkdir modules
fi
if [ ! -d "modules/gflags" ]; then
clone_proj "https://github.com/gflags/gflags.git" "modules/gflags" "v2.2.2"
fi
build_install_module "modules/gflags"
if [ ! -d "modules/gtest" ]; then
clone_proj "https://github.com/google/glog.git" "modules/glog" "v0.4.0"
fi
build_install_module "modules/glog"
if [ ! -d "modules/googletest" ]; then
clone_proj "https://github.com/google/googletest.git" "modules/googletest" "release-1.8.1"
fi
build_install_module "modules/googletest"