build: Firmware-Version bei jedem Build neu erzeugen
NINLIGHT_FW_VERSION kam bisher aus einer configure-Zeit-Variable, die nur bei erneutem CMake-Lauf aktualisiert wurde - nach einem Commit ohne Re-Konfiguration zeigte Banner/system/info also eine veraltete Git-Version. cmake/write_version.cmake schreibt build/generated/nl_version.h bei jedem Build frisch (add_custom_target ALL), app_main.c/nl_app_api.c/nl_mdns.c inkludieren das Makro jetzt von dort statt aus target_compile_definitions.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
execute_process(COMMAND git describe --tags --always --dirty WORKING_DIRECTORY ${SRC}
|
||||
OUTPUT_VARIABLE V OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
if(NOT V)
|
||||
set(V "0.0.0-dev")
|
||||
endif()
|
||||
string(REGEX REPLACE "^v" "" V "${V}")
|
||||
string(SUBSTRING "${V}" 0 15 V)
|
||||
set(CONTENT "#define NINLIGHT_FW_VERSION \"${V}\"\n")
|
||||
if(EXISTS ${OUT})
|
||||
file(READ ${OUT} OLD)
|
||||
else()
|
||||
set(OLD "")
|
||||
endif()
|
||||
if(NOT OLD STREQUAL CONTENT)
|
||||
file(WRITE ${OUT} "${CONTENT}")
|
||||
endif()
|
||||
Reference in New Issue
Block a user