Using arduino-esp32 as a component to esp-idf in Eclipse seems to work well. I installed it exactly as the README suggests and it compiled first time.
What is the recommended way to add Arduino libraries and ensure that make knows what to do with them?
Many thanks.
I'm not sure what is the better way, but the easier way is just put your libs on ProjectFolder\components\arduino\libraries and that's all
Thanks, that works. I was hoping that there was an established method to include libraries, but keeping them separate from the arduino core.
You can softlink in order to keep some logical separation. git won't complain quite as much. Eclipse may have some other way to include directories into your project.
I tried several of the variables described in the documentation (chapter 4 "API Guides" -> "Using the Build System" if you look at the pdf).
I've added several arduino libraries as libraries/ so libraries/TFT_eSPI , libraries/pubsubclient etc .
I'm looking for a way to :
This would keep things much more nicely separated ....
Does anyone know how to do this ?
Workarounds like
ln -s pwd/libraries/* components/arduino/libraries
are possible but not clean
you can add the libs to your components folder and then add one file in each lib so the build will pick them up. Here is an example that has the source files in src folder (adjust as necessary) https://github.com/me-no-dev/AsyncTCP/blob/master/component.mk
Thanks.
More trial and error got me with this (main/component.mk) which appears to work.
Anything I'm still doing wrong ?
COMPONENT_SRCDIRS += libraries \
libraries/TFT_eSPI \
libraries/arduinojson \
libraries/pubsubclient \
libraries/pubsubclient/src \
libraries/rcswitch \
libraries/rfid \
libraries/TFT_eSPI \
libraries/Timezone \
main .
COMPONENT_ADD_INCLUDEDIRS := libraries \
libraries/arduinojson \
libraries/pubsubclient \
libraries/pubsubclient/src \
libraries/rcswitch \
libraries/rfid \
libraries/TFT_eSPI \
libraries/Timezone \
main .
Hi,
I added a libraries folder below the main folder and copied the libraries in it. Then I populated the main/component.mk with the following below to add all library contents (all source files in library main folder and all source files in library/src/ and all sub-folders of library/src/).
ARDUINO_ULIBRARIES_LIST := $(patsubst $(COMPONENT_PATH)/libraries/%,%,$(wildcard $(COMPONENT_PATH)/libraries/*))
ARDUINO_SINGLE_ULIBRARY_FILES = $(patsubst $(COMPONENT_PATH)/%,%,$(sort $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/*)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/src/*/)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/src/*/*/)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/src/*/*/*/)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/src/*/*/*/*/))))
ARDUINO_USER_LIBS := $(foreach MODULE,$(ARDUINO_ULIBRARIES_LIST), $(ARDUINO_SINGLE_ULIBRARY_FILES))
COMPONENT_ADD_INCLUDEDIRS := $(ARDUINO_USER_LIBS) main .
COMPONENT_SRCDIRS := $(ARDUINO_USER_LIBS) main .
For me this works for standard Arduino libraries. I derived this from the component.mk of the arduino-folder.
Please let us know if this works for you as well!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This stale issue has been automatically closed. Thank you for your contributions.
邪锌邪褍泻
Hi,
I added a libraries folder below the main folder and copied the libraries in it. Then I populated themain/component.mkwith the following below to add all library contents (all source files in library main folder and all source files in library/src/ and all sub-folders of library/src/).ARDUINO_ULIBRARIES_LIST := $(patsubst $(COMPONENT_PATH)/libraries/%,%,$(wildcard $(COMPONENT_PATH)/libraries/*)) ARDUINO_SINGLE_ULIBRARY_FILES = $(patsubst $(COMPONENT_PATH)/%,%,$(sort $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/*)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/src/*/)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/src/*/*/)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/src/*/*/*/)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/src/*/*/*/*/)))) ARDUINO_USER_LIBS := $(foreach MODULE,$(ARDUINO_ULIBRARIES_LIST), $(ARDUINO_SINGLE_ULIBRARY_FILES)) COMPONENT_ADD_INCLUDEDIRS := $(ARDUINO_USER_LIBS) main . COMPONENT_SRCDIRS := $(ARDUINO_USER_LIBS) main .For me this works for standard Arduino libraries. I derived this from the component.mk of the arduino-folder.
Please let us know if this works for you as well!
Hi, this method not working now. How to use something similar with cmake ?
hi everyone
I also have this problem
what I have did
git clone > esp-idf v4.0
git clone > Arduino esp32 v4.0
and the rest of the process same as shown in the official guide.
now I want to add some Arduino another library in my Arduino component library
if I give absolute file location in include declaration than it's work.
but in esp idf 3.2.2 it happens automatically
sorry for my English.
thanks for your effort
Most helpful comment
Hi,
I added a libraries folder below the main folder and copied the libraries in it. Then I populated the
main/component.mkwith the following below to add all library contents (all source files in library main folder and all source files in library/src/ and all sub-folders of library/src/).For me this works for standard Arduino libraries. I derived this from the component.mk of the arduino-folder.
Please let us know if this works for you as well!