Provides helper cmake utilities for esp-idf-lib, designed to simplify
cross-target and cross-version library development for the ESP-IDF framework.
When a source code requires driver/gpio.h and not all esp-idf versions do
not have esp_driver_gpio:
# CMakeList.txt in component directory
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/common/cmake)
include(eil_check_idf_features)
eil_check_idf_has_esp_drivers()
# List of common ESP-IDF components required by this component
set(REQUIRED_COMPONENTS freertos esp_idf_lib_helpers)
if(EIL_IDF_HAS_ESP_DRIVERS)
list(APPEND REQUIRED_COMPONENTS esp_driver_gpio)
else()
list(APPEND REQUIRED_COMPONENTS driver)
endif()
idf_component_register(
SRCS onewire.c
INCLUDE_DIRS .
REQUIRES ${REQUIRED_COMPONENTS}
)The project uses a custom test runner implemented in tests/runner.cmake.
This script automatically discovers and executes all tests located in the
tests/ directory.
To run all unit tests:
cmake -P tests/runner.cmake
-- Running: /home/trombik/github/trombik/esp-idf-lib/eil-cmake-utils/tests/eil_check_idf_features_test.cmake
-- Describe: EIL_IDF_HAS_ESP_DRIVERS
-- when version is 5.2
-- PASSED: when version is 5.2 EIL_IDF_HAS_ESP_DRIVERS is FALSE
-- when version is 5.3
-- PASSED: when version is 5.3 EIL_IDF_HAS_ESP_DRIVERS is TRUE
-- when version is 5.4
-- PASSED: when version is 5.4 EIL_IDF_HAS_ESP_DRIVERS is TRUE
-- when version is 6.0
-- PASSED: when version is 6.0 EIL_IDF_HAS_ESP_DRIVERS is TRUETo run a test:
cmake -P tests/foo_test.cmakeWith verbose log:
cmake -P tests/foo_test.cmake --log-level=DEBUG