diff options
author | Josh Blum <josh@joshknows.com> | 2012-03-26 10:25:06 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-03-26 10:25:06 -0700 |
commit | d966b2171a5f9a537173651cf6cf394f2a8f4d42 (patch) | |
tree | ff3f78437e34fb54ceda93d7f1a9221c075723b3 /host | |
parent | 793c8c000a6844a688afb7eda2bb162dd588ad95 (diff) | |
parent | 68510d56fdba693e077955865ebcb4f10e26e9e1 (diff) | |
download | uhd-d966b2171a5f9a537173651cf6cf394f2a8f4d42.tar.gz uhd-d966b2171a5f9a537173651cf6cf394f2a8f4d42.tar.bz2 uhd-d966b2171a5f9a537173651cf6cf394f2a8f4d42.zip |
Merge branch 'maint'
Diffstat (limited to 'host')
-rw-r--r-- | host/cmake/Modules/UHDVersion.cmake | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake index 8f77188ee..b9ddddae3 100644 --- a/host/cmake/Modules/UHDVersion.cmake +++ b/host/cmake/Modules/UHDVersion.cmake @@ -32,34 +32,40 @@ SET(UHD_VERSION_PATCH 000) ######################################################################## # Version information discovery through git log ######################################################################## -IF(UHD_RELEASE_MODE) - SET(UHD_BUILD_INFO_DISCOVERY FALSE) - SET(UHD_BUILD_INFO "release") -ELSE() - SET(UHD_BUILD_INFO_DISCOVERY GIT_FOUND) - SET(UHD_BUILD_INFO "unknown") -ENDIF() -IF(UHD_BUILD_INFO_DISCOVERY) +#grab the git ref id for the current head +EXECUTE_PROCESS( + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long + OUTPUT_VARIABLE _git_describe OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE _git_describe_result +) - #grab the git ref id for the current head +#only set the build info on success +IF(_git_describe_result EQUAL 0) + EXECUTE_PROCESS( + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${PYTHON_EXECUTABLE} -c "print '${_git_describe}'.split('-')[1]" + OUTPUT_VARIABLE UHD_GIT_COUNT OUTPUT_STRIP_TRAILING_WHITESPACE + ) EXECUTE_PROCESS( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long - OUTPUT_VARIABLE _git_describe OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE _git_describe_result + COMMAND ${PYTHON_EXECUTABLE} -c "print '${_git_describe}'.split('-')[2]" + OUTPUT_VARIABLE UHD_GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) +ENDIF() - #only set the build info on success - IF(_git_describe_result EQUAL 0) - EXECUTE_PROCESS( - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${PYTHON_EXECUTABLE} -c "print '${_git_describe}'.split('-',1)[1]" - OUTPUT_VARIABLE UHD_BUILD_INFO OUTPUT_STRIP_TRAILING_WHITESPACE - ) - ENDIF() +IF(NOT UHD_GIT_COUNT) + SET(UHD_GIT_COUNT "0") +ENDIF() + +IF(NOT UHD_GIT_HASH) + SET(UHD_GIT_HASH "unknown") +ENDIF() -ENDIF(UHD_BUILD_INFO_DISCOVERY) +IF(UHD_RELEASE_MODE) + SET(UHD_GIT_HASH ${UHD_RELEASE_MODE}) +ENDIF() ######################################################################## -SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_BUILD_INFO}") +SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_GIT_COUNT}-${UHD_GIT_HASH}") |