I would like to link an external library with a Kaleidoscope plugin.
The external library is supposed to be build as part of the overall firmware build process. It comes with a CMake build system, is written in C and can already be compiled with avr-gcc.
Tasks to solve
Build the external library based on its CMake build system. Thereby the compiler used for the plugin is supposed to be made known to the CMake build system.
Tell the Kaleidoscope plugin build where to find the external library’s include directories.
Link the external static library with the Kaleidoscope plugin. Make sure that the library is already build.
Probably all boils down to extending the plugin’s Makefile?
I’m afraid I’ll have to be the bearer of bad news: Kaleidoscope plugins use the Arduino build system under the hood, and are supposed to work without any makefile at all, from the Arduino IDE. This means they have to follow a certain layout, have a library.properties file at their root, and so on. Introducing CMake into this mix would be… challenging, to say the least.
The easiest way to use an external library is to make that library Arduino-compatible, and then just use it like any other library: put it somewhere the arduino tools can find it, and #include "LibraryHeader.h" and let the tools figure out the rest.
What’s the purpose of the Makefiles in Kaleidoscopes directory structure?
Alright, I will go ahead and make the external library Arduino compatible.
Is there absolutely no way to tell the Arduino IDE to perform additional steps during build that would allow for external commands/executables, etc. being executed?
They’re there to help building without the IDE (but still use the underlying arduino-builder tool). The makefiles don’t do much but call out to kaleidoscope-builder, which is a big hack around arduino-builder that sets up some parameters and post-processes the output here and there.
To the best of my knowledge, no. Not in a reasonable way on the library level. You can tell the Arduino tools a few things (on a board level), but that is both awkward and too high level. So the easiest course of action is still to make the library Arduino-compatible.
Here is a link to the current arduino library specification for all those of you that also have external libraries that they want to use in Kaleidoscope plugins.