[CMake] [New Module] Arduino CMake
Alexander Neundorf
a.neundorf-work at gmx.net
Wed Jan 25 12:19:49 EST 2012
On Wednesday 25 January 2012, Alfa Omega wrote:
> A little addendum to what I wrote earlier.
>
> On Wed, Jan 25, 2012 at 8:54 AM, Alfa Omega <queezythegreat at gmail.com>wrote:
> > 2012/1/24 Alexander Neundorf <a.neundorf-work at gmx.net>
> >
> >> Hi,
> >>
> >> On Tuesday 24 January 2012, Alfa Omega wrote:
> >> > Hi,
> >> >
> >> > What part does not follow the convention? I'm using a toolchain file,
> >>
> >> plus
> >>
> >> > when I was writing this I based it on a existing module bundled with
> >>
> >> CMake
> >>
> >> > (but cant remember which).
> >> >
> >> > I'm open to modifying my project to match the convention. If you could
> >> > point out which parts don't quite meet the convention, I would greatly
> >> > appreciate that.
> >>
> >> The functions in ArduinoProcessing.cmake should have a common prefix to
> >> show
> >> where they come from, e.g. ARDUINO_
> >
> > ArduinoProcessing.cmake is a prototype, and isn't used with Arduino
> > CMake, so you can ignore that.
> >
> >> Same for the functions in FindArduino.cmake
> >> The documentation for the functions should be at the top of the file, so
> >> when
> >> cmake generates documentation, it will be included.
> >
> > The documentation for the module is located at the top (only those two
> > function should be used), all other function are for internal use (but
> > are documented).
>
> When I originally wrote this, I wanted to hide as much of the boilerplate
> code as I could (hence I wanted people to use those two functions
> documentated at the top). Now I'm starting to think that apart from
> setup_arduino_compiler and setup_arduino_core (which could be merged into
> one) everything else could be used if someone who wanted control the build
> process manually. So that's why the documentation for the rest of the
> function where omitted from the top.
Ok.
Still they should all use the "arduino_" prefix.
> > setup_arduino_compiler() looks wrong.
> >
> > What do you mean by it looks wrong (the name might not be the best :))?
>
> Do you mean setup_arduino_compiler and setup_arduino_core should be merged?
Well, this should be done in the host/compiler setup steps, i.e. in
Arduino.cmake and Arduino-GNU-C.cmake and Arduino-GNU-CXX.cmake (this is using
gcc, right ?).
>
> >> Did you consider adding Arduino as "operating system" ?
> >> Then you could add a
> >> Platforms/Arduino.cmake
> >> which is loaded automatically when CMAKE_SYSTEM_NAME is set to Arduino.
> >
> > Ah, I just see, you did.
> >
> >> Is there are reason why you didn't put all the functions, settings, etc.
> >> there
> >> ?
> >> Then it wouldn't be necessary to use FindArduino.cmake when you already
> >> know
> >> you are building for Arduino.
> >> (e.g. there is no FindWindows.cmake, you simply are on Windows, or the
> >> cmake
> >> run fails).
> >
> > That is a good point, but then how could I specify that I want a specific
> > minimal version?
> >
> > The toolchain file should be mostly done after the first three set()
> > calls
> >
> >> you
> >> have. More or less all of the rest should be in Arduino.cmake or
> >> Arduino-GNU-
> >> C/CXX.cmake.
> >
> > What is the best way to initialize the compiler flags? And where should I
> > move the rest of the stuff that in the toolchain file?
See above, in the platform specific files.
> >> The functions for setting up additional targets look ok.
> >>
> >> What should find_sources() be used for ?
> >
> > It's used for getting all the sources located at specified path, because
> > there is some processing of the sources (for Arduino library detection
> > based on the header includes).
Can you please explain more ?
Are these source files from the user, or are they part of arduino ?
Alex
More information about the CMake
mailing list