-
Notifications
You must be signed in to change notification settings - Fork 4
/
compile_components.sh
executable file
·93 lines (81 loc) · 1.99 KB
/
compile_components.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# verify if we're running Qt4 or Qt5 qmake
QT_VERSION=`qmake -query QT_VERSION`
if [[ "$QT_VERSION" =~ ^4.*$ ]]
then
echo "You're trying to build MountainLab with Qt4 ($QT_VERSION) but MountainLab only supports Qt5"
echo "Please make sure qmake from Qt5 installation is first in your PATH."
# try to find a Qt5 install in $HOME or /opt
if [ -d "/opt/Qt" ]
then
ls -1 /opt/Qt/|grep -sqe '^5\.[[:digit:]]$'
if [[ "$?" == "0" ]]
then
echo "It looks like Qt5 installation(s) might be present in /opt/Qt/"
echo
exit 1
fi
fi
if [ -d "$HOME/Qt" ]
then
ls -1 "$HOME/Qt"|grep -sqe '^5\.[[:digit:]]$'
if [[ "$?" == "0" ]]
then
echo "It looks like Qt5 installation(s) might be present in $HOME/Qt"
echo
exit 1
fi
fi
echo "If you don't have Qt5 installed, please go to http://qt.io and download Qt5"
echo
exit 1
fi
args0=""
components0=""
for var in "$@"; do
if [[ "$var" == "nogui" ]]; then
args0="$args0 \"GUI = off\""
elif [[ "$var" == "default" ]]; then
echo ""
else
components0="$components0 $var"
fi
[ "$var" == 'nogui' ] && ARGS+=("$var")
done
qmake -recursive
if [ -z "$components0" ]; then
eval qmake $args0
else
eval qmake \"COMPONENTS = $components0\" $args0
fi
NPROCCMD=$(which nproc)
if [ -z "$NPROCCMD" ]
then
$NPROCCMD="lscpu|awk '/^CPU\(s\)/ { print $2; }'"
fi
NPROC=$($NPROCCMD)
if [ -z "$NPROC" ]
then
NPROC="2"
fi
echo "Building with $NPROC parallel jobs"
make -j $NPROC
EXIT_CODE=$?
if [[ $EXIT_CODE -ne 0 ]]; then
echo "Problem in compilation."
else
make install # added by jfm on 9/7/17
echo ""
echo "Compilation successful."
RES=$(which mproc)
if [[ -z $RES ]]; then
echo ""
echo "******************************************"
echo "It appears that mproc is not"
echo "found in your path. Be sure to add"
echo "mountainlab/bin to your path. See the"
echo "installation instructions for more"
echo "information."
echo "******************************************"
fi
fi