2020-11-06 07:54:51 +00:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2019-11-15 08:53:00 +00:00
|
|
|
set(srcs "src/nvs_api.cpp"
|
2019-11-25 03:32:40 +00:00
|
|
|
"src/nvs_cxx_api.cpp"
|
2019-11-15 08:53:00 +00:00
|
|
|
"src/nvs_item_hash_list.cpp"
|
|
|
|
"src/nvs_page.cpp"
|
|
|
|
"src/nvs_pagemanager.cpp"
|
|
|
|
"src/nvs_storage.cpp"
|
2019-11-25 03:32:40 +00:00
|
|
|
"src/nvs_handle_simple.cpp"
|
|
|
|
"src/nvs_handle_locked.cpp"
|
2020-04-27 00:51:31 +00:00
|
|
|
"src/nvs_partition.cpp"
|
|
|
|
"src/nvs_partition_lookup.cpp"
|
2019-11-25 03:32:40 +00:00
|
|
|
"src/nvs_partition_manager.cpp"
|
2019-11-15 08:53:00 +00:00
|
|
|
"src/nvs_types.cpp")
|
2020-04-27 00:51:31 +00:00
|
|
|
|
2020-11-06 07:54:51 +00:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
2022-10-14 12:15:32 +00:00
|
|
|
REQUIRES "esp_partition"
|
|
|
|
PRIV_REQUIRES spi_flash
|
2022-04-08 13:06:30 +00:00
|
|
|
INCLUDE_DIRS "include"
|
2022-10-18 13:06:10 +00:00
|
|
|
"../spi_flash/include"
|
2022-04-08 13:06:30 +00:00
|
|
|
PRIV_INCLUDE_DIRS "private_include")
|
2020-11-06 07:54:51 +00: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")
|
2021-12-08 08:56:49 +00:00
|
|
|
target_compile_options(${COMPONENT_LIB} PUBLIC --coverage)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} PUBLIC --coverage)
|
2022-10-18 13:06:10 +00:00
|
|
|
|
|
|
|
find_library(LIB_BSD bsd)
|
|
|
|
if(LIB_BSD)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} PRIVATE ${LIB_BSD})
|
|
|
|
elseif(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
message(WARNING "Missing LIBBSD library. Install libbsd-dev package and/or check linker directories.")
|
|
|
|
endif()
|
2020-11-06 07:54:51 +00:00
|
|
|
endif()
|
|
|
|
|
2019-11-15 08:53:00 +00:00
|
|
|
if(CONFIG_NVS_ENCRYPTION)
|
2020-11-06 07:54:51 +00:00
|
|
|
target_sources(${COMPONENT_LIB} PRIVATE "src/nvs_encrypted_partition.cpp")
|
2021-12-08 08:56:49 +00:00
|
|
|
target_link_libraries(${COMPONENT_LIB} PRIVATE idf::mbedtls)
|
2020-11-06 07:54:51 +00:00
|
|
|
endif()
|
2022-01-31 18:45:31 +00:00
|
|
|
|
|
|
|
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|