robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
c50951a4d0
master
1set ( NVIM_VERSION 2"v ${ NVIM_VERSION_MAJOR } . ${ NVIM_VERSION_MINOR } . ${ NVIM_VERSION_PATCH }${ NVIM_VERSION_PRERELEASE } " ) 3 4execute_process ( 5COMMAND git --git-dir= ${ NVIM_SOURCE_DIR } /.git --work-tree= ${ NVIM_SOURCE_DIR } describe --first-parent --dirty --always 6OUTPUT_VARIABLE GIT_TAG 7OUTPUT_STRIP_TRAILING_WHITESPACE 8ERROR_QUIET 9RESULT_VARIABLE RES ) 10if ( RES) 11message ( STATUS "Using NVIM_VERSION: ${ NVIM_VERSION } " ) 12file ( WRITE " ${ OUTPUT } " "" ) 13return () 14endif () 15 16# Extract build info: "v0.9.0-145-g0f9113907" => "g0f9113907" 17string ( REGEX REPLACE ".*\\-" "" NVIM_VERSION_BUILD " ${ GIT_TAG } " ) 18 19# `git describe` annotates the most recent tagged release; for pre-release 20# builds we append that to the dev version. 21if ( NVIM_VERSION_PRERELEASE) 22# Extract pre-release info: "v0.8.0-145-g0f9113907" => "145-g0f9113907" 23string ( REGEX REPLACE "^v[0-9]+.[0-9]+.[0-9]+-" "" NVIM_VERSION_GIT " ${ GIT_TAG } " ) 24# Replace "-" with "+": "145-g0f9113907" => "145+g0f9113907" 25string ( REGEX REPLACE "^([0-9]+)-([a-z0-9]+)" "\\1+\\2" NVIM_VERSION_GIT " ${ NVIM_VERSION_GIT } " ) 26set ( NVIM_VERSION " ${ NVIM_VERSION } - ${ NVIM_VERSION_GIT } " ) 27endif () 28 29set ( NVIM_VERSION_STRING "#define NVIM_VERSION_MEDIUM \" ${ NVIM_VERSION } \"\n#define NVIM_VERSION_BUILD \" ${ NVIM_VERSION_BUILD } \"\n" ) 30 31string ( SHA1 CURRENT_VERSION_HASH " ${ NVIM_VERSION_STRING } " ) 32if ( EXISTS ${ OUTPUT }) 33file ( SHA1 " ${ OUTPUT } " NVIM_VERSION_HASH ) 34endif () 35 36if ( NOT " ${ NVIM_VERSION_HASH } " STREQUAL " ${ CURRENT_VERSION_HASH } " ) 37message ( STATUS "Using NVIM_VERSION: ${ NVIM_VERSION } " ) 38file ( WRITE " ${ OUTPUT } " " ${ NVIM_VERSION_STRING } " ) 39if ( WIN32) 40configure_file ( " ${ OUTPUT } " " ${ OUTPUT } " NEWLINE_STYLE UNIX ) 41endif () 42endif ()