build: Build-Datum zusammen mit der Version bei jedem Build erzeugen

NINLIGHT_BUILD_DATE entstand als string(TIMESTAMP) zur Konfigurationszeit,
während die Version seit bf8f76e bei jedem Build neu geschrieben wird -
system/info.build_date konnte dadurch tagealt sein. Das Datum wandert in
cmake/write_version.cmake und damit in denselben generierten Header wie die
Version.
This commit is contained in:
Michael Sauer
2026-09-12 03:15:01 +02:00
parent a400cc1649
commit f434c013e7
3 changed files with 5 additions and 4 deletions
-1
View File
@@ -107,7 +107,6 @@ add_executable(${NL_FW} ${NL_SDK_BOOT_SOURCES} ${NL_FW_SOURCES} ${NL_SDK_OBJECTS
set_target_properties(${NL_FW} PROPERTIES SUFFIX ".elf") set_target_properties(${NL_FW} PROPERTIES SUFFIX ".elf")
target_compile_definitions(${NL_FW} PRIVATE target_compile_definitions(${NL_FW} PRIVATE
NINLIGHT_DEVICE_ID="${NINLIGHT_DEVICE}" NINLIGHT_DEVICE_ID="${NINLIGHT_DEVICE}"
NINLIGHT_BUILD_DATE="${NINLIGHT_BUILD_DATE}"
NINLIGHT_TOKEN_DEFAULT="${NINLIGHT_TOKEN}" NINLIGHT_TOKEN_DEFAULT="${NINLIGHT_TOKEN}"
NINLIGHT_WIFI_SSID="${NINLIGHT_WIFI_SSID}" NINLIGHT_WIFI_SSID="${NINLIGHT_WIFI_SSID}"
NINLIGHT_WIFI_PASSWORD="${NINLIGHT_WIFI_PASSWORD}" NINLIGHT_WIFI_PASSWORD="${NINLIGHT_WIFI_PASSWORD}"
+3 -2
View File
@@ -1,8 +1,9 @@
# The version is regenerated on every build so the OTA trailer and system/info match the binary. # Version *and* build date are regenerated on every build, so the OTA trailer and system/info
# match the binary. The build date used to be a configure-time string(TIMESTAMP), which left
# system/info.build_date days behind the actual build after the version generation moved here.
set(NL_VERSION_HEADER ${CMAKE_BINARY_DIR}/generated/nl_version.h) set(NL_VERSION_HEADER ${CMAKE_BINARY_DIR}/generated/nl_version.h)
add_custom_target(nl_version ALL add_custom_target(nl_version ALL
BYPRODUCTS ${NL_VERSION_HEADER} BYPRODUCTS ${NL_VERSION_HEADER}
COMMAND ${CMAKE_COMMAND} -DOUT=${NL_VERSION_HEADER} -DSRC=${CMAKE_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -DOUT=${NL_VERSION_HEADER} -DSRC=${CMAKE_SOURCE_DIR}
-P ${CMAKE_SOURCE_DIR}/cmake/write_version.cmake -P ${CMAKE_SOURCE_DIR}/cmake/write_version.cmake
COMMENT "Updating nl_version.h") COMMENT "Updating nl_version.h")
string(TIMESTAMP NINLIGHT_BUILD_DATE "%Y-%m-%d")
+2 -1
View File
@@ -5,7 +5,8 @@ if(NOT V)
endif() endif()
string(REGEX REPLACE "^v" "" V "${V}") string(REGEX REPLACE "^v" "" V "${V}")
string(SUBSTRING "${V}" 0 15 V) string(SUBSTRING "${V}" 0 15 V)
set(CONTENT "#define NINLIGHT_FW_VERSION \"${V}\"\n") string(TIMESTAMP BUILD_DATE "%Y-%m-%d")
set(CONTENT "#define NINLIGHT_FW_VERSION \"${V}\"\n#define NINLIGHT_BUILD_DATE \"${BUILD_DATE}\"\n")
if(EXISTS ${OUT}) if(EXISTS ${OUT})
file(READ ${OUT} OLD) file(READ ${OUT} OLD)
else() else()