2020-11-06 02:54:51 -05:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2019-11-15 03:53:00 -05:00
|
|
|
set(srcs "src/nvs_api.cpp"
|
2019-11-24 22:32:40 -05:00
|
|
|
"src/nvs_cxx_api.cpp"
|
2019-11-15 03:53:00 -05:00
|
|
|
"src/nvs_item_hash_list.cpp"
|
|
|
|
"src/nvs_page.cpp"
|
|
|
|
"src/nvs_pagemanager.cpp"
|
|
|
|
"src/nvs_storage.cpp"
|
2019-11-24 22:32:40 -05:00
|
|
|
"src/nvs_handle_simple.cpp"
|
|
|
|
"src/nvs_handle_locked.cpp"
|
2020-04-26 20:51:31 -04:00
|
|
|
"src/nvs_partition.cpp"
|
|
|
|
"src/nvs_partition_lookup.cpp"
|
2019-11-24 22:32:40 -05:00
|
|
|
"src/nvs_partition_manager.cpp"
|
2024-01-17 04:44:50 -05:00
|
|
|
"src/nvs_types.cpp"
|
|
|
|
"src/nvs_platform.cpp")
|
2020-04-26 20:51:31 -04:00
|
|
|
|
2020-11-06 02:54:51 -05:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
2024-01-17 04:44:50 -05:00
|
|
|
REQUIRES "esp_partition"
|
|
|
|
PRIV_REQUIRES spi_flash newlib
|
2022-04-08 09:06:30 -04:00
|
|
|
INCLUDE_DIRS "include"
|
|
|
|
PRIV_INCLUDE_DIRS "private_include")
|
2020-11-06 02:54:51 -05:00
|
|
|
|
|
|
|
# If we use the linux target, we need to redirect the crc functions to the linux
|
|
|
|
if(${target} STREQUAL "linux")
|
|
|
|
if(CONFIG_NVS_ENCRYPTION)
|
|
|
|
# mbedtls isn't configured for building with linux or as mock target. It will draw in all kind of dependencies
|
|
|
|
message(FATAL_ERROR "NVS currently doesn't support encryption if built for Linux.")
|
|
|
|
endif()
|
|
|
|
target_compile_options(${COMPONENT_LIB} PUBLIC "-DLINUX_TARGET")
|
|
|
|
else()
|
|
|
|
# TODO: this is a workaround until IDF-2085 is fixed
|
|
|
|
idf_component_get_property(mbedtls_lib mbedtls COMPONENT_LIB)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC ${mbedtls_lib})
|
|
|
|
endif()
|
|
|
|
|
2019-11-15 03:53:00 -05:00
|
|
|
if(CONFIG_NVS_ENCRYPTION)
|
2020-11-06 02:54:51 -05:00
|
|
|
target_sources(${COMPONENT_LIB} PRIVATE "src/nvs_encrypted_partition.cpp")
|
|
|
|
idf_component_get_property(mbedtls_lib mbedtls COMPONENT_LIB)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC ${mbedtls_lib})
|
2019-11-15 03:53:00 -05:00
|
|
|
endif()
|
|
|
|
|
2020-11-06 02:54:51 -05:00
|
|
|
if(${target} STREQUAL "linux")
|
|
|
|
target_compile_options(${COMPONENT_LIB} PUBLIC --coverage)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC --coverage)
|
|
|
|
endif()
|