|
8 | 8 | # (i2c_master_bus_handle_t) is the one used in non-Arduino builds. |
9 | 9 | # - googletest helpers (src/googletest/*) are EXCLUDED — they pull in |
10 | 10 | # <M5Unified.h> for test scaffolding only and are not needed at runtime. |
| 11 | +include($ENV{IDF_PATH}/tools/cmake/version.cmake) |
| 12 | + |
11 | 13 | file(GLOB_RECURSE SRCS "src/*.cpp") |
12 | 14 | list(FILTER SRCS EXCLUDE REGEX "/googletest/") |
13 | | -# REQUIRES = public deps (exposed through src/ public headers); PRIV_REQUIRES = used only in .cpp. |
14 | | -# Use the `driver` meta-component (exists in all IDF 5.x and publicly aggregates esp_driver_*), |
15 | | -# NOT the split esp_driver_* components which only exist from IDF 5.3 and would break >=5.0. |
| 15 | + |
| 16 | +set(public_requires driver M5HAL) |
| 17 | +set(private_requires esp_adc esp_timer M5Utility) |
| 18 | + |
| 19 | +# Keep IDF 5.x on the driver meta-component. IDF v6 no longer exposes all split |
| 20 | +# driver include paths transitively, so add only the v6-specific component deps. |
| 21 | +if("${IDF_VERSION_MAJOR}" VERSION_GREATER_EQUAL "6") |
| 22 | + list(APPEND public_requires esp_driver_gpio esp_driver_i2c esp_driver_rmt esp_driver_spi esp_driver_uart esp_hw_support) |
| 23 | + list(APPEND private_requires esp_driver_ledc esp_ringbuf) |
| 24 | +endif() |
| 25 | + |
16 | 26 | idf_component_register( |
17 | 27 | SRCS ${SRCS} |
18 | 28 | INCLUDE_DIRS "src" |
19 | | - REQUIRES driver M5HAL |
20 | | - PRIV_REQUIRES esp_adc esp_timer M5Utility |
| 29 | + REQUIRES ${public_requires} |
| 30 | + PRIV_REQUIRES ${private_requires} |
21 | 31 | ) |
22 | 32 |
|
| 33 | +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17" APPEND) |
| 34 | + |
23 | 35 | # Optionally link M5Unified only when it is already part of the build (e.g. a M5Unified-based |
24 | 36 | # app or example). This puts M5GFX's <utility/I2C_Class.hpp> on adapter_i2c.cpp's include path, |
25 | 37 | # so the real m5::I2C_Class adapter is compiled instead of the stub. Pure ESP-IDF builds without |
|
0 commit comments