Files
AnyPS5/core/relinker/revision.cmake
T
ebosido444-ai e48781e8fe feat(relinker): report the build revision with --version
The relinker binary carried no build identity: a release build and a
checkout of main were indistinguishable, so a report could not name the
build it came from. --version prints the revision git describe reports,
falling back to "unknown" when the tree has no git metadata, and needs
no input or output paths. The usage line and USAGE.md list the option.
2026-10-26 09:57:41 +03:00

12 lines
545 B
CMake

set(revision unknown)
if(GIT)
execute_process(COMMAND "${GIT}" -C "${SOURCE}" describe --tags --always --dirty
OUTPUT_VARIABLE described RESULT_VARIABLE failed OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
if(failed EQUAL 0 AND NOT described STREQUAL "")
set(revision ${described})
endif()
endif()
file(WRITE "${OUTPUT}.new" "#pragma once\n#define ANYPS5_RELINKER_REVISION \"${revision}\"\n")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OUTPUT}.new" "${OUTPUT}")
file(REMOVE "${OUTPUT}.new")