root / host / cmake / Modules / UHDVersion.cmake @ 2033713d
History | View | Annotate | Download (2.43 KB)
| 1 |
# |
|---|---|
| 2 |
# Copyright 2010-2012 Ettus Research LLC |
| 3 |
# |
| 4 |
# This program is free software: you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU General Public License as published by |
| 6 |
# the Free Software Foundation, either version 3 of the License, or |
| 7 |
# (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
# |
| 17 |
|
| 18 |
######################################################################## |
| 19 |
INCLUDE(UHDPython) #requires python for parsing |
| 20 |
FIND_PACKAGE(Git QUIET) |
| 21 |
|
| 22 |
######################################################################## |
| 23 |
# Setup Version Numbers |
| 24 |
# - increment major on api compatibility changes |
| 25 |
# - increment minor on feature-level changes |
| 26 |
# - increment patch on for bug fixes and docs |
| 27 |
######################################################################## |
| 28 |
SET(UHD_VERSION_MAJOR 003) |
| 29 |
SET(UHD_VERSION_MINOR 004) |
| 30 |
SET(UHD_VERSION_PATCH 000) |
| 31 |
|
| 32 |
######################################################################## |
| 33 |
# Version information discovery through git log |
| 34 |
######################################################################## |
| 35 |
IF(UHD_RELEASE_MODE) |
| 36 |
SET(UHD_BUILD_INFO_DISCOVERY FALSE) |
| 37 |
SET(UHD_BUILD_INFO "release") |
| 38 |
ELSE() |
| 39 |
SET(UHD_BUILD_INFO_DISCOVERY GIT_FOUND) |
| 40 |
SET(UHD_BUILD_INFO "unknown") |
| 41 |
ENDIF() |
| 42 |
|
| 43 |
IF(UHD_BUILD_INFO_DISCOVERY) |
| 44 |
|
| 45 |
#grab the git ref id for the current head |
| 46 |
EXECUTE_PROCESS( |
| 47 |
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
| 48 |
COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long
|
| 49 |
OUTPUT_VARIABLE _git_describe OUTPUT_STRIP_TRAILING_WHITESPACE |
| 50 |
RESULT_VARIABLE _git_describe_result |
| 51 |
) |
| 52 |
|
| 53 |
#only set the build info on success |
| 54 |
IF(_git_describe_result EQUAL 0) |
| 55 |
EXECUTE_PROCESS( |
| 56 |
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
| 57 |
COMMAND ${PYTHON_EXECUTABLE} -c "print '${_git_describe}'.split('-',1)[1]"
|
| 58 |
OUTPUT_VARIABLE UHD_BUILD_INFO OUTPUT_STRIP_TRAILING_WHITESPACE |
| 59 |
) |
| 60 |
ENDIF() |
| 61 |
|
| 62 |
ENDIF(UHD_BUILD_INFO_DISCOVERY) |
| 63 |
|
| 64 |
######################################################################## |
| 65 |
SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_BUILD_INFO}")
|