Просмотр исходного кода

Make arduino_compat a public include dir of the vendor component

ESPHome's native (non-PlatformIO) ESP-IDF toolchain builds the main
app component separately from vendor, and only exposes a component's
PUBLIC include dirs to it. GxEPD2's public wrapper headers (GxEPD2_BW.h,
GxEPD2_4C.h, etc.), which the main component includes via
gxepd2_display.h, themselves include Adafruit_GFX.h - so that shim
needs to be public, not private, or the main component's compile of
main.cpp fails to find it.

Reproduced by adding `toolchain: esp-idf` to the esp32 config, which
uses this native build path instead of PlatformIO.
ZiB 1 месяц назад
Родитель
Сommit
12b1119c86
1 измененных файлов с 8 добавлено и 3 удалено
  1. 8 3
      components/gxepd2/vendor/CMakeLists.txt

+ 8 - 3
components/gxepd2/vendor/CMakeLists.txt

@@ -13,10 +13,15 @@ endif()
 
 
 idf_component_register(
 idf_component_register(
     SRCS ${GXEPD2_SOURCES}
     SRCS ${GXEPD2_SOURCES}
-    INCLUDE_DIRS "src"
+    # arduino_compat is public: GxEPD2's own public headers (e.g. GxEPD2_BW.h)
+    # include <Adafruit_GFX.h>, so consumers compiling those headers (the main
+    # "src" component, via gxepd2_display.h) need it on their include path too
+    # - a PRIV_INCLUDE_DIRS entry isn't visible outside this component.
+    INCLUDE_DIRS "src" "../arduino_compat"
     # ${CMAKE_SOURCE_DIR}/src is the ESPHome-generated main component's source
     # ${CMAKE_SOURCE_DIR}/src is the ESPHome-generated main component's source
     # root: arduino_compat/Arduino.h includes "esphome/core/hal.h", which only
     # root: arduino_compat/Arduino.h includes "esphome/core/hal.h", which only
-    # resolves relative to that directory.
-    PRIV_INCLUDE_DIRS "../arduino_compat" "${CMAKE_SOURCE_DIR}/src"
+    # resolves relative to that directory. Private is enough here - the main
+    # component already has its own source root on its include path.
+    PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/src"
     PRIV_REQUIRES driver
     PRIV_REQUIRES driver
 )
 )