#include "Arduino.h" is leaked everywhere that includes "ArduinoJson.h", even if all Arduino features are disabled
Created by: paulocsanz
Is your feature request related to a problem? Please describe.
We have a lower level layer that implements drivers for each device we support, esp8266/Arduino
is one of these backends. When using this backend ARDUINO
is always defined to the used version, but we do not use any Arduino
types with ArduinoJson
(we only use std::string_view
).
The problem is that the higher level layer uses ArduinoJson
and gets a #include "Arduino.h"
with it. Causing conflicts in our platform agnostic code.
We use PlatformIO so we are kinda stuck with its ways of compiling dependencies, we don't want to fork the pio library, and it seems impractical to use this git as the source of truth while compiling the lib separately, zeroing ARDUINO
, to then statically link it together with our code. But we are open to ideas.
Describe the solution you'd like
We hope for a simple way to remove the #include "Arduino.h"
from src/ArduinoJson/Configuration.hpp#L119 without having to disable all Arduino features from the system.
Maybe if all of the three Arduino features are disabled it could automatically avoid the include. Or we could add an extra define, like ARDUINOJSON_DISABLE_ARDUINO
(not necessarily the best name). Also I had a bit of a hard time finding where the include happened and the features that could be disabled. I wasn't able to find in a public doc, is there a link I'm missing?
I am willing to provide a PR.
Just a note, to disable all #include "Arduino.h"
leaked from ArduinoJson
: ARDUINOJSON_ENABLE_PROGMEM
also needs to be set to 0. As src/ArduinoJson/Strings/Adapters/FlashString.hpp includes Arduino.h