2022-10-14 08:15:32 -04:00
|
|
|
set(srcs "partition.c")
|
2024-03-19 05:54:24 -04:00
|
|
|
set(priv_reqs esp_system spi_flash partition_table)
|
2022-10-14 08:15:32 -04:00
|
|
|
set(reqs)
|
2024-03-19 05:54:24 -04:00
|
|
|
set(private_include_dirs)
|
2022-10-14 08:15:32 -04:00
|
|
|
|
2023-03-14 04:58:35 -04:00
|
|
|
idf_build_get_property(build_dir BUILD_DIR)
|
2022-10-14 08:15:32 -04:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
2024-03-19 05:54:24 -04:00
|
|
|
|
2022-10-14 08:15:32 -04:00
|
|
|
if(${target} STREQUAL "linux")
|
|
|
|
list(APPEND srcs "partition_linux.c")
|
|
|
|
|
2024-03-19 05:54:24 -04:00
|
|
|
# Steal some include directories from bootloader_support components:
|
2022-10-14 08:15:32 -04:00
|
|
|
idf_component_get_property(bootloader_support_dir bootloader_support COMPONENT_DIR)
|
2024-03-19 05:54:24 -04:00
|
|
|
set(private_include_dirs ${bootloader_support_dir}/include)
|
2022-10-14 08:15:32 -04:00
|
|
|
else()
|
2024-03-19 05:54:24 -04:00
|
|
|
list(APPEND priv_reqs bootloader_support app_update)
|
2022-10-14 08:15:32 -04:00
|
|
|
list(APPEND srcs "partition_target.c")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
idf_component_register(SRCS "${srcs}"
|
2024-03-19 05:54:24 -04:00
|
|
|
INCLUDE_DIRS "include"
|
|
|
|
PRIV_INCLUDE_DIRS ${private_include_dirs}
|
2022-10-14 08:15:32 -04:00
|
|
|
REQUIRES ${reqs}
|
|
|
|
PRIV_REQUIRES ${priv_reqs})
|
|
|
|
|
2023-01-20 11:58:52 -05:00
|
|
|
if(${target} STREQUAL "linux")
|
2023-03-14 04:58:35 -04:00
|
|
|
# set BUILD_DIR because partition_linux.c uses a file created in the build directory
|
|
|
|
target_compile_definitions(${COMPONENT_LIB} PRIVATE "BUILD_DIR=\"${build_dir}\"")
|
2023-01-20 11:58:52 -05:00
|
|
|
endif()
|
|
|
|
|
2022-10-14 08:15:32 -04:00
|
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
|
|
|
# These flags are GCC specific
|
|
|
|
set_property(SOURCE ${cache_srcs} APPEND_STRING PROPERTY COMPILE_FLAGS
|
|
|
|
" -fno-inline-small-functions -fno-inline-functions-called-once")
|
|
|
|
endif()
|