# 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=
-DSRC= -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) # content/LAST.EGG is rewritten by the game every run and content/OPERATOR.EGG # is overwritten by the operator app on Save -- both are runtime working files, # not source, so exclude them (else the build stamps a false '+' dirty marker). execute_process(COMMAND git status --porcelain --untracked-files=no -- . ":(exclude)content/LAST.EGG" ":(exclude)content/OPERATOR.EGG" 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()