diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/CMakeLists.txt | 4 | ||||
-rw-r--r-- | host/cmake/Modules/UHDVersion.cmake | 36 |
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} |