This repository has been archived by the owner on Aug 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.sh
executable file
·63 lines (50 loc) · 1.59 KB
/
build.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
62
63
#!/bin/bash
set -x
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-7 90 \
--slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives \
--install /usr/bin/clang clang /usr/bin/clang-7 90 \
--slave /usr/bin/clang++ clang++ /usr/bin/clan7++-6
sudo update-alternatives --config gcc
sudo update-alternatives --config clang
export NPROC=$(nproc)
else
export NPROC=$(sysctl -n hw.cpu)
fi
if [ -z "$TRAVIS_BRANCH" ]; then
export TRAVIS_BRANCH=`git rev-parse --abbrev-ref HEAD`
fi
if [ ! -d stlab ]; then
echo "Cloning stlab/$TRAVIS_BRANCH..."
git clone --branch $TRAVIS_BRANCH https://github.com/stlab/libraries.git stlab
if [ $? -ne 0 ]; then exit 1; fi
else
echo "Found stlab. Pulling $TRAVIS_BRANCH..."
cd stlab
git checkout origin/$TRAVIS_BRANCH
if [ $? -ne 0 ]; then exit 1; fi
cd ..
fi
if [ ! -d boost ]; then
if [ ! -f boost.tgz ]; then
echo "Downloading boost..."
curl -L https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz -o boost.tgz
if [ $? -ne 0 ]; then exit 1; fi
fi
mkdir -p boost
echo "Unpacking boost headers..."
tar -C boost -xzf boost.tgz --strip-components 1 boost_1_64_0/boost/
if [ $? -ne 0 ]; then exit 1; fi
echo "Unpacking boost sources..."
tar -C boost -xzf boost.tgz --strip-components 1 boost_1_64_0/libs/
if [ $? -ne 0 ]; then exit 1; fi
else
echo "Found boost..."
fi
mkdir -p build
cd build
cmake -D CMAKE_BUILD_TYPE=Debug -D BOOST_ROOT=../boost $@ ..
make -j$NPROC
ctest -j$NPROC