-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix missing imports in font files for PlatformIO #423
Conversation
I have some feedback from the sidelines about this PR.
// all_my_gfx_fonts.h:
#include <Adafruit_GFX.h>
extern const GFXfont TomThumb;
extern const GFXfont FreeMonoBold9pt7b;
// etc Or provide a nice wrapper function that returns a
|
Hey @BillyDonahue. Thanks for your feedback. I really appreciate it. From points 1 and 3, it seems like there should be no In 2, you say I should have modified Based on 4, this PR should be closed as wontfix, right? |
First, I just want to emphasize that I'm just an engineer on the internet and I'm really just lobbing feedback in. After seeing the ecosystem of Adafruit-GFX tooling out there, I think the bar for changing these files is higher than one might initially assume and I wanted to draw your attention to that and provide a PlatformIO workaround for you. The Arduino sketch single-source model is beginner-friendly but can be in conflict with good C++ modular design and this is such a case. So you have to impose some discipline externally with wrappers to reuse Arduino-targeted sources in traditional C++ projects and that's just how it is, IMO. |
hiya! thanks so much for submitting a PR! we can review & merge PRs once they have passed continuous integration (CI). that means that code compiles cleanly for all tested platforms, is clang formatted so we maintain the same text formatting for all new code, and is doxygen documented. here is a tutorial on doxygen: https://learn.adafruit.com/the-well-automated-arduino-library/doxygen and clang-format: https://learn.adafruit.com/the-well-automated-arduino-library/formatting-with-clang-format and overall how to contribute PRs to libraries: https://learn.adafruit.com/contribute-to-arduino-with-git-and-github once you get that green checkmark that indicates CI has passed, please comment reply to this post so we know its time for another review (we may not get notified on CI pass and miss that its time to look!) |
@ladyada all green now. Sorry about that. |
this is a side effect of how platformio 'optimized' compilation. it does not follow the standard C/C++ language - but its also not harmful and still passes arduino CI so its ok |
Some lines of code were added to the start of font files in this PR: adafruit/Adafruit-GFX-Library#423 This change ignores such extra lines.
You were right. This change broke https://github.com/tchapi/Adafruit-GFX-Font-Customiser. I opened a PR there. Is this the one you meant or are there others? |
Yeah I fixed a bug in that one. tchapi/Adafruit-GFX-Font-Customiser#35 needs to go further. I'll comment on that thread though. |
Fixes #416
This adds support for PlatformIO (and other pure C++ build tools) and shouldn't change compatibility with Arduino.
Arduino is very similar to C++, but it does some magic stuff that makes it "easier" for beginners like function hoisting. If you try to use this library from PlatformIO, there will be a compilation error for every font file.
The solution is to
#include <Adafruit_GFX.h>
in each of these font files. This will bringuint8_t
,GFXglyph
, andGFXfont
into scope.I have tested this and I'm now successfully able to compile in PlatformIO. Furthermore, I went into
~/Arduino/libraries/Adafruit_FGX_Library
and made this change, and I was still able to compile the code in Arduino IDE, so nothing should be broken from Arduino.