@@ -74,47 +74,114 @@ set(CORE_SRCS
7474 cores/esp32/WString.cpp
7575 )
7676
77- set (LIBRARY_SRCS
78- libraries/ArduinoOTA/src/ArduinoOTA.cpp
79- libraries/AsyncUDP/src/AsyncUDP.cpp
77+ set (ARDUINO_ALL_LIBRARIES
78+ ArduinoOTA
79+ AsyncUDP
80+ BLE
81+ BluetoothSerial
82+ DNSServer
83+ EEPROM
84+ ESP_I2S
85+ ESP_SR
86+ ESPmDNS
87+ Ethernet
88+ FFat
89+ FS
90+ HTTPClient
91+ HTTPUpdate
92+ Insights
93+ LittleFS
94+ NetBIOS
95+ Preferences
96+ RainMaker
97+ SD_MMC
98+ SD
99+ SimpleBLE
100+ SPIFFS
101+ SPI
102+ Ticker
103+ Update
104+ USB
105+ WebServer
106+ WiFiClientSecure
107+ WiFi
108+ WiFiProv
109+ Wire
110+ )
111+
112+ set (ARDUINO_LIBRARY_ArduinoOTA_SRCS libraries/ArduinoOTA/src/ArduinoOTA.cpp)
113+ set (ARDUINO_LIBRARY_ArduinoOTA_REQUIRES esp_https_ota)
114+
115+ set (ARDUINO_LIBRARY_AsyncUDP_SRCS libraries/AsyncUDP/src/AsyncUDP.cpp)
116+
117+ set (ARDUINO_LIBRARY_BluetoothSerial_SRCS
80118 libraries/BluetoothSerial/src/BluetoothSerial.cpp
81119 libraries/BluetoothSerial/src/BTAddress.cpp
82120 libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp
83- libraries/BluetoothSerial/src/BTScanResultsSet.cpp
84- libraries/DNSServer/src/DNSServer.cpp
85- libraries/EEPROM/src/EEPROM.cpp
86- libraries/ESP_I2S/src/ESP_I2S.cpp
121+ libraries/BluetoothSerial/src/BTScanResultsSet.cpp)
122+
123+ set (ARDUINO_LIBRARY_DNSServer_SRCS libraries/DNSServer/src/DNSServer.cpp)
124+
125+ set (ARDUINO_LIBRARY_EEPROM_SRCS libraries/EEPROM/src/EEPROM.cpp)
126+
127+ set (ARDUINO_LIBRARY_ESP_I2S_SRCS libraries/ESP_I2S/src/ESP_I2S.cpp)
128+
129+ set (ARDUINO_LIBRARY_ESP_SR_SRCS
87130 libraries/ESP_SR/src/ESP_SR.cpp
88- libraries/ESP_SR/src/esp32-hal-sr.c
89- libraries/ESPmDNS/src/ESPmDNS.cpp
90- libraries/Ethernet/src/ETH.cpp
91- libraries/FFat/src/FFat.cpp
131+ libraries/ESP_SR/src/esp32-hal-sr.c)
132+
133+ set (ARDUINO_LIBRARY_ESPmDNS_SRCS libraries/ESPmDNS/src/ESPmDNS.cpp)
134+
135+ set (ARDUINO_LIBRARY_Ethernet_SRCS libraries/Ethernet/src/ETH.cpp)
136+
137+ set (ARDUINO_LIBRARY_FFat_SRCS libraries/FFat/src/FFat.cpp)
138+
139+ set (ARDUINO_LIBRARY_FS_SRCS
92140 libraries/FS/src/FS.cpp
93- libraries/FS/src/vfs_api.cpp
94- libraries/HTTPClient/src/HTTPClient.cpp
95- libraries/HTTPUpdate/src/HTTPUpdate.cpp
96- libraries/LittleFS/src/LittleFS.cpp
97- libraries/Insights/src/Insights.cpp
98- libraries/NetBIOS/src/NetBIOS.cpp
99- libraries/Preferences/src/Preferences.cpp
141+ libraries/FS/src/vfs_api.cpp)
142+
143+ set (ARDUINO_LIBRARY_HTTPClient_SRCS libraries/HTTPClient/src/HTTPClient.cpp)
144+
145+ set (ARDUINO_LIBRARY_HTTPUpdate_SRCS libraries/HTTPUpdate/src/HTTPUpdate.cpp)
146+
147+ set (ARDUINO_LIBRARY_Insights_SRCS libraries/Insights/src/Insights.cpp)
148+
149+ set (ARDUINO_LIBRARY_LittleFS_SRCS libraries/LittleFS/src/LittleFS.cpp)
150+
151+ set (ARDUINO_LIBRARY_NetBIOS_SRCS libraries/NetBIOS/src/NetBIOS.cpp)
152+
153+ set (ARDUINO_LIBRARY_Preferences_SRCS libraries/Preferences/src/Preferences.cpp)
154+
155+ set (ARDUINO_LIBRARY_RainMaker_SRCS
100156 libraries/RainMaker/src/RMaker.cpp
101157 libraries/RainMaker/src/RMakerNode.cpp
102158 libraries/RainMaker/src/RMakerParam.cpp
103159 libraries/RainMaker/src/RMakerDevice.cpp
104160 libraries/RainMaker/src/RMakerType.cpp
105161 libraries/RainMaker/src/RMakerQR.cpp
106162 libraries/RainMaker/src/RMakerUtils.cpp
107- libraries/RainMaker/src/AppInsights.cpp
108- libraries/SD_MMC/src/SD_MMC.cpp
163+ libraries/RainMaker/src/AppInsights.cpp)
164+
165+ set (ARDUINO_LIBRARY_SD_MMC_SRCS libraries/SD_MMC/src/SD_MMC.cpp)
166+
167+ set (ARDUINO_LIBRARY_SD_SRCS
109168 libraries/SD/src/SD.cpp
110169 libraries/SD/src/sd_diskio.cpp
111- libraries/SD/src/sd_diskio_crc.c
112- libraries/SimpleBLE/src/SimpleBLE.cpp
113- libraries/SPIFFS/src/SPIFFS.cpp
114- libraries/SPI/src/SPI.cpp
115- libraries/Ticker/src/Ticker.cpp
170+ libraries/SD/src/sd_diskio_crc.c)
171+
172+ set (ARDUINO_LIBRARY_SimpleBLE_SRCS libraries/SimpleBLE/src/SimpleBLE.cpp)
173+
174+ set (ARDUINO_LIBRARY_SPIFFS_SRCS libraries/SPIFFS/src/SPIFFS.cpp)
175+
176+ set (ARDUINO_LIBRARY_SPI_SRCS libraries/SPI/src/SPI.cpp)
177+
178+ set (ARDUINO_LIBRARY_Ticker_SRCS libraries/Ticker/src/Ticker.cpp)
179+
180+ set (ARDUINO_LIBRARY_Update_SRCS
116181 libraries/Update/src/Updater.cpp
117- libraries/Update/src/HttpsOTAUpdate.cpp
182+ libraries/Update/src/HttpsOTAUpdate.cpp)
183+
184+ set (ARDUINO_LIBRARY_USB_SRCS
118185 libraries/USB/src/USBHID.cpp
119186 libraries/USB/src/USBMIDI.cpp
120187 libraries/USB/src/USBHIDMouse.cpp
@@ -123,12 +190,18 @@ set(LIBRARY_SRCS
123190 libraries/USB/src/USBHIDConsumerControl.cpp
124191 libraries/USB/src/USBHIDSystemControl.cpp
125192 libraries/USB/src/USBHIDVendor.cpp
126- libraries/USB/src/USBVendor.cpp
193+ libraries/USB/src/USBVendor.cpp)
194+
195+ set (ARDUINO_LIBRARY_WebServer_SRCS
127196 libraries/WebServer/src/WebServer.cpp
128197 libraries/WebServer/src/Parsing.cpp
129- libraries/WebServer/src/detail/mimetable.cpp
198+ libraries/WebServer/src/detail/mimetable.cpp)
199+
200+ set (ARDUINO_LIBRARY_WiFiClientSecure_SRCS
130201 libraries/WiFiClientSecure/src/ssl_client.cpp
131- libraries/WiFiClientSecure/src/WiFiClientSecure.cpp
202+ libraries/WiFiClientSecure/src/WiFiClientSecure.cpp)
203+
204+ set (ARDUINO_LIBRARY_WiFi_SRCS
132205 libraries/WiFi/src/WiFiAP.cpp
133206 libraries/WiFi/src/WiFiClient.cpp
134207 libraries/WiFi/src/WiFi.cpp
@@ -137,12 +210,13 @@ set(LIBRARY_SRCS
137210 libraries/WiFi/src/WiFiScan.cpp
138211 libraries/WiFi/src/WiFiServer.cpp
139212 libraries/WiFi/src/WiFiSTA.cpp
140- libraries/WiFi/src/WiFiUdp.cpp
141- libraries/WiFiProv/src/WiFiProv.cpp
142- libraries/Wire/src/Wire.cpp
143- )
213+ libraries/WiFi/src/WiFiUdp.cpp)
214+
215+ set (ARDUINO_LIBRARY_WiFiProv_SRCS libraries/WiFiProv/src/WiFiProv.cpp)
144216
145- set (BLE_SRCS
217+ set (ARDUINO_LIBRARY_Wire_SRCS libraries/Wire/src/Wire.cpp)
218+
219+ set (ARDUINO_LIBRARY_BLE_SRCS
146220 libraries/BLE/src/BLE2902.cpp
147221 libraries/BLE/src/BLE2904.cpp
148222 libraries/BLE/src/BLEAddress.cpp
@@ -174,48 +248,28 @@ set(BLE_SRCS
174248 libraries/BLE/src/GeneralUtils.cpp
175249 )
176250
177- set (includedirs
178- variants/${CONFIG_ARDUINO_VARIANT} /
179- cores/esp32/
180- libraries/ArduinoOTA/src
181- libraries/AsyncUDP/src
182- libraries/BLE/src
183- libraries/BluetoothSerial/src
184- libraries/DNSServer/src
185- libraries/EEPROM/src
186- libraries/ESP_I2S/src
187- libraries/ESP_SR/src
188- libraries/ESP32/src
189- libraries/ESPmDNS/src
190- libraries/Ethernet/src
191- libraries/FFat/src
192- libraries/FS/src
193- libraries/HTTPClient/src
194- libraries/HTTPUpdate/src
195- libraries/LittleFS/src
196- libraries/Insights/src
197- libraries/NetBIOS/src
198- libraries/Preferences/src
199- libraries/RainMaker/src
200- libraries/SD_MMC/src
201- libraries/SD/src
202- libraries/SimpleBLE/src
203- libraries/SPIFFS/src
204- libraries/SPI/src
205- libraries/Ticker/src
206- libraries/Update/src
207- libraries/USB/src
208- libraries/WebServer/src
209- libraries/WiFiClientSecure/src
210- libraries/WiFi/src
211- libraries/WiFiProv/src
212- libraries/Wire/src
213- )
251+ set (ARDUINO_LIBRARIES_SRCS)
252+ set (ARDUINO_LIBRARIES_REQUIRES)
253+ set (ARDUINO_LIBRARIES_INCLUDEDIRS)
254+ foreach (libname IN LISTS ARDUINO_ALL_LIBRARIES)
255+ if (NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_${libname} )
256+ if (ARDUINO_LIBRARY_${libname} _SRCS)
257+ list (APPEND ARDUINO_LIBRARIES_SRCS ${ARDUINO_LIBRARY_${libname} _SRCS})
258+ endif ()
259+ if (ARDUINO_LIBRARY_${libname} _REQUIRES)
260+ list (APPEND ARDUINO_LIBRARIES_REQUIRES ${ARDUINO_LIBRARY_${libname} _REQUIRES})
261+ endif ()
262+ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR} /libraries/${libname} /src)
263+ list (APPEND ARDUINO_LIBRARIES_INCLUDEDIRS libraries/${libname} /src)
264+ endif ()
265+ endif ()
266+ endforeach ()
214267
215- set (srcs ${CORE_SRCS} ${LIBRARY_SRCS} ${BLE_SRCS} )
268+ set (includedirs variants/${CONFIG_ARDUINO_VARIANT} / cores/esp32/ ${ARDUINO_LIBRARIES_INCLUDEDIRS} )
269+ set (srcs ${CORE_SRCS} ${ARDUINO_LIBRARIES_SRCS} )
216270set (priv_includes cores/esp32/libb64)
217271set (requires spi_flash esp_partition mbedtls wifi_provisioning wpa_supplicant esp_adc esp_eth http_parser)
218- set (priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid)
272+ set (priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid ${ARDUINO_LIBRARIES_REQUIRES} )
219273
220274idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires} )
221275
0 commit comments