4.10 = the 1995 arcade release; 4.11 = the win32 reconstruction; the
build number is the git commit count -- monotonic, zero-maintenance,
and every exe pins to exact source via the short hash ('+' = built
from an uncommitted tree). tools/btversion.cmake regenerates
build/btversion.h on every build (write-if-changed, no rebuild churn);
the stamp shows in the boot banner (btl4.log head, replacing the stale
'v4.10' line) and the window title (incl. the MP node tag).
Verified: build stamps 4.11.311 (980c9cd+), banner + title correct on
a live boot.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
53 lines
1.7 KiB
CMake
53 lines
1.7 KiB
CMake
# btversion.cmake -- generate btversion.h from git at BUILD time.
|
|
#
|
|
# Version scheme (2026-07-18): the arcade release is 4.10; the win32
|
|
# reconstruction is 4.11; the BUILD number is the git commit count --
|
|
# monotonic, zero-maintenance, and any build pins to exact source via the
|
|
# hash. A '+' suffix marks an uncommitted working tree.
|
|
#
|
|
# Invoked: cmake -DOUT=<header> -DSRC=<repo root> -P btversion.cmake
|
|
|
|
execute_process(COMMAND git rev-list --count HEAD
|
|
WORKING_DIRECTORY "${SRC}"
|
|
OUTPUT_VARIABLE BT_BUILD OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
ERROR_QUIET)
|
|
execute_process(COMMAND git rev-parse --short HEAD
|
|
WORKING_DIRECTORY "${SRC}"
|
|
OUTPUT_VARIABLE BT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
ERROR_QUIET)
|
|
execute_process(COMMAND git status --porcelain --untracked-files=no
|
|
WORKING_DIRECTORY "${SRC}"
|
|
OUTPUT_VARIABLE BT_DIRTY_RAW
|
|
ERROR_QUIET)
|
|
|
|
if(NOT BT_BUILD)
|
|
set(BT_BUILD 0)
|
|
endif()
|
|
if(NOT BT_HASH)
|
|
set(BT_HASH "nogit")
|
|
endif()
|
|
if(BT_DIRTY_RAW STREQUAL "")
|
|
set(BT_DIRTY "")
|
|
else()
|
|
set(BT_DIRTY "+")
|
|
endif()
|
|
|
|
set(CONTENT "// generated by tools/btversion.cmake -- do not edit, not in git
|
|
#define BT_VERSION_MAJOR 4
|
|
#define BT_VERSION_MINOR 11
|
|
#define BT_VERSION_BUILD ${BT_BUILD}
|
|
#define BT_VERSION_STRING \"4.11.${BT_BUILD}\"
|
|
#define BT_VERSION_HASH \"${BT_HASH}${BT_DIRTY}\"
|
|
#define BT_VERSION_FULL \"4.11.${BT_BUILD} (${BT_HASH}${BT_DIRTY})\"
|
|
")
|
|
|
|
# write only when changed so incremental builds don't churn
|
|
if(EXISTS "${OUT}")
|
|
file(READ "${OUT}" OLD)
|
|
else()
|
|
set(OLD "")
|
|
endif()
|
|
if(NOT OLD STREQUAL CONTENT)
|
|
file(WRITE "${OUT}" "${CONTENT}")
|
|
endif()
|