|  | 
| 1 |  | -ARDUINO_LIBRARIES_LIST := $(patsubst $(COMPONENT_PATH)/libraries/%,%,$(wildcard $(COMPONENT_PATH)/libraries/*)) | 
| 2 |  | -ARDUINO_SINGLE_LIBRARY_FILES = $(patsubst $(COMPONENT_PATH)/%,%,$(sort $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/*/)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/*/*/)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/*/*/*/)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/*/*/*/*/)) $(dir $(wildcard $(COMPONENT_PATH)/libraries/$(MODULE)/*/*/*/*/*/)))) | 
| 3 |  | -ARDUINO_CORE_LIBS := $(foreach MODULE,$(ARDUINO_LIBRARIES_LIST),$(if $(CONFIG_ARDUINO_SELECTIVE_COMPILATION),$(if $(CONFIG_ARDUINO_SELECTIVE_$(MODULE)),$(ARDUINO_SINGLE_LIBRARY_FILES)),$(ARDUINO_SINGLE_LIBRARY_FILES))) | 
|  | 1 | +ARDUINO_ALL_LIBRARIES := $(patsubst $(COMPONENT_PATH)/libraries/%,%,$(wildcard $(COMPONENT_PATH)/libraries/*)) | 
| 4 | 2 | 
 | 
| 5 |  | -COMPONENT_ADD_INCLUDEDIRS := cores/esp32 variants/esp32 $(ARDUINO_CORE_LIBS) | 
|  | 3 | +# Macro returns non-empty if Arduino library $(1) should be included in the build | 
|  | 4 | +# (either because selective compilation is of, or this library is enabled | 
|  | 5 | +define ARDUINO_LIBRARY_ENABLED | 
|  | 6 | +$(if $(CONFIG_ARDUINO_SELECTIVE_COMPILATION),$(CONFIG_ARDUINO_SELECTIVE_$(1)),y) | 
|  | 7 | +endef | 
|  | 8 | + | 
|  | 9 | +ARDUINO_ENABLED_LIBRARIES := $(foreach LIBRARY,$(sort $(ARDUINO_ALL_LIBRARIES)),$(if $(call ARDUINO_LIBRARY_ENABLED,$(LIBRARY)),$(LIBRARY))) | 
|  | 10 | + | 
|  | 11 | +$(info Arduino libraries in build: $(ARDUINO_ENABLED_LIBRARIES)) | 
|  | 12 | + | 
|  | 13 | +# Expand all subdirs under $(1) | 
|  | 14 | +define EXPAND_SUBDIRS | 
|  | 15 | +$(sort $(dir $(wildcard $(1)/* $(1)/*/* $(1)/*/*/* $(1)/*/*/*/* $(1)/*/*/*/*/*))) | 
|  | 16 | +endef | 
|  | 17 | + | 
|  | 18 | +# Macro returns SRCDIRS for library | 
|  | 19 | +define ARDUINO_LIBRARY_GET_SRCDIRS | 
|  | 20 | +	$(if $(wildcard $(COMPONENT_PATH)/libraries/$(1)/src/.), 							\ | 
|  | 21 | +		$(call EXPAND_SUBDIRS,$(COMPONENT_PATH)/libraries/$(1)/src), 					\ | 
|  | 22 | +		$(filter-out $(call EXPAND_SUBDIRS,$(COMPONENT_PATH)/libraries/$(1)/examples),  \ | 
|  | 23 | +			$(call EXPAND_SUBDIRS,$(COMPONENT_PATH)/libraries/$(1)) 				   	\ | 
|  | 24 | +		) 																				\ | 
|  | 25 | +	) | 
|  | 26 | +endef | 
|  | 27 | + | 
|  | 28 | +# Make a list of all srcdirs in enabled libraries | 
|  | 29 | +ARDUINO_LIBRARY_SRCDIRS := $(patsubst $(COMPONENT_PATH)/%,%,$(foreach LIBRARY,$(ARDUINO_ENABLED_LIBRARIES),$(call ARDUINO_LIBRARY_GET_SRCDIRS,$(LIBRARY)))) | 
|  | 30 | + | 
|  | 31 | +#$(info Arduino libraries src dirs: $(ARDUINO_LIBRARY_SRCDIRS)) | 
|  | 32 | + | 
|  | 33 | +COMPONENT_ADD_INCLUDEDIRS := cores/esp32 variants/esp32 $(ARDUINO_LIBRARY_SRCDIRS) | 
| 6 | 34 | COMPONENT_PRIV_INCLUDEDIRS := cores/esp32/libb64 | 
| 7 |  | -COMPONENT_SRCDIRS := cores/esp32/libb64 cores/esp32 variants/esp32 $(ARDUINO_CORE_LIBS) | 
|  | 35 | +COMPONENT_SRCDIRS := cores/esp32/libb64 cores/esp32 variants/esp32 $(ARDUINO_LIBRARY_SRCDIRS) | 
| 8 | 36 | CXXFLAGS += -fno-rtti | 
0 commit comments