"Freezing" libraries & custom libraries under git

New to Arduino-land, so forgive me if this has been well documented - I just don't know where to look...

I have a project that's under git control. I need to make some changes to the stock libraries (SD, SPI and likely others) and include those modified libraries in my git project. And I want to make sure those libraries are frozen (or only change when I change them). What's the best way to do this?

Specifically, once I move a library from the default location (~/Docucments/Arduino/libraries/* on my windows machine) into my git project directory, how do I inform Arduino of the change?

There are two options:

Bundle libraries in the src subfolder of the sketch folder

You'll need to change the #include directives in your sketch. For example, if the #include directive for a library looks like this:

#include <ArduinoOTA.h>

you have to change it to the relative path to the header file, something like:

#include "src/ArduinoOTA/src/ArduinoOTA.h"

Depending on how the libraries were written, you will sometimes need to modify the #include directives in the libraries as well.

Have a sketchbook for each project

You can set a custom sketchbook folder location in the Arduino IDE at File > Preferences > Sketchbook location. So you can just set the sketchbook folder location to your project-specific sketchbook folder when you want to use it. This allows you to use the libraries in the normal manner. It also allows you to bundle manually installed boards platforms with your project.

There is some work in progress by Arduino to improve on this situation, as described in this RFC:


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.