-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.sh
executable file
·61 lines (53 loc) · 1.57 KB
/
configure.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
#!/bin/bash
# relative directory where current shell script resides from where shell script was called
PROJECTDIR="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
echo "Project directory: $PROJECTDIR"
cd "$PROJECTDIR"
# Install nlohmann/json
if [[ "$OSTYPE" == "linux-gnu" ]]; then
if [ $(command -v conan) == "" ]; then
echo "config fail: conan not installed"
exit 1
fi
cd libs
conan install .
cd -
elif [[ "$OSTYPE" == "darwin"* ]]; then
if [ $(command -v brew) == "" ]; then
echo "config fail: brew not installed"
exit 1
fi
brew install nlohmann-json
else
echo "config fail: unrecognizable OS"
fi
# If setup.sh was called before
if [ -d "libs/benchmark/googletest" ]; then
rm -rf libs/benchmark
fi
# Initialize submodules if needed
git submodule update --init
# Update submodule if needed
git submodule update --recursive --remote
# Setup googletest
git clone https://github.com/google/googletest.git libs/benchmark/googletest
# Set google test to specific release tag
cd libs/benchmark/googletest
git fetch --all --tags --prune
git checkout tags/release-1.10.0 -b release-1.10.0
cd -
# Setup googlebenchmark
cd libs/benchmark
git fetch --all --tags --prune
git checkout tags/v1.5.0 -b v1.5.0
cd -
# Build and install google benchmark locally
cd libs/benchmark
mkdir -p build && cd build
cmake_flags="-DCMAKE_INSTALL_PREFIX=$PROJECTDIR/libs/benchmark/build"
if [ $(command -v ninja) != "" ]; then
cmake ../ -GNinja $cmake_flags "$@"
else
cmake ../ $cmake_flags "$@"
fi
cmake --build . --target install -- -j12