Firmware version: <version.txt>-<git short hash>, starting at 0.0.1

e.g. 0.0.1-1d613b1: the first part is set by hand, the hash says which
commit was built. No dirty flag (the build always patches cspot).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-26 07:52:23 +10:00
parent 1d613b16c1
commit 214d6b2c29
5 changed files with 22 additions and 9 deletions
+16 -3
View File
@@ -1,9 +1,22 @@
cmake_minimum_required(VERSION 3.16)
# Firmware version = the first line of version.txt (edit it to release a new version). Reported by
# esp_app_get_description() and in status.fw / GET /api/ota. Editing the file re-runs CMake.
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/version.txt)
# Firmware version = "<version.txt>-<git short hash>", e.g. 0.0.1-1d613b1. The first part is set by
# hand in version.txt; the hash says which commit was built (no dirty flag: the build always patches
# the cspot submodule). Reported by esp_app_get_description(), status.fw and GET /api/ota.
# CMake re-runs when version.txt or the checked-out commit changes.
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
${CMAKE_CURRENT_LIST_DIR}/version.txt
${CMAKE_CURRENT_LIST_DIR}/.git/logs/HEAD)
file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/version.txt PROJECT_VER LIMIT_COUNT 1)
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if(GIT_HASH)
set(PROJECT_VER "${PROJECT_VER}-${GIT_HASH}")
endif()
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(aes67_p4)