Porting between IDEs/Web Editor/Devices

I have a few projects that I started in the IDE, then ported to the Web Editor for better development on the fly.

Now they are more complete I want to port back to my own repo/IDE/dev environment/build system.

I would also like to be able to debug and run using other devices (Android, raspberry, etc), so the Web Editor is no longer viable.

I'm a software integration consultant and cannot understand why it seems so hard to port projects, work out which libraries and versions to "manage", so as to build and install from different platforms? It's even an effort to share code between Windows and Linux, because you have to manually install libraries to the workbench.

Where are the build/make files for the projects? Do I need to reverse engineer the IDE to make this work better or are their already command line tools for everything, that I can script to my own delights?

Thanks for any help with this.. I will happily contribute my build system if I can get the breadcrumbs, please? :slight_smile:

Please provide some more details of what specific problems you’re encountering.

All 3rd party libraries in the Library Manager index are pre-installed in the Arduino Web Editor. In the regular Arduino IDE this is not the case. You need to install the 3rd party library dependencies for your project. If they’re in Library Manager index this is pretty easy. You just need to open Library Manager (Sketch > Include library > Manage libraries…), search for the library, and click “Install”. If the library is not in the Library Manager index it can be more difficult because you need to figure out where to download the library from. But the same applies for the Arduino Web Editor.

It’s very important to take a minute to thoroughly document the dependencies for the project. I like to add a comment after each include of an external dependency file with a link to where you can find it. There is actually a neat undocumented feature where you can add comments with clickable links to Library Manager searches:



// http://librarymanager/Contributed#A4963

You can do the same for Boards Manager dependencies.

Another option for making projects portable is to bundle all library dependencies with the sketch. The best way to do this is by putting each library under the src subfolder of the sketch folder and then including them like this:

#include "src/foo/foo.h"

The one difficulty you will sometimes have with this is that many Arduino libraries use the incorrect syntax for their internal includes. For example say foo.cpp has this line:

#include <foo.h>

Although wrong, that will work fine when the library is installed to a normal location but will not when bundled with the sketch. The solution is simply to correct the syntax:

#include "foo.h"

As for command line tools. It’s not clear what you’re looking for. There is a CLI for the Arduino IDE:

Which includes the ability to install libraries via Library Manager and boards via Boards Manager. You also have the tool that the Arduino IDE uses for sketch preprocessing, handling library dependencies, and generating the compilation commands:

Actually work is in progress to separate the sketch preprocessor code out of arduino-builder:

Then of course you have the underlying toolchain if you like. Which toolchain is used is dependent on the board you are compiling for.

There are a few project to use makefiles to build Arduino sketches:

I used platformio for a while in command line mode. It is great for automating builds for multple platforms.

Then I found Arduino CLI can also be used for automated builds so I have been using it. See the link in the previous message.