forked from thrill/thrill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·58 lines (50 loc) · 1.46 KB
/
compile.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
#!/bin/sh
################################################################################
# compile.sh
#
# Part of Project Thrill - http://project-thrill.org
#
# Copyright (C) 2016 Timo Bingmann <tb@panthema.net>
#
# All rights reserved. Published under the BSD-2 license in the LICENSE file.
################################################################################
set -ex
git submodule update --init --recursive
CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Release -DTHRILL_BUILD_EXAMPLES=ON -DTHRILL_BUILD_TESTS=ON"
# try to find a modern C++ compiler
set +x
COMPILERS_LIST=
for MAJOR in `seq 9 -1 4`; do
COMPILERS_LIST="$COMPILERS_LIST $MAJOR"
for MINOR in `seq 9 -1 0`; do
COMPILERS_LIST="$COMPILERS_LIST $MAJOR.$MINOR"
for PATCH in `seq 9 -1 0`; do
COMPILERS_LIST="$COMPILERS_LIST $MAJOR.$MINOR.$PATCH"
done
done
done
#echo $COMPILERS_LIST
for CMD in $COMPILERS_LIST; do
if command -v "g++-$CMD" > /dev/null; then
CMAKE_OPTS="$CMAKE_OPTS -DCMAKE_C_COMPILER=gcc-$CMD -DCMAKE_CXX_COMPILER=g++-$CMD"
break
fi
done
set -x
# detect number of cores
if [ -e /proc/cpuinfo ]; then
CORES=$(grep -c ^processor /proc/cpuinfo)
elif [ "$(uname)" == "Darwin" ]; then
CORES=$(sysctl -n hw.ncpu)
else
CORES=4
fi
MAKEOPTS=-j$CORES
if [ ! -d "build" ]; then
mkdir build
fi
cd build
cmake .. $CMAKE_OPTS $@
make $MAKEOPTS
ctest -V
################################################################################