From 4ea325f96612bba1260346017c3c6a5dbfc774d4 Mon Sep 17 00:00:00 2001 From: Florian Fleissner Date: Thu, 19 Dec 2019 14:57:09 +0200 Subject: [PATCH] Added a compiler/Arduino version check The build now fails if the avr-gcc version is too old. A verbose error message reports Arduino upgrade information. Signed-off-by: Florian Fleissner --- README.md | 2 +- src/Kaleidoscope.h | 1 + src/kaleidoscope/version.h | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/kaleidoscope/version.h diff --git a/README.md b/README.md index 9767565e..42342c21 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ If you're just getting started with the Keyboardio Model 01, the [introductory d ## Setup the Arduino IDE -Setup the Arduino IDE on your system. Make sure you install at least version 1.6, since older version may not support all required features. +Setup the Arduino IDE on your system. Make sure you install at least version 1.8.6, since older version may not support all required features. * On Linux, follow the instructions [on the wiki](https://github.com/keyboardio/Kaleidoscope/wiki/Install-Arduino-support-on-Linux). * On macOS, install using [homebrew](http://brew.sh/) [cask](https://caskroom.github.io/) with `brew cask install arduino` or download the application from [the official website](https://www.arduino.cc/en/Main/Software) and move it to your `/Applications` folder. diff --git a/src/Kaleidoscope.h b/src/Kaleidoscope.h index 321ce65e..efaa6938 100644 --- a/src/Kaleidoscope.h +++ b/src/Kaleidoscope.h @@ -36,6 +36,7 @@ void setup(); #include #include +#include "kaleidoscope/version.h" #include "kaleidoscope/device/device.h" #include "kaleidoscope/device/key_indexes.h" #include "kaleidoscope_internal/device.h" diff --git a/src/kaleidoscope/version.h b/src/kaleidoscope/version.h new file mode 100644 index 00000000..333d5bae --- /dev/null +++ b/src/kaleidoscope/version.h @@ -0,0 +1,11 @@ +#pragma once + +#define KALEIDOSCOPE_AVR_GCC_MINIMAL_VERSION 5 +#define KALEIDOSCOPE_AVR_GCC_MINIMAL_MINOR 4 + +#if (__GNUC__ < KALEIDOSCOPE_AVR_GCC_MINIMAL_VERSION) \ + || ( (__GNUC__ == KALEIDOSCOPE_AVR_GCC_MINIMAL_VERSION) \ + && (__GNUC_MINOR__ < KALEIDOSCOPE_AVR_GCC_MINIMAL_MINOR) \ + ) +#error Kaleidoscope requires Arduino version >= 1.8.6 to build. Please upgrade. +#endif