https://github.com/arduino-cmake/Arduino-CMake-NG
CMake-Based framework for Arduino platforms
https://github.com/arduino-cmake/Arduino-CMake-NG
arduino arduino-ide arduino-platform build build-system build-tool cmake cmake-toolchain make ninja
Last synced: 3 months ago
JSON representation
CMake-Based framework for Arduino platforms
- Host: GitHub
- URL: https://github.com/arduino-cmake/Arduino-CMake-NG
- Owner: arduino-cmake
- License: mit
- Archived: true
- Created: 2018-09-05T17:13:02.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-17T14:23:31.000Z (over 2 years ago)
- Last Synced: 2025-05-15T08:23:56.609Z (5 months ago)
- Topics: arduino, arduino-ide, arduino-platform, build, build-system, build-tool, cmake, cmake-toolchain, make, ninja
- Language: CMake
- Homepage:
- Size: 3.37 MB
- Stars: 143
- Watchers: 11
- Forks: 39
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Authors: AUTHORS.md
Awesome Lists containing this project
README
# Arduino-CMake NG
[](https://ci.appveyor.com/project/arduino-cmake/arduino-cmake-ng)[](https://travis-ci.org/arduino-cmake/Arduino-CMake-NG)
**Arduino-CMake** is a framework which allows developers to write Arduino-based programs using any tool that supports cmake. *Arduino-based*? There are many other frameworks out there built upon Arduino's base, such as ESP32, and we respect that (Note that it doesn't mean we support it yet).
In other words, developers can use their favorite IDEs or text editors on their favorite OS to develop Arduino programs!Wait - Hasn't it been possible all this time? Apparently not. You can read more about it in the [Motivation](#Motivation) section.
> Note to new users: The master branch is used for active development only, so if you seek to simply use the framework then you should head to the [releases section](https://github.com/arduino-cmake/Arduino-CMake-NG/releases) instead!
## Important Notice
This project is dead and is no longer maintained! You can find more info [here](https://github.com/arduino-cmake/Arduino-CMake-NG/issues/100).
However, there's a new framework named [Arduino-CMake-Toolchain](https://github.com/a9183756-gh/Arduino-CMake-Toolchain) that took the basis of this project and continued it very well - **Please use it!**
## Features**Arduino-CMake** should[1](#f1) do almost[2](#f2) anything that the **Arduino IDE** does!
#### What's supported?- [x] Developing Arduino programs in any IDE or text editor
- [x] Arduino Programs - *Executables*
- [x] Uploading/Flashing programs to hardware boards
- [x] Libraries
- [x] Arduino *native* libraries, built-in with most of the SDKs (such as **Blink**)
- [x] 3rd Party libraries
- [x] User libraries
- [x] Arduino example programs
- [x] Arduino library example programs
- [x] Arduino sketches (`.ino` files)
- [x] Conversion of sketch files to `.cpp` source files
- [ ] Resolving libraries used by a sketch file
- [ ] Generating required function prototypes/signatures in converted sources
- [ ] 3rd Party platforms (such as **ESP32**, **pinoccio**, etc.)
- [ ] Programmers and bootloaders
- [ ] Serial Connection (e.g. for monitoring)
- [ ] Completely customizing the build process per user's requirements
- [x] Setting custom build flags
- [ ] Using user-generated build recipesIt's also worth mentioning that **Arduino-CMake** is **cross platform** and works out-of-the-box on every OS that support **CMake** and **Arduino**.
1 The framework is still a WIP, meaning there are some missing features. [↩](#fl1)
2 The **Arduino IDE** supports several concepts which make writing code easier but are completely unprofessional. Our framework is not willing to encourage such poor coding standards, and thus doesn't support them. These will be mentioned throughout the documentation. [↩](#fl2)## Usage
A very basic example of how **Arduino-CMake** can be used is listed below:
```cmake
# Define CMake's minimum version (must-do) and the project's name and supported languages
cmake_minimum_required(VERSION 3.8.2)
project(Hello_World)# Call a framework utility function, passing it information about the hardware board that will be used - This function returns a structure known only to the framework
get_board_id(board_id nano atmega328)# Create an executable suitable for Arduino using CMake-style target-creation
add_arduino_executable(Hello_World ${board_id} helloWorld.cpp)
# Upload the created target through a connected Serial Port (Where your board is connected to)
upload_arduino_target(Hello_World "${board_id}" COM3)
```You should then call **CMake** (either through *cmd*, *cmake-gui* or an *IDE* if it supports that), passing it the argument
`-DCMAKE_TOOLCHAIN_FILE=[project_path]/cmake/Arduino-Toolchain.cmake` where `[project_path]` is substituted by the project's full path. This is what allows cmake to use our framework.That's it! It's super simple, yet super extensible :)
## Motivation
Everyone has their favorite IDE or text editor, and would like to continue using it as long as they can.
Upon encountering a framework that doesn't support it - We get frustrated.
Unfortunately that's often the case with the Arduino framework, as it offers a custom toolchain that makes it uncomfortable to use outside the dedicated **Arduino IDE**.**Arduino-CMake** solves it by creating a framework leveraging all of Arduino's features, including its' custom toolchain, by adding a single dependency - The **CMake** build system.
### Project Roots
The original project started back in 2011 by [queezythegreat](https://github.com/queezythegreat) and had been actively developed until 2014, when it had been abandoned due to unknown reasons.
Since then more than 150 (!) forks have emerged, leading to a "chaos" in the Arduino-CMake sphere.
The most important moment however was in 2017, when a combined effort by [JonasProgrammer](https://github.com/JonasProgrammer) and [MrPointer](https://github.com/MrPointer) has brought new life to the project in the face of the [arduino-cmake organization](https://github.com/arduino-cmake).
And yet, it still had its own problems, leading once again to an abandoned state.Then, in 2018, an extreme effort has been made and the project has been completely rewritten (mostly by [MrPointer](https://github.com/MrPointer)) with a few very clear goals in mind:
* **Platform-Independent** - The framework shouldn't assume it works only with the basic Arduino platform, as there are many others out there. Any platform that confront to the design of the basic Arduino SDK is appropriate for use. An example of such a platform is ESP32.
* **Modern CMake** - All previous projects/forks have been using the fairly old CMake 2.8. CMake itself has transitioned much from version 2 to 3, benefiting from a whole lot of new exciting features. Even the official package managers support CMake 3 versions, so there's no excuse to not use it.
* **Modern Arduino SDK** - The Arduino SDK, much like CMake, has also undergone several major changes during the years, especially with version 1.6. The Arduino SDK has only recently got stable, and that's why we recommend always having the latest version installed, although we do have some minimum requirements for the framework to even work. You can find them at the Requirements section.### How it works
Arduino programs are simply C/C++ programs which take advantage of a framework which allows them to run on specific hardware devices. It means that those programs need to be compiled somehow.
Back in the "old days" developers used compilers such as **gcc** directly from the command line. Then came build-tools such as **make**. Then came **CMake**.
Most of the modern build systems today are managed by CMake and most of the modern IDEs know that and take advantage of it.
But what's really useful in CMake, at least regarding our Arduino world, is the ability to cross-compile with a toolchain.
The Arduino SDK, which one usually downloads together with the Arduino IDE, is actually also a toolchain, as it includes the required compilation & linkage tools for cross-compiling.
Analyzing the SDK allows us to build a framework using this toolchain, and also all of Arduino's other cool features such as *libraries, examples*, etc.### What is NG
NG stands for "New Generation".
Inferred from the written above, it can easily be understood why the project has this name.
However, if you don't think this name is good enough or it confuses you - Feel free to propose a name of your own, we're open for offers :)## Requirements
The following list is the basic requirements of the framework in order to use it:
* Windows, OS X or Linux (BSD support is currently unknown, use at your own risk)
* CMake Version 3.8 or Higher
* Arduino-Based SDK compatible with Arduino SDK Version:
* 1.8.2 or Higher on **Microsoft Windows**
* 1.6.10 or Higher on **Linux** and **Apple OS X**## Installation
First, make sure to download the [latest release](https://github.com/arduino-cmake/Arduino-CMake-NG/releases) of the framework.
Further instructions can be found in the [Installation](https://github.com/arduino-cmake/Arduino-CMake-NG/wiki/Installation) Wiki page.## Documentation
The entire documentation of the project is hosted on GitHub using [Wiki pages](https://github.com/arduino-cmake/Arduino-CMake-NG/wiki).
## Contributing
The project has strict contributing guidelines which can be found in the [Contributing File](https://github.com/arduino-cmake/Arduino-CMake-NG/blob/master/CONTRIBUTING.md).
## License
MIT © 2018 [Arduino-CMake](https://github.com/arduino-cmake/Arduino-CMake-NG/blob/master/LICENSE.md)