From 69c04f4adf28e9c65d8871e48a8cc1082500acda Mon Sep 17 00:00:00 2001 From: Jakob Hasse Date: Tue, 19 Mar 2024 17:54:24 +0800 Subject: [PATCH] refactor(esp_partition): Made private includes private on Linux --- components/esp_partition/CMakeLists.txt | 16 ++++++++-------- .../partition_api_test/main/CMakeLists.txt | 2 +- .../wear_levelling/host_test/main/CMakeLists.txt | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/components/esp_partition/CMakeLists.txt b/components/esp_partition/CMakeLists.txt index 66693ec127..db5b1ec6db 100644 --- a/components/esp_partition/CMakeLists.txt +++ b/components/esp_partition/CMakeLists.txt @@ -1,25 +1,25 @@ 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(include_dirs "include") +set(private_include_dirs) idf_build_get_property(build_dir BUILD_DIR) idf_build_get_property(target IDF_TARGET) + if(${target} STREQUAL "linux") list(APPEND srcs "partition_linux.c") - set(priv_reqs partition_table) - # Steal some include directories from bootloader_support hal and spi_flash components: - idf_component_get_property(hal_dir hal COMPONENT_DIR) + # Steal some include directories from bootloader_support components: idf_component_get_property(bootloader_support_dir bootloader_support COMPONENT_DIR) - idf_component_get_property(spi_flash_dir spi_flash COMPONENT_DIR) - list(APPEND include_dirs include ${hal_dir}/include ${bootloader_support_dir}/include ${spi_flash_dir}/include) + set(private_include_dirs ${bootloader_support_dir}/include) else() + list(APPEND priv_reqs bootloader_support app_update) list(APPEND srcs "partition_target.c") endif() idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS ${include_dirs} + INCLUDE_DIRS "include" + PRIV_INCLUDE_DIRS ${private_include_dirs} REQUIRES ${reqs} PRIV_REQUIRES ${priv_reqs}) diff --git a/components/esp_partition/host_test/partition_api_test/main/CMakeLists.txt b/components/esp_partition/host_test/partition_api_test/main/CMakeLists.txt index d0d6d1e909..6153627900 100644 --- a/components/esp_partition/host_test/partition_api_test/main/CMakeLists.txt +++ b/components/esp_partition/host_test/partition_api_test/main/CMakeLists.txt @@ -1,5 +1,5 @@ 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 target_compile_definitions(${COMPONENT_LIB} PRIVATE "BUILD_DIR=\"${build_dir}\"") diff --git a/components/wear_levelling/host_test/main/CMakeLists.txt b/components/wear_levelling/host_test/main/CMakeLists.txt index 51cd93762e..da627ac00b 100644 --- a/components/wear_levelling/host_test/main/CMakeLists.txt +++ b/components/wear_levelling/host_test/main/CMakeLists.txt @@ -2,6 +2,7 @@ idf_component_register(SRCS "test_wl.cpp" PRIV_INCLUDE_DIRS "../../private_include" "../.." REQUIRES wear_levelling + PRIV_REQUIRES spi_flash WHOLE_ARCHIVE )