I’m new to both programming and arduino, but I spent about a year learning how to program in Lua (including how to set up a programming environment and IDE) and six months learning how arduino/micro python stuff works (including basic arduino IDE functions, how thonny works, i2c, and basic micro python).
I’m hitting a wall though where a lot of projects posted to GitHub that I want to try implementing are provided as cmake files. I’ve finally tried to learn how to make these, and it seems almost as complicated as everything else I’ve learned. It looks like I need to learn about C, learn cmake language, and understand compilers much deeper than necessary for other projects.
Introductory documents on cmake all sound like they’re written for professional developers, and it’s a little hard understanding why the tool is suitable for arduino development, especially since other projects don’t seem to require it.
Is this just something I have to learn to get deeper into programming, or is something else going on here? Any thoughts would be appreciated (or suggestions about places to get started with Cmake).
OK, I know what it is, but I have not used it, written anything or needed to understand it and I get in plenty of trouble and have enough fun without it.
I don't recall seeing a Cmake question in the Arduino fora.
I haven't seen any GitHub projects, or any projects anywhere, mention let alone depend on Cmake.
Unfortunately, most of what I want to achieve is doable with micropython, and I was lucky enough to take a class on python that made that a lot easier.
The only exceptions are development tools for really specific cases that are provided as CMake files, or projects that other people have made that I'd like to try. For example, I'm building a tamagotchi loosely based on a wonderswan game; someone actually made a full wonderswan emulator for RP2040, so it would be super cool to actually experience the original wonderswan game on the device I'm building...but it's a Cmake project.
I'm basically making this post in part to gauge whether Cmake is a hill that's worth climbing for the long-term learning potential, or a quagmire that's going to distract me...it's sounding like the latter.
I have used Cmake when doing things outside the Arduino environment, for example on the Raspberry Pi for programming in C/C++ for the Pico 2040. I have only enough knowledge to get a new project going. I am much more of a hardware guy than a software one.
On an Arduino this sort of thing is taken care of by the Mbed or the earlephilhower alternative.
Either of those two frameworks would allow you to program on an Arduino, what you would have to do in an other environment.
I was definitely worried that speed might become an issue as the project gets larger, but from the examples I've seen, I think the type of game I'm making should be able to run without too much issue on the RP2040, even in Micropython.
I actually reached out to the dev of the project I wanted to build, and he explained that it's written in C and provided this guide to CLion that looks like it could answer a lot of my questions.
It still remains to be seen if CMake will be a stumbling block, but at least now I have a guide that 1.Includes using CMake 2. in the context of RP2040 compiling but 3. for total beginners.
AFAICT, "CMake" is a tool for creating build environments (eg Makefiles) for systems that have particularly complex directory layouts for their source, libraries, SDKs, and so on.
It has nothing to do with runtime execution speed.
For example, the rp2040 SDK uses CMake because a typical build will end up with compile commands that are several thousand characters long, by the time all of the necessary "-Ipathname" needed are taken into account.
The Arduino IDE has its own methods of doing similar things, so CMake is irrelevant to Arduino projects. You occasionally see projects designed to run on Arduino hardware that don't use the IDE for the build step, and they sometimes uses CMake. (But usually you won't need to "know" CMake to build those projects.)
Micropython, of course, is a non-Arduino-IDE thing. So MicroPython projects might use CMake.
I think the clue here is in the name, CMake is to make C programs, nothing else. It is not called PYmake, or something similar.
I am not sure anyone is expecting this to happen. I thought the discussion was whether a Python solution would be fast enough for the OP.
I have found Python is fast enough to do projects involving generating MIDI commands for example. But not fast enough for generating anything but simple waveforms and doing DSP (Digital Signal Processing) projects.
I’m hitting a wall though where a lot of projects posted to GitHub that I want to try implementing are provided as cmake files.
A majority of open-source C and C++ libraries are built using CMake, or at least support integration into a user's CMake project.
Sometimes this may indicate that these libraries are not specifically designed to be used with Arduino, but some Arduino libraries also include a CMakeLists.txt file that is used to build the tests etc. Even other libraries may be supported on Arduino, but can also be used in a more traditional C++ project, and include a CMakeLists.txt for such use cases (see e.g. How to use ArduinoJson with CMake?).
Not necessarily for complex projects. CMake is the de facto standard for building cross-platform C and C++ applications and libraries. Even for the simplest single-file C++ programs, it has significant advantages over low-level alternatives like Make.