refactor(esp_partition): Made private includes private on Linux

This commit is contained in:
Jakob Hasse 2024-03-19 17:54:24 +08:00
parent 562623c67e
commit 69c04f4adf
3 changed files with 10 additions and 9 deletions

View File

@ -1,25 +1,25 @@
set(srcs "partition.c") set(srcs "partition.c")
set(priv_reqs esp_system bootloader_support spi_flash app_update partition_table) set(priv_reqs esp_system spi_flash partition_table)
set(reqs) set(reqs)
set(include_dirs "include") set(private_include_dirs)
idf_build_get_property(build_dir BUILD_DIR) idf_build_get_property(build_dir BUILD_DIR)
idf_build_get_property(target IDF_TARGET) idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux") if(${target} STREQUAL "linux")
list(APPEND srcs "partition_linux.c") list(APPEND srcs "partition_linux.c")
set(priv_reqs partition_table)
# Steal some include directories from bootloader_support hal and spi_flash components: # Steal some include directories from bootloader_support components:
idf_component_get_property(hal_dir hal COMPONENT_DIR)
idf_component_get_property(bootloader_support_dir bootloader_support COMPONENT_DIR) idf_component_get_property(bootloader_support_dir bootloader_support COMPONENT_DIR)
idf_component_get_property(spi_flash_dir spi_flash COMPONENT_DIR) set(private_include_dirs ${bootloader_support_dir}/include)
list(APPEND include_dirs include ${hal_dir}/include ${bootloader_support_dir}/include ${spi_flash_dir}/include)
else() else()
list(APPEND priv_reqs bootloader_support app_update)
list(APPEND srcs "partition_target.c") list(APPEND srcs "partition_target.c")
endif() endif()
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS ${include_dirs} INCLUDE_DIRS "include"
PRIV_INCLUDE_DIRS ${private_include_dirs}
REQUIRES ${reqs} REQUIRES ${reqs}
PRIV_REQUIRES ${priv_reqs}) PRIV_REQUIRES ${priv_reqs})

View File

@ -1,5 +1,5 @@
idf_component_register(SRCS "partition_api_test.c" idf_component_register(SRCS "partition_api_test.c"
REQUIRES esp_partition unity) PRIV_REQUIRES esp_partition unity spi_flash)
# set BUILD_DIR because test uses a file created in the build directory # set BUILD_DIR because test uses a file created in the build directory
target_compile_definitions(${COMPONENT_LIB} PRIVATE "BUILD_DIR=\"${build_dir}\"") target_compile_definitions(${COMPONENT_LIB} PRIVATE "BUILD_DIR=\"${build_dir}\"")

View File

@ -2,6 +2,7 @@ idf_component_register(SRCS "test_wl.cpp"
PRIV_INCLUDE_DIRS "../../private_include" PRIV_INCLUDE_DIRS "../../private_include"
"../.." "../.."
REQUIRES wear_levelling REQUIRES wear_levelling
PRIV_REQUIRES spi_flash
WHOLE_ARCHIVE WHOLE_ARCHIVE
) )