forked from brakmic/Using-Thrill
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile.sh
More file actions
executable file
·51 lines (44 loc) · 1.15 KB
/
compile.sh
File metadata and controls
executable file
·51 lines (44 loc) · 1.15 KB
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
#!/bin/sh
################################################################################
# compile.sh
# For downloading of external sources and automatic compilation
################################################################################
set -ex
git submodule update --init --recursive
CMAKE_OPTS=
# try to find a modern C++ compiler
set +x
COMPILERS_LIST=
for MAJOR in `seq 9 -1 4`; do
COMPILERS_LIST="$COMPILERS_LIST g++-$MAJOR"
for MINOR in `seq 9 -1 0`; do
COMPILERS_LIST="$COMPILERS_LIST g++-$MAJOR.$MINOR"
for PATCH in `seq 9 -1 0`; do
COMPILERS_LIST="$COMPILERS_LIST g++-$MAJOR.$MINOR.$PATCH"
done
done
done
#echo $COMPILERS_LIST
for CMD in $COMPILERS_LIST; do
if command -v "$CMD" > /dev/null; then
CMAKE_OPTS="$CMAKE_OPTS -DCMAKE_CXX_COMPILER=$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