CLion and Arduino via Platform.IO
Hi guys !
Here's my quick guide to set up CLion to work with the Arduino (and others) platforms. Once you get the gist (pun) of it, you should be fine !
Follow the instructions here
Create a new project
# Create new folder YourProject mkdir YourProject platformio init -b uno -d YourProject
This will populate the folder YourProject with a
Get the arduino libs
You should have somewhere on your drive the Arduino core library, on Windows I've found it in
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino. Copy its contents to the lib folder of your project along with the CMakeLists.txt file
Write your sourcecode
If you start having more than one file in your src folder, you'll need to add them to the src CMake file.
Read the Manual
CMake is a bit tricky to get at first, but it's a really powerful tool, and cross platform. With this setup you'll be able to develop on Windows and as well on Linux and OSX.
Open CLion and select "Import Project from Sources" and pick your newly created project. Once in the IDE, create a new Run configuration:
You will need to find the platformio executable and set it.