From 56a729260f7f23dd87ab88f45ce029616ff2109b Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Mon, 24 Aug 2020 11:53:29 +0200 Subject: [PATCH] kaleidoscope-builder: Allow easily selecting a compiler While we do not currently support any other compiler than the gcc suite, we eventually want to. Meanwhile, we also want to be able to easily switch to gcc when that's not the default on the system. For this reason, we introduce `KALEIDOSCOPE_COMPILER`, which can be set to `gcc` or `clang`, and `kaleidoscope-builder` will then set up the appropriate basenames. This, combined with the previous change, allows us to easily select gcc for virtual builds, even when clang is the default on the system. Signed-off-by: Gergely Nagy --- etc/kaleidoscope-builder.conf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/etc/kaleidoscope-builder.conf b/etc/kaleidoscope-builder.conf index 01a2e77e..d3c310aa 100644 --- a/etc/kaleidoscope-builder.conf +++ b/etc/kaleidoscope-builder.conf @@ -35,6 +35,23 @@ if [ -z "${FQBN}" ]; then FQBN="${FQBN:-keyboardio:avr:${BOARD}}" fi +if [ ! -z "${KALEIDOSCOPE_COMPILER}" ]; then + case "${KALEIDOSCOPE_COMPILER}" in + gnu|gcc|g++) + C_COMPILER_BASENAME=gcc + CXX_COMPILER_BASENAME=g++ + ;; + clang) + C_COMPILER_BASENAME=clang + CXX_COMPILER_BASENAME=clang++ + ;; + *) + echo "Unsupported compiler: ${KALEIDOSCOPE_COMPILER}" >&2 + exit 1 + ;; + esac +fi + ######## ######## Host OS specific commands ########