forked from alexh-name/bsec_bme680_linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·50 lines (40 loc) · 1.02 KB
/
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
48
49
#!/bin/sh
#set -x
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/bsec_iot_example"
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
EXAMPLES_DIR="${BSEC_DIR}/examples/bsec_iot_example"
echo 'Compiling...'
cc -Wall -Wno-unused-but-set-variable -Wno-unused-variable -static \
-std=c99 -pedantic \
-iquote"${BSEC_DIR}"/algo/${ARCH} \
-iquote"${EXAMPLES_DIR}" \
"${EXAMPLES_DIR}"/bme680.c \
"${EXAMPLES_DIR}"/bsec_integration.c \
./bsec_bme680.c \
-L"${BSEC_DIR}"/algo/"${ARCH}" -lalgobsec \
-lm -lrt \
-o bsec_bme680
echo 'Compiled.'
cp "${BSEC_DIR}"/config/"${CONFIG}"/bsec_iaq.config "${CONFIG_DIR}"/
echo 'Copied config.'