-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_all_cmake_projects.sh
executable file
·109 lines (94 loc) · 2.62 KB
/
build_all_cmake_projects.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
#
# various options for cmake based builds:
# CMAKE_BUILD_TYPE can specify a build (debug|release|...) build type
# LIB_SUFFIX can set the ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
# useful for 64 bit distros
# LXQT_PREFIX changes default /usr/local prefix
# LXQT_JOB_NUM Number of jobs to run in parallel while building. Defauts to
# whatever nproc returns.
# DO_BUILD flag if components should be built (default 1)
# DO_INSTALL flag if components should be installed (default 1)
# DO_INSTALL_ROOT flag if rights should be elevated during install (default 1)
#
# example:
# $ LIB_SUFFIX=64 ./build_all.sh
# or
# $ CMAKE_BUILD_TYPE=debug CMAKE_GENERATOR=Ninja CC=clang CXX=clang++ DO_INSTALL=0 ./build_all.sh
# etc.
CMAKE_REPOS=" \
libqtxdg \
liblxqt \
libsysstat \
lxqt-session \
lxqt-qtplugin \
lxqt-globalkeys \
lxqt-notificationd \
lxqt-about \
lxqt-common \
lxqt-config \
lxqt-admin \
lxqt-openssh-askpass \
lxqt-panel \
lxqt-policykit \
lxqt-powermanagement \
lxqt-runner \
libfm-qt \
pcmanfm-qt \
lximage-qt \
lxqt-sudo"
OPTIONAL_CMAKE_REPOS=" \
compton-conf \
obconf-qt"
if [[ -n "$LXQT_JOB_NUM" ]]; then
JOB_NUM="$LXQT_JOB_NUM"
else
# detect processor numbers (Linux only)
JOB_NUM=`nproc`
fi
echo "Make job number: $JOB_NUM"
if [[ -n "$CMAKE_BUILD_TYPE" ]]; then
CMAKE_BUILD_TYPE="-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE"
else
CMAKE_BUILD_TYPE="-DCMAKE_BUILD_TYPE=debug"
fi
if [[ -n "$LXQT_PREFIX" ]]; then
CMAKE_INSTALL_PREFIX="-DCMAKE_INSTALL_PREFIX=$LXQT_PREFIX"
else
CMAKE_INSTALL_PREFIX=""
fi
if [[ -n "$CMAKE_GENERATOR" ]]; then
#echo "x$CMAKE_GENERATOR"
if [[ "$CMAKE_GENERATOR" = "Ninja" ]]; then
CMAKE_MAKE_PROGRAM="ninja"
CMAKE_GENERATOR="-G $CMAKE_GENERATOR -DCMAKE_MAKE_PROGRAM=$CMAKE_MAKE_PROGRAM"
fi
fi
[[ -n "$CMAKE_MAKE_PROGRAM" ]] || CMAKE_MAKE_PROGRAM="make"
if [[ -n "$LIB_SUFFIX" ]]; then
CMAKE_LIB_SUFFIX="-DLIB_SUFFIX=$LIB_SUFFIX"
else
CMAKE_LIB_SUFFIX=""
fi
[[ -n "$DO_BUILD" ]] || DO_BUILD=1
[[ -n "$DO_INSTALL" ]] || DO_INSTALL=1
[[ -n "$DO_INSTALL_ROOT" ]] || DO_INSTALL_ROOT=1
ALL_CMAKE_FLAGS="$CMAKE_BUILD_TYPE $CMAKE_INSTALL_PREFIX $CMAKE_LIB_SUFFIX $CMAKE_GENERATOR"
for d in $CMAKE_REPOS $OPTIONAL_CMAKE_REPOS
do
echo $'\n'$'\n'"Building: $d using externally specified options: $ALL_CMAKE_FLAGS"$'\n'
mkdir -p "$d/build" \
&& cd "$d/build" \
|| exit 1
if [[ "$DO_BUILD" = 1 ]]; then
cmake $ALL_CMAKE_FLAGS .. && "$CMAKE_MAKE_PROGRAM" -j$JOB_NUM || exit 1
fi
if [[ "$DO_INSTALL" = 1 ]]; then
if [[ "$DO_INSTALL_ROOT" = 1 ]]; then
sudo "$CMAKE_MAKE_PROGRAM" install || exit 1
else
"$CMAKE_MAKE_PROGRAM" install || exit 1
fi
fi
cd ../..
done