aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake/Modules
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-03-26 10:20:58 -0700
committerJosh Blum <josh@joshknows.com>2012-03-26 10:20:58 -0700
commit68510d56fdba693e077955865ebcb4f10e26e9e1 (patch)
treeed9ef84ef23bb0f5466777a44783644f926a47d7 /host/cmake/Modules
parent17068bc38dff216caed300141015fee882dfb133 (diff)
downloaduhd-68510d56fdba693e077955865ebcb4f10e26e9e1.tar.gz
uhd-68510d56fdba693e077955865ebcb4f10e26e9e1.tar.bz2
uhd-68510d56fdba693e077955865ebcb4f10e26e9e1.zip
uhd: use release mode and git count for stable and unstable builds
Diffstat (limited to 'host/cmake/Modules')
-rw-r--r--host/cmake/Modules/UHDVersion.cmake50
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}")