Created
May 3, 2017 23:48
-
-
Save nlitsme/04f33ec27cafd8678fddc66ecad9e828 to your computer and use it in GitHub Desktop.
Bash script for switching the current gcc compiler.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ -z "$1" ]]; then | |
exit 1 | |
fi | |
if [[ -e $1/bin/avr-gcc-7.1.0 ]]; then | |
cppopt=gnu++1z | |
elif [[ -e $1/bin/avr-gcc-4.9.2 ]]; then | |
cppopt=gnu++11 | |
else | |
echo unknown compiler version | |
exit 1 | |
fi | |
HWDIR=~/Applications/Arduino.app/Contents/Java/hardware | |
# assuming tools/avr is already a symlink | |
rm $HWDIR/tools/avr | |
ln -s "$1" $HWDIR/tools/avr | |
perl -i.bak -ple "s/gnu\+\+1\w/$cppopt/" $HWDIR/arduino/avr/platform.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment