Arduino-CMake is a cmake-based toolchain which allows developers to build/compile and upload Arduino programs using any tool which supports cmake. In other words, developers no longer need to use the Arduino IDE in order to write Arduino code, but instead can use their favorite IDEs or text editors!
The Arduino IDE lacks many features that are expected from a modern IDE or even a text editor. However, it's the de-facto for developing Arduino programs.
With Arduino-CMake, it doesn't have to be this way.
Arduino programs are built using avr-gcc
- A derivative of the gcc compiler which makes it perfect for make
files and thus cmake. Once built, it can be uploaded to a serial port over which the Arduino board is connected using avr-dude
.
This is what allows Arduino-CMake to work out-of-the-box on every OS, in every IDE.
The original project has started back in 2011 by queezythegreat, and had been actively developed until 2014. Since then the project has been somewhat "dead" for 3 years, with various forks spreading over GitHub. Then, in 2017, a combined effort by JonasProgrammer and MrPointer has brought new life to the project in the face of the arduino-cmake organization. Since then, many great contributions has been made to the project, leading it to where it is today.
Arduino-CMake can do anything that the Arduino IDE can, besides:
- Supporting "big" platforms other than Arduino, such as ESP.
However, it allows some things that Arduino IDE doesn't:
- Developing Arduino code in any IDE or text editor
- Completely customizing the build process
Additionally, it's worth mentioning that Arduino-CMake is entirely cross platform.
A very basic example of how Arduino-CMake can be used is listed below:
cmake_minimum_required(VERSION 2.8)
# Include Arduino-CMake Toolchain
set(CMAKE_TOOLCHAIN_FILE [ARDUINO_CMAKE_PATH]/ArduinoToolchain.cmake)
#====================================================================#
# Setup Project #
#====================================================================#
project(MyProject C CXX ASM)
#====================================================================#
# Create Arduino's Executable
#====================================================================#
generate_arduino_firmware(${CMAKE_PROJECT_NAME}
SRCS main.cpp
BOARD uno
PORT /dev/ttyACM0)
This is cmake code inside the CMakeLists.txt
file of the MyProject
project.
Very simple, yet super extensible.
A complete installation guide can be found in the Installation Wiki page.
The entire documentation of the project is hosted on GitHub using Wiki pages.
The project has strict contributing guidelines which can be found in the Contributing File.
MIT © 2018 Arduino-CMake