Skip to content

Instantly share code, notes, and snippets.

@nlitsme
Created May 3, 2017 23:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nlitsme/04f33ec27cafd8678fddc66ecad9e828 to your computer and use it in GitHub Desktop.
Bash script for switching the current gcc compiler.
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