-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup.sh
executable file
·49 lines (44 loc) · 1.13 KB
/
setup.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
#!/bin/bash
GMOCK="gmock-1.7.0"
LIB_DIR="lib"
GMOCK_DIR="$LIB_DIR/$GMOCK"
GMOCK_ZIP="${GMOCK}.zip"
GMOCK_ZIP_URL="https://googlemock.googlecode.com/files/${GMOCK_ZIP}"
function setup_build_directory()
{
build_name=$1
dir_name=$(echo $build_name | tr '[:upper:]' '[:lower:]')
if [ ! -d "$dir_name" ]; then
echo ">> creating $dir_name directory..."
mkdir $dir_name
fi
echo ">> running cmake in ${dir_name}..."
cd $dir_name
if ! cmake .. -DCMAKE_BUILD_TYPE=$build_name \
-DGMOCK_ROOT=$GMOCK_DIR > /dev/null; then
echo ">> error running cmake!"
exit 1
fi
cd ..
}
function setup_gmock()
{
if [ ! -d "$GMOCK_DIR" ]; then
echo ">> downloading gmock..."
cd "$LIB_DIR"
if ! wget $GMOCK_ZIP_URL > /dev/null; then
echo ">> error running wget!"
exit 1
fi
echo ">> uncompressing zip..."
if ! unzip $GMOCK_ZIP > /dev/null; then
echo ">> error running unzip!"
exit 1
fi
cd ..
fi
}
setup_gmock
setup_build_directory "Debug"
setup_build_directory "Release"
exit 0