forked from alexh-name/bsec_bme680_linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·48 lines (39 loc) · 1000 Bytes
/
make.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
#!/bin/sh
set -eu
. ./make.config
if [ ! -d "${BSEC_DIR}" ]; then
echo 'BSEC directory missing.'
exit 1
fi
if [ ! -d "${CONFIG_DIR}" ]; then
mkdir "${CONFIG_DIR}"
fi
STATEFILE="${CONFIG_DIR}/bsec_iaq.state"
if [ ! -f "${STATEFILE}" ]; then
touch "${STATEFILE}"
fi
echo 'Patching...'
dir="${BSEC_DIR}/examples"
patch='patches/eCO2+bVOCe.diff'
if patch -N --dry-run --silent -d "${dir}/" \
< "${patch}" 2>/dev/null
then
patch -d "${dir}/" < "${patch}"
else
echo 'Already applied.'
fi
echo 'Compiling...'
gcc -Wall -Wno-unused-but-set-variable -Wno-unused-variable \
-std=c99 -pedantic \
-iquote"${BSEC_DIR}"/API \
-iquote"${BSEC_DIR}"/algo/${ARCH} \
-iquote"${BSEC_DIR}"/examples \
"${BSEC_DIR}"/API/bme680.c \
"${BSEC_DIR}"/examples/bsec_integration.c \
./bsec_bme680.c \
-L"${BSEC_DIR}"/algo/"${ARCH}" -lalgobsec \
-lm -lrt -lcurl \
-o bsec_bme680
echo 'Compiled.'
cp "${BSEC_DIR}"/config/"${CONFIG}"/bsec_iaq.config "${CONFIG_DIR}"/
echo 'Copied config.'