mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
Unlike COMPILE_OPTIONS, COMPILE_DEFINITIONS CMake property assumes values without the -D prefix, such as NAME or NAME=VAL. Previously, IDF build system was passing COMPILE_DEFINITIONS build property to CMake COMPILE_OPTIONS property, so -D prefix was not a problem. Now that COMPILE_DEFINITIONS CMake property is used, -D prefix has to be removed. (Note that this doesn't affect 'target_compile_definitions' function, which strips -D prefix before adding the definition to the property.)
25 lines
1.0 KiB
CMake
25 lines
1.0 KiB
CMake
# NOTE: This kind of mocking currently works on Linux targets only.
|
|
# On Espressif chips, too many dependencies are missing at the moment.
|
|
# Furthermore, this component can only mock the interfaces of
|
|
# spi_master.h and gpio.h.
|
|
message(STATUS "building DRIVER MOCKS (only SPI, I2C and GPIO driver)")
|
|
|
|
idf_component_get_property(original_driver_dir driver COMPONENT_OVERRIDEN_DIR)
|
|
|
|
set(include_dirs
|
|
"${original_driver_dir}/include"
|
|
"${original_driver_dir}/include/driver"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../hal/include"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../soc/include" # for I2C SOC caps
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../esp_hw_support/include")
|
|
|
|
idf_component_mock(INCLUDE_DIRS ${include_dirs}
|
|
REQUIRES freertos
|
|
MOCK_HEADER_FILES
|
|
${original_driver_dir}/include/driver/spi_master.h
|
|
${original_driver_dir}/include/driver/spi_common.h
|
|
${original_driver_dir}/include/driver/i2c.h
|
|
${original_driver_dir}/include/driver/gpio.h)
|
|
|
|
idf_build_set_property(COMPILE_DEFINITIONS "SPI_MOCK" APPEND)
|