blob: 063bcfbff082823e47d2a91b73021ee49602e068 (
plain)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Compile test builder.
#
# Call a meson/ninja build with all combinations of gcc/clang identifyied in
# the path using compgen. Builds are left in tree, allowing incremental builds
# on each call.
source ./common.sh
LIBCAMERA=${1:-$(srcdir libcamera)}
# Override the default build ID
ID=build-matrix
check_version $LIBCAMERA $ID
echo "Build-matrix for libcamera at version : " $(libcamera_version "$LIBCAMERA")
## Identify supported compilers
# CLANG uses clang and clang++
function find_clang_compilers() {
compgen -c clang | grep -E "^clang[++]*-[0-9]+"
}
# GCC uses g++ and gcc
function find_gcc_compilers() {
compgen -c gcc | grep -E "^gcc-[0-9]+"
compgen -c g++ | grep -E "^g\+\+-[0-9]+"
}
gccs=$(find_gcc_compilers)
clangs=$(find_clang_compilers)
# Given a list of xxx-[0-9]+ return a list of
# [0-9]+ where two occurences appear in the list.
function filter_version_pairs() {
for v in "$@";
do echo "$v" | sed 's/.*-//';
done | sort -n | uniq -d;
}
configurations=()
# Generate a list of compiler configurations where both the C and C++ compiler
# have been identified
for v in $(filter_version_pairs $gccs); do
configurations+="gcc-$v:g++-$v "
done;
for v in $(filter_version_pairs $clangs); do
configurations+="clang-$v:clang++-$v "
done;
#### Building and compiling
function build() {
echo "Building for $1"
BUILDDIR="$(builddir $ID)/$1"
CC="$1"
CXX="$2"
echo "Checking for libcamera builddir: $BUILDDIR"
if [ ! -d "$BUILDDIR" ]; then
CC=$CC \
CXX=$CXX \
meson "$BUILDDIR" "$LIBCAMERA" \
-Dv4l2=true \
-Dandroid=enabled \
-Ddocumentation=disabled \
-Dgstreamer=enabled \
-Dlc-compliance=enabled
fi
ninja -C "$BUILDDIR"
}
function build_simple_cam() {
LIBCAMERA_BUILD="$(builddir $ID)/$1"
LIBCAMERA_BUILD=$(realpath -L $LIBCAMERA_BUILD/meson-uninstalled/)
CC="$1"
CXX="$2"
SIMPLE_CAM=$(srcdir simple-cam)
if [ ! -d $SIMPLE_CAM ]; then
git clone https://git.libcamera.org/libcamera/simple-cam.git $SIMPLE_CAM
fi
echo Using: $LIBCAMERA_BUILD
cd $SIMPLE_CAM
git pull --ff-only
BUILDDIR="$(builddir $ID)/$1-simple-cam"
# Always build simple-cam from clean
rm -fr "$BUILDDIR"
PKG_CONFIG_PATH=$LIBCAMERA_BUILD \
CC=$CC \
CXX=$CXX \
meson "$BUILDDIR"
ninja -C "$BUILDDIR"
ret=$?
cd -
return $ret
}
mkdir -p $(builddir $ID)
echo "Identified toolchain configurations:"
for conf in ${configurations}
do
# Split gcc-7:g++-7 to gcc-7 g++-7
parsed=(${conf//:/ })
echo " Configuration: $conf"
done
echo
echo "Commencing builds:"
for conf in ${configurations}
do
# Split gcc-7:g++-7 to gcc-7 g++-7
parsed=(${conf//:/ })
toolchain=${parsed[0]}
logfile=$(log_filename $ID-$toolchain)
echo "Configuration: $conf ($logfile)"
build ${parsed[@]} > $logfile
pass_fail $? "libcamera $toolchain:"
build_simple_cam ${parsed[@]} >> $logfile
#pass_fail $? "simple-cam $toolchain:"
done
# Summarise build results
BUILDDIR="$(builddir $ID)/$1"
(cd $(builddir $ID) && ls -alh -sv */src/libcamera/libcamera.so)
completed $ID
|