2022-10-20 05:25:41 -07:00
|
|
|
set(NVIM_VERSION
|
2022-07-22 07:10:24 -07:00
|
|
|
"v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}${NVIM_VERSION_PRERELEASE}")
|
2022-07-14 00:12:27 -07:00
|
|
|
|
|
|
|
execute_process(
|
2022-11-07 10:42:21 -07:00
|
|
|
COMMAND git --git-dir=${NVIM_SOURCE_DIR}/.git --work-tree=${NVIM_SOURCE_DIR} describe --first-parent --dirty --always
|
2022-07-14 00:12:27 -07:00
|
|
|
OUTPUT_VARIABLE GIT_TAG
|
2022-10-20 05:25:41 -07:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2022-09-10 05:37:11 -07:00
|
|
|
RESULT_VARIABLE RES)
|
2022-07-14 00:12:27 -07:00
|
|
|
|
2022-09-10 05:37:11 -07:00
|
|
|
if(RES AND NOT RES EQUAL 0)
|
2022-10-20 05:25:41 -07:00
|
|
|
message(STATUS "Using NVIM_VERSION: ${NVIM_VERSION}")
|
|
|
|
file(WRITE "${OUTPUT}" "")
|
2022-07-14 00:12:27 -07:00
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2022-10-20 05:25:41 -07:00
|
|
|
# `git describe` annotates the most recent tagged release; for pre-release
|
|
|
|
# builds we append that to the dev version.
|
|
|
|
if(NVIM_VERSION_PRERELEASE)
|
|
|
|
string(REGEX REPLACE "^v[0-9]+.[0-9]+.[0-9]+-" "" NVIM_VERSION_GIT "${GIT_TAG}")
|
|
|
|
string(REGEX REPLACE "^([0-9]+)-([a-z0-9]+)" "\\1+\\2" NVIM_VERSION_GIT "${NVIM_VERSION_GIT}")
|
|
|
|
set(NVIM_VERSION "${NVIM_VERSION}-${NVIM_VERSION_GIT}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(NVIM_VERSION_STRING "#define NVIM_VERSION_MEDIUM \"${NVIM_VERSION}\"\n")
|
2022-07-14 00:12:27 -07:00
|
|
|
|
2022-07-22 07:10:24 -07:00
|
|
|
string(SHA1 CURRENT_VERSION_HASH "${NVIM_VERSION_STRING}")
|
2022-07-14 00:12:27 -07:00
|
|
|
if(EXISTS ${OUTPUT})
|
|
|
|
file(SHA1 "${OUTPUT}" NVIM_VERSION_HASH)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT "${NVIM_VERSION_HASH}" STREQUAL "${CURRENT_VERSION_HASH}")
|
2022-10-20 05:25:41 -07:00
|
|
|
message(STATUS "Using NVIM_VERSION: ${NVIM_VERSION}")
|
2022-07-14 00:12:27 -07:00
|
|
|
file(WRITE "${OUTPUT}" "${NVIM_VERSION_STRING}")
|
|
|
|
endif()
|