-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetup.sh
executable file
·48 lines (36 loc) · 1.28 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
#! /bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd "$SCRIPT_DIR" >/dev/null
export C_COMPILER=clang
export COMPILER=clang++
mkdir -p build
pushd build >/dev/null
# ==============================================================================
# -- Get and compile GTest -----------------------------------------------------
# ==============================================================================
# Get googletest source
if [[ ! -d "googletest-source" ]]; then
echo "Retrieving googletest..."
git clone --depth=1 -b release-1.8.0 https://github.com/google/googletest.git googletest-source
else
echo "Folder googletest-source already exists, skipping git clone..."
fi
pushd googletest-source >/dev/null
cmake -H. -B./build \
-DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \
-DCMAKE_INSTALL_PREFIX="../googletest-install" \
-G "Ninja"
pushd build >/dev/null
ninja
ninja install
popd >/dev/null
popd >/dev/null
# ==============================================================================
# -- ...and we are done --------------------------------------------------------
# ==============================================================================
popd >/dev/null
popd >/dev/null
set +x
echo ""
echo "Success!"