2023-08-28 02:02:08 -04:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
|
|
|
if(${target} STREQUAL "linux")
|
|
|
|
return() # This component is not supported by the POSIX/Linux simulator
|
|
|
|
endif()
|
|
|
|
|
2022-12-13 12:16:56 -05:00
|
|
|
if(NOT BOOTLOADER_BUILD)
|
|
|
|
set(src "esp_app_desc.c")
|
|
|
|
else()
|
|
|
|
set(src "")
|
|
|
|
endif()
|
|
|
|
idf_component_register(SRCS ${src}
|
2022-08-02 04:54:29 -04:00
|
|
|
INCLUDE_DIRS "include")
|
|
|
|
|
|
|
|
if(NOT BOOTLOADER_BUILD)
|
2022-12-13 12:16:56 -05:00
|
|
|
# esp_app_desc structure is added as an undefined symbol because otherwise the
|
|
|
|
# linker will ignore this structure as it has no other files depending on it.
|
2022-08-02 04:54:29 -04:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_app_desc")
|
|
|
|
|
2022-12-13 12:16:56 -05:00
|
|
|
if(CONFIG_APP_PROJECT_VER_FROM_CONFIG)
|
2023-10-25 16:05:31 -04:00
|
|
|
# Ignore current PROJECT_VER (which was set in project.cmake)
|
2022-12-13 12:16:56 -05:00
|
|
|
# Gets the version from the CONFIG_APP_PROJECT_VER.
|
|
|
|
idf_build_set_property(PROJECT_VER "${CONFIG_APP_PROJECT_VER}")
|
|
|
|
endif()
|
2022-08-02 04:54:29 -04:00
|
|
|
|
2022-12-13 12:16:56 -05:00
|
|
|
# cut PROJECT_VER and PROJECT_NAME to required 32 characters.
|
|
|
|
idf_build_get_property(project_ver PROJECT_VER)
|
|
|
|
idf_build_get_property(project_name PROJECT_NAME)
|
|
|
|
string(SUBSTRING "${project_ver}" 0 31 PROJECT_VER_CUT)
|
|
|
|
string(SUBSTRING "${project_name}" 0 31 PROJECT_NAME_CUT)
|
|
|
|
message(STATUS "App \"${PROJECT_NAME_CUT}\" version: ${PROJECT_VER_CUT}")
|
2022-08-02 04:54:29 -04:00
|
|
|
|
2022-12-13 12:16:56 -05:00
|
|
|
set_source_files_properties(
|
|
|
|
SOURCE "esp_app_desc.c"
|
|
|
|
PROPERTIES COMPILE_DEFINITIONS
|
|
|
|
"PROJECT_VER=\"${PROJECT_VER_CUT}\"; PROJECT_NAME=\"${PROJECT_NAME_CUT}\"")
|
|
|
|
endif()
|