aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2016-03-10 16:00:16 -0800
committerMartin Braun <martin.braun@ettus.com>2016-03-11 09:46:24 -0800
commit165fd400e995c9652c2dfe85c2fd589b750a2620 (patch)
tree2ecc8921d7c20142ca1733cccd9a48460f4336b0 /host
parent736b8a2b707472c3ad527a7fb6e79971bac99497 (diff)
downloaduhd-165fd400e995c9652c2dfe85c2fd589b750a2620.tar.gz
uhd-165fd400e995c9652c2dfe85c2fd589b750a2620.tar.bz2
uhd-165fd400e995c9652c2dfe85c2fd589b750a2620.zip
cmake: Rename version strings for dev branches
Diffstat (limited to 'host')
-rw-r--r--host/CMakeLists.txt4
-rw-r--r--host/cmake/Modules/UHDVersion.cmake36
2 files changed, 37 insertions, 3 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt
index 412154fcd..5143b8ac3 100644
--- a/host/CMakeLists.txt
+++ b/host/CMakeLists.txt
@@ -477,7 +477,7 @@ ENDIF(LIBUHD_PKG)
UHD_PRINT_COMPONENT_SUMMARY()
IF(UHD_VERSION_DEVEL)
MESSAGE(STATUS "******************************************************")
- IF(UHD_VERSION_PATCH STREQUAL "git")
+ IF(UHD_GIT_BRANCH STREQUAL "master")
MESSAGE(STATUS "* You are building the UHD development master branch.")
MESSAGE(STATUS "* For production code, we recommend our stable,")
MESSAGE(STATUS "* releases or using the release branch (maint).")
@@ -486,7 +486,7 @@ IF(UHD_VERSION_DEVEL)
MESSAGE(STATUS "* These branches are designed to provide early access")
MESSAGE(STATUS "* to UHD and USRP features, but should be considered")
MESSAGE(STATUS "* unstable and/or experimental!")
- ENDIF(UHD_VERSION_PATCH STREQUAL "git")
+ ENDIF(UHD_GIT_BRANCH STREQUAL "master")
MESSAGE(STATUS "******************************************************")
ENDIF(UHD_VERSION_DEVEL)
MESSAGE(STATUS "Building version: ${UHD_VERSION}${PRINT_APPEND}")
diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake
index 696817a96..54af40676 100644
--- a/host/cmake/Modules/UHDVersion.cmake
+++ b/host/cmake/Modules/UHDVersion.cmake
@@ -32,9 +32,43 @@ SET(UHD_VERSION_PATCH git)
SET(UHD_VERSION_DEVEL TRUE)
########################################################################
-# Set up trimmed version numbers for DLL resource files and packages
+# If we're on a development branch, we skip the patch version
########################################################################
+IF(NOT DEFINED UHD_VERSION_DEVEL)
+ SET(UHD_VERSION_DEVEL FALSE)
+ENDIF(NOT DEFINED UHD_VERSION_DEVEL)
+SET(UHD_GIT_BRANCH "")
+IF(GIT_FOUND)
+ EXECUTE_PROCESS(
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
+ OUTPUT_VARIABLE _git_branch OUTPUT_STRIP_TRAILING_WHITESPACE
+ RESULT_VARIABLE _git_branch_result
+ )
+ IF(_git_branch_result EQUAL 0)
+ IF(_git_branch STREQUAL "maint")
+ MESSAGE(STATUS "Operating on maint branch (stable).")
+ ELSEIF(_git_branch STREQUAL "master")
+ MESSAGE(STATUS "Operating on master branch.")
+ SET(UHD_VERSION_DEVEL TRUE)
+ ELSE()
+ MESSAGE(STATUS "Working off of feature or development branch. Updating version number.")
+ EXECUTE_PROCESS(
+ COMMAND ${PYTHON_EXECUTABLE} -c "print('${_git_branch}'.replace('/', '-'))"
+ OUTPUT_VARIABLE _git_safe_branch OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ SET(UHD_VERSION_PATCH ${_git_safe_branch})
+ SET(UHD_VERSION_DEVEL TRUE)
+ SET(UHD_GIT_BRANCH ${_git_branch})
+ ENDIF()
+ ELSE()
+ MESSAGE(STATUS "Could not determine git branch. Probably building from tarball.")
+ ENDIF()
+ENDIF(GIT_FOUND)
+########################################################################
+# Set up trimmed version numbers for DLL resource files and packages
+########################################################################
FUNCTION(DEPAD_NUM input_num output_num)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}