forked from claws/BH1750
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-examples.bash
executable file
·36 lines (30 loc) · 1.18 KB
/
build-examples.bash
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
#!/usr/bin/env bash
#
# A simple script to automate building BH1750 examples.
#
# Example (MacOSX):
# $ ARDUINO_IDE_PATH=/Applications/Arduino.app/Contents/Java ./build-examples.bash
#
# Path to script directory.
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
LIBNAME="$(basename "$SCRIPTPATH")"
if [[ -z "${ARDUINO_IDE_PATH}" ]]; then
echo "ARDUINO_IDE_PATH env var is not set"
exit 1
fi
# Link BH1750 library into Arduino libraries directory
ln -s $SCRIPTPATH $ARDUINO_IDE_PATH/libraries/
cd $ARDUINO_IDE_PATH
for sketch in `find $SCRIPTPATH/examples -name '*.ino'`
do
echo "Compiling $sketch"
./arduino-builder -hardware ./hardware -tools ./hardware/tools/avr -tools ./tools-builder -libraries ./libraries -fqbn arduino:avr:uno --prefs "compiler.warning_level=all" $sketch
# ./arduino-builder -hardware ./hardware -tools ./hardware/tools/avr -tools ./tools-builder -libraries ./libraries -fqbn esp8266:esp8266:generic --prefs "compiler.warning_level=all" $sketch
if [ $? -ne 0 ]; then
echo -e "\xe2\x9c\x96" # check icon
else
echo -e "\xe2\x9c\x93" # tick icon
fi
done
# Unlink BH1750 library from Arduino libraries directory
unlink $ARDUINO_IDE_PATH/libraries/$LIBNAME