kopia lustrzana https://github.com/espressif/esp-idf
build: Add trimming PROJECT_VER and PROJECT_NAME vars
rodzic
646d36c728
commit
c0f5e58bdc
|
@ -10,10 +10,14 @@ register_component()
|
|||
# linker will ignore this structure as it has no other files depending on it.
|
||||
target_link_libraries(${COMPONENT_TARGET} "-u esp_app_desc")
|
||||
|
||||
# cut PROJECT_VER and PROJECT_NAME to required 32 characters.
|
||||
string(SUBSTRING "${PROJECT_VER}" 0 31 PROJECT_VER_CUT)
|
||||
string(SUBSTRING "${PROJECT_NAME}" 0 31 PROJECT_NAME_CUT)
|
||||
|
||||
set_source_files_properties(
|
||||
SOURCE "esp_app_desc.c"
|
||||
PROPERTIES COMPILE_DEFINITIONS
|
||||
PROJECT_VER=\"${PROJECT_VER}\")
|
||||
"PROJECT_VER=\"${PROJECT_VER_CUT}\"; PROJECT_NAME=\"${PROJECT_NAME_CUT}\"")
|
||||
|
||||
# Add custom target for generating empty otadata partition for flashing
|
||||
if(OTADATA_PARTITION_OFFSET AND OTADATA_PARTITION_SIZE)
|
||||
|
|
|
@ -31,9 +31,14 @@ PROJECT_VER:= $(GET_PROJECT_VER)
|
|||
else
|
||||
PROJECT_VER:= $(PROJECT_VER)
|
||||
endif
|
||||
$(info App "$(PROJECT_NAME)" version: $(PROJECT_VER))
|
||||
|
||||
NEW_DEFINES:= $(PROJECT_VER) $(PROJECT_NAME) $(IDF_VER)
|
||||
# cut PROJECT_VER and PROJECT_NAME to required 32 characters.
|
||||
PROJECT_VER_CUT := $(shell echo $(PROJECT_VER) | cut -c 1-31)
|
||||
PROJECT_NAME_CUT := $(shell echo $(PROJECT_NAME) | cut -c 1-31)
|
||||
|
||||
$(info App "$(PROJECT_NAME_CUT)" version: $(PROJECT_VER_CUT))
|
||||
|
||||
NEW_DEFINES:= $(PROJECT_VER_CUT) $(PROJECT_NAME_CUT) $(IDF_VER)
|
||||
ifeq ("$(wildcard ${TMP_DEFINES})","")
|
||||
OLD_DEFINES:=
|
||||
else
|
||||
|
@ -45,5 +50,5 @@ ifneq ("${NEW_DEFINES}", "${OLD_DEFINES}")
|
|||
$(shell echo $(NEW_DEFINES) > $(TMP_DEFINES); rm -f esp_app_desc.o;)
|
||||
endif
|
||||
|
||||
esp_app_desc.o: CPPFLAGS += -D PROJECT_VER=\"$(PROJECT_VER)\" -D PROJECT_NAME=\"$(PROJECT_NAME)\"
|
||||
esp_app_desc.o: CPPFLAGS += -D PROJECT_VER=\"$(PROJECT_VER_CUT)\" -D PROJECT_NAME=\"$(PROJECT_NAME_CUT)\"
|
||||
endif
|
||||
|
|
|
@ -247,7 +247,7 @@ function run_tests()
|
|||
assert_rebuilt ${APP_BINS}
|
||||
print_status "Change app version"
|
||||
take_build_snapshot
|
||||
echo "project-version-2.0" > ${TESTDIR}/template/version.txt
|
||||
echo "project-version-2.0(012345678901234567890123456789)" > ${TESTDIR}/template/version.txt
|
||||
make
|
||||
assert_rebuilt ${APP_BINS}
|
||||
assert_not_rebuilt ${BOOTLOADER_BINS} esp32/libesp32.a
|
||||
|
|
|
@ -103,7 +103,7 @@ function run_tests()
|
|||
idf.py build || failure "Failed to build with app version"
|
||||
print_status "Change app version"
|
||||
take_build_snapshot
|
||||
echo "project-version-2.0" > ${TESTDIR}/template/version.txt
|
||||
echo "project-version-2.0(012345678901234567890123456789)" > ${TESTDIR}/template/version.txt
|
||||
idf.py build || failure "Failed to rebuild with changed app version"
|
||||
assert_rebuilt ${APP_BINS}
|
||||
assert_not_rebuilt ${BOOTLOADER_BINS} esp-idf/esp32/libesp32.a
|
||||
|
|
|
@ -86,7 +86,6 @@ function(idf_set_global_compile_options)
|
|||
list(APPEND compile_options "${CMAKE_C_FLAGS}")
|
||||
list(APPEND c_compile_options "${CMAKE_C_FLAGS}")
|
||||
list(APPEND cxx_compile_options "${CMAKE_CXX_FLAGS}")
|
||||
add_definitions(-DPROJECT_NAME=\"${PROJECT_NAME}\")
|
||||
|
||||
if(CONFIG_OPTIMIZATION_LEVEL_RELEASE)
|
||||
list(APPEND compile_options "-Os")
|
||||
|
|
Ładowanie…
Reference in New Issue