diff options
Diffstat (limited to 'host/cmake/Modules')
| -rw-r--r-- | host/cmake/Modules/FindDocutils.cmake | 21 | ||||
| -rw-r--r-- | host/cmake/Modules/FindGit.cmake | 46 | ||||
| -rw-r--r-- | host/cmake/Modules/FindUSB1.cmake | 38 | ||||
| -rw-r--r-- | host/cmake/Modules/UHDComponent.cmake | 77 | ||||
| -rw-r--r-- | host/cmake/Modules/UHDPackage.cmake | 183 | ||||
| -rw-r--r-- | host/cmake/Modules/UHDPython.cmake | 86 | ||||
| -rw-r--r-- | host/cmake/Modules/UHDVersion.cmake | 75 | 
7 files changed, 526 insertions, 0 deletions
| diff --git a/host/cmake/Modules/FindDocutils.cmake b/host/cmake/Modules/FindDocutils.cmake new file mode 100644 index 000000000..25d1349e2 --- /dev/null +++ b/host/cmake/Modules/FindDocutils.cmake @@ -0,0 +1,21 @@ +# +# Copyright 2011-2011 Ettus Research LLC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program.  If not, see <http://www.gnu.org/licenses/>. +# + +######################################################################## +FIND_PROGRAM(RST2HTML_EXECUTABLE NAMES rst2html rst2html.py) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Docutils DEFAULT_MSG RST2HTML_EXECUTABLE) diff --git a/host/cmake/Modules/FindGit.cmake b/host/cmake/Modules/FindGit.cmake new file mode 100644 index 000000000..2d8214287 --- /dev/null +++ b/host/cmake/Modules/FindGit.cmake @@ -0,0 +1,46 @@ +# The module defines the following variables: +#   GIT_EXECUTABLE - path to git command line client +#   GIT_FOUND - true if the command line client was found +# Example usage: +#   find_package(Git) +#   if(GIT_FOUND) +#     message("git found: ${GIT_EXECUTABLE}") +#   endif() + +#============================================================================= +# Copyright 2010 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +#  License text for the above reference.) + +# Look for 'git' or 'eg' (easy git) +# +set(git_names git eg) + +# Prefer .cmd variants on Windows unless running in a Makefile +# in the MSYS shell. +# +if(WIN32) +  if(NOT CMAKE_GENERATOR MATCHES "MSYS") +    set(git_names git.cmd git eg.cmd eg) +  endif() +endif() + +find_program(GIT_EXECUTABLE +  NAMES ${git_names} +  DOC "git command line client" +  ) +mark_as_advanced(GIT_EXECUTABLE) + +# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if +# all listed variables are TRUE + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE) diff --git a/host/cmake/Modules/FindUSB1.cmake b/host/cmake/Modules/FindUSB1.cmake new file mode 100644 index 000000000..8bfc2f975 --- /dev/null +++ b/host/cmake/Modules/FindUSB1.cmake @@ -0,0 +1,38 @@ + +#find libusb 1.0 on various systems +#sets LIBUSB_FOUND, LIBUSB_LIBRARIES, LIBUSB_INCLUDE_DIRS +#override LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS to manually set + +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(PC_LIBUSB QUIET libusb-1.0) + +FIND_PATH(LIBUSB_INCLUDE_DIRS +    NAMES libusb.h +    HINTS $ENV{LIBUSB_DIR}/include ${PC_LIBUSB_INCLUDEDIR} +    PATHS /usr/local/include/libusb-1.0 /usr/local/include +    /usr/include/libusb-1.0 /usr/include +    /opt/local/include/libusb-1.0 + +    #non-conforming naming convention, +    #backwards compatible with old script +    ${LIBUSB_INCLUDE_DIR} +) + +#standard library name for libusb-1.0 +set(libusb1_library_names usb-1.0) + +#libusb-1.0 compatible library on freebsd +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") +    list(APPEND libusb1_library_names usb) +endif() + +FIND_LIBRARY(LIBUSB_LIBRARIES +    NAMES ${libusb1_library_names} +    HINTS $ENV{LIBUSB_DIR}/lib ${PC_LIBUSB_LIBDIR} +    PATHS /usr/local/lib /usr/lib /opt/local/lib +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS) +MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES) + diff --git a/host/cmake/Modules/UHDComponent.cmake b/host/cmake/Modules/UHDComponent.cmake new file mode 100644 index 000000000..52b7450d5 --- /dev/null +++ b/host/cmake/Modules/UHDComponent.cmake @@ -0,0 +1,77 @@ +# +# Copyright 2010-2011 Ettus Research LLC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program.  If not, see <http://www.gnu.org/licenses/>. +# + +######################################################################## +SET(_uhd_enabled_components "" CACHE INTERNAL "" FORCE) +SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE) + +######################################################################## +# Register a component into the system +#  - name the component string name +#  - var the global enable variable +#  - enb the default enable setting +#  - deps a list of dependencies +#  - dis the default disable setting +######################################################################## +MACRO(LIBUHD_REGISTER_COMPONENT name var enb deps dis) +    MESSAGE(STATUS "") +    MESSAGE(STATUS "Configuring ${name} support...") +    FOREACH(dep ${deps}) +        MESSAGE(STATUS "  Dependency ${dep} = ${${dep}}") +    ENDFOREACH(dep) + +    #setup the dependent option for this component +    INCLUDE(CMakeDependentOption) +    CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${enb} "${deps}" ${dis}) + +    #append the component into one of the lists +    IF(${var}) +        MESSAGE(STATUS "  Enabling ${name} support.") +        LIST(APPEND _uhd_enabled_components ${name}) +    ELSE(${var}) +        MESSAGE(STATUS "  Disabling ${name} support.") +        LIST(APPEND _uhd_disabled_components ${name}) +    ENDIF(${var}) +    MESSAGE(STATUS "  Override with -D${var}=ON/OFF") + +    #make components lists into global variables +    SET(_uhd_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE) +    SET(_uhd_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE) +ENDMACRO(LIBUHD_REGISTER_COMPONENT) + +######################################################################## +# Print the registered component summary +######################################################################## +FUNCTION(UHD_PRINT_COMPONENT_SUMMARY) +    MESSAGE(STATUS "") +    MESSAGE(STATUS "######################################################") +    MESSAGE(STATUS "# UHD enabled components                              ") +    MESSAGE(STATUS "######################################################") +    FOREACH(comp ${_uhd_enabled_components}) +        MESSAGE(STATUS "  * ${comp}") +    ENDFOREACH(comp) + +    MESSAGE(STATUS "") +    MESSAGE(STATUS "######################################################") +    MESSAGE(STATUS "# UHD disabled components                             ") +    MESSAGE(STATUS "######################################################") +    FOREACH(comp ${_uhd_disabled_components}) +        MESSAGE(STATUS "  * ${comp}") +    ENDFOREACH(comp) + +    MESSAGE(STATUS "") +ENDFUNCTION(UHD_PRINT_COMPONENT_SUMMARY) diff --git a/host/cmake/Modules/UHDPackage.cmake b/host/cmake/Modules/UHDPackage.cmake new file mode 100644 index 000000000..432859ccc --- /dev/null +++ b/host/cmake/Modules/UHDPackage.cmake @@ -0,0 +1,183 @@ +# +# Copyright 2010-2012 Ettus Research LLC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program.  If not, see <http://www.gnu.org/licenses/>. +# + +######################################################################## +INCLUDE(UHDVersion) #sets version information + +SET(UHD_RELEASE_MODE "${UHD_RELEASE_MODE}" CACHE BOOL "set UHD to release mode to build installers") + +######################################################################## +# Setup additional defines for OS types +######################################################################## +IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") +    SET(LINUX TRUE) +ENDIF() + +IF(LINUX AND EXISTS "/etc/debian_version") +    SET(DEBIAN TRUE) +ENDIF() + +IF(LINUX AND EXISTS "/etc/redhat-release") +    SET(REDHAT TRUE) +ENDIF() + +######################################################################## +# Set generator type for recognized systems +######################################################################## +IF(CPACK_GENERATOR) +    #already set +ELSEIF(APPLE) +    SET(CPACK_GENERATOR PackageMaker) +ELSEIF(WIN32) +    SET(CPACK_GENERATOR NSIS) +ELSEIF(DEBIAN) +    SET(CPACK_GENERATOR DEB) +ELSEIF(REDHAT) +    SET(CPACK_GENERATOR RPM) +ELSE() +    SET(CPACK_GENERATOR TGZ) +ENDIF() + +######################################################################## +# Setup package file name +######################################################################## +FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release) +IF((DEBIAN OR REDHAT) AND LSB_RELEASE_EXECUTABLE) + +    #extract system information by executing the commands +    EXECUTE_PROCESS( +        COMMAND ${LSB_RELEASE_EXECUTABLE} --short --id +        OUTPUT_VARIABLE LSB_ID OUTPUT_STRIP_TRAILING_WHITESPACE +    ) +    EXECUTE_PROCESS( +        COMMAND ${LSB_RELEASE_EXECUTABLE} --short --release +        OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE +    ) + +    #set a more sensible package name for this system +    SET(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_${LSB_ID}-${LSB_RELEASE}-${CMAKE_SYSTEM_PROCESSOR}") + +ENDIF() + +IF(${CPACK_GENERATOR} STREQUAL NSIS) + +    ENABLE_LANGUAGE(C) + +    include(CheckTypeSize) +    check_type_size("void*[8]" BIT_WIDTH BUILTIN_TYPES_ONLY) +    SET(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_Win${BIT_WIDTH}") + +    SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}") +ENDIF() + +######################################################################## +# Setup CPack General +######################################################################## +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - USRP Hardware Driver") +SET(CPACK_PACKAGE_VENDOR              "Ettus Research LLC") +SET(CPACK_PACKAGE_CONTACT             "Ettus Research <support@ettus.com>") +SET(CPACK_PACKAGE_VERSION "${UHD_VERSION}") +SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.txt) +SET(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/AUTHORS.txt) +SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt) + +######################################################################## +# Setup CPack Components +######################################################################## +SET(CPACK_COMPONENT_LIBRARIES_GROUP      "Development") +SET(CPACK_COMPONENT_HEADERS_GROUP        "Development") +SET(CPACK_COMPONENT_UTILITIES_GROUP      "Runtime") +SET(CPACK_COMPONENT_EXAMPLES_GROUP       "Runtime") +SET(CPACK_COMPONENT_TESTS_GROUP          "Runtime") +SET(CPACK_COMPONENT_MANUAL_GROUP         "Documentation") +SET(CPACK_COMPONENT_DOXYGEN_GROUP        "Documentation") +SET(CPACK_COMPONENT_README_GROUP         "Documentation") + +SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME      "Libraries") +SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME        "C++ Headers") +SET(CPACK_COMPONENT_UTILITIES_DISPLAY_NAME      "Utilities") +SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME       "Examples") +SET(CPACK_COMPONENT_TESTS_DISPLAY_NAME          "Unit Tests") +SET(CPACK_COMPONENT_MANUAL_DISPLAY_NAME         "Manual") +SET(CPACK_COMPONENT_DOXYGEN_DISPLAY_NAME        "Doxygen") +SET(CPACK_COMPONENT_README_DISPLAY_NAME         "Readme") +SET(CPACK_COMPONENT_IMAGES_DISPLAY_NAME         "Images") + +SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION     "Dynamic link library") +SET(CPACK_COMPONENT_HEADERS_DESCRIPTION       "C++ development headers") +SET(CPACK_COMPONENT_UTILITIES_DESCRIPTION     "Utility executables and python scripts") +SET(CPACK_COMPONENT_EXAMPLES_DESCRIPTION      "Example executables") +SET(CPACK_COMPONENT_TESTS_DESCRIPTION         "Unit test executables") +SET(CPACK_COMPONENT_MANUAL_DESCRIPTION        "Manual/application notes (rst and html)") +SET(CPACK_COMPONENT_DOXYGEN_DESCRIPTION       "API documentation (html)") +SET(CPACK_COMPONENT_README_DESCRIPTION        "Readme files (txt)") +SET(CPACK_COMPONENT_IMAGES_DESCRIPTION        "FPGA and firmware images") + +SET(CPACK_COMPONENT_README_REQUIRED TRUE) + +SET(CPACK_COMPONENT_UTILITIES_DEPENDS libraries) +SET(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries) +SET(CPACK_COMPONENT_TESTS_DEPENDS libraries) + +SET(CPACK_COMPONENTS_ALL libraries headers utilities examples tests manual doxygen readme images) + +######################################################################## +# Setup CPack Debian +######################################################################## +SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libusb-1.0-0, libboost-dev") +SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS "python, python-tk") +FOREACH(filename preinst postinst prerm postrm) +    LIST(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_BINARY_DIR}/debian/${filename}) +    FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/debian) +    CONFIGURE_FILE( +        ${CMAKE_SOURCE_DIR}/cmake/debian/${filename}.in +        ${CMAKE_BINARY_DIR}/debian/${filename} +    @ONLY) +ENDFOREACH(filename) + +######################################################################## +# Setup CPack RPM +######################################################################## +SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel, libusb1") + +FOREACH(filename post_install post_uninstall pre_install pre_uninstall) +    STRING(TOUPPER ${filename} filename_upper) +    LIST(APPEND CPACK_RPM_${filename_upper}_SCRIPT_FILE ${CMAKE_BINARY_DIR}/redhat/${filename}) +    FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/redhat) +    CONFIGURE_FILE( +        ${CMAKE_SOURCE_DIR}/cmake/redhat/${filename}.in +        ${CMAKE_BINARY_DIR}/redhat/${filename} +    @ONLY) +ENDFOREACH(filename) + +######################################################################## +# Setup CPack NSIS +######################################################################## +SET(CPACK_NSIS_MODIFY_PATH ON) + +SET(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"") + +SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " +    WriteRegStr HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\" \\\"$INSTDIR\\\\share\\\\uhd\\\" +") + +SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " +    DeleteRegValue HKLM ${HLKM_ENV} \\\"UHD_PKG_DATA_PATH\\\" +") + +######################################################################## +INCLUDE(CPack) #include after setting vars diff --git a/host/cmake/Modules/UHDPython.cmake b/host/cmake/Modules/UHDPython.cmake new file mode 100644 index 000000000..fdcdccb4b --- /dev/null +++ b/host/cmake/Modules/UHDPython.cmake @@ -0,0 +1,86 @@ +# +# Copyright 2010-2011 Ettus Research LLC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program.  If not, see <http://www.gnu.org/licenses/>. +# + +IF(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE) +SET(INCLUDED_UHD_PYTHON_CMAKE TRUE) + +######################################################################## +# Setup Python +######################################################################## +MESSAGE(STATUS "") +MESSAGE(STATUS "Configuring the python interpreter...") +#this allows the user to override PYTHON_EXECUTABLE +IF(PYTHON_EXECUTABLE) + +    SET(PYTHONINTERP_FOUND TRUE) + +#otherwise if not set, try to automatically find it +ELSE(PYTHON_EXECUTABLE) + +    #use the built-in find script +    FIND_PACKAGE(PythonInterp) + +    #and if that fails use the find program routine +    IF(NOT PYTHONINTERP_FOUND) +        FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python python2.7 python2.6) +        IF(PYTHON_EXECUTABLE) +            SET(PYTHONINTERP_FOUND TRUE) +        ENDIF(PYTHON_EXECUTABLE) +    ENDIF(NOT PYTHONINTERP_FOUND) + +ENDIF(PYTHON_EXECUTABLE) + +#make the path to the executable appear in the cmake gui +SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") + +MESSAGE(STATUS "Python interpreter: ${PYTHON_EXECUTABLE}") +MESSAGE(STATUS "Override with: -DPYTHON_EXECUTABLE=<path-to-python>") + +IF(NOT PYTHONINTERP_FOUND) +    MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.") +ENDIF(NOT PYTHONINTERP_FOUND) + +MACRO(PYTHON_CHECK_MODULE desc mod cmd have) +    MESSAGE(STATUS "") +    MESSAGE(STATUS "Python checking for ${desc}") +    EXECUTE_PROCESS( +        COMMAND ${PYTHON_EXECUTABLE} -c " +######################################### +try: import ${mod} +except: exit(1) +try: assert ${cmd} +except: exit(2) +exit(0) +#########################################" +        RESULT_VARIABLE ${have} +    ) +    IF(${have} EQUAL 0) +        MESSAGE(STATUS "Python checking for ${desc} - found") +        SET(${have} TRUE) +    ELSEIF(${have} EQUAL 1) +        MESSAGE(STATUS "Python checking for ${desc} - \"import ${mod}\" failed") +        SET(${have} FALSE) +    ELSEIF(${have} EQUAL 2) +        MESSAGE(STATUS "Python checking for ${desc} - \"assert ${cmd}\" failed") +        SET(${have} FALSE) +    ELSE() +        MESSAGE(STATUS "Python checking for ${desc} - unknown error") +        SET(${have} FALSE) +    ENDIF() +ENDMACRO(PYTHON_CHECK_MODULE) + +ENDIF(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE) diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake new file mode 100644 index 000000000..38cbe819c --- /dev/null +++ b/host/cmake/Modules/UHDVersion.cmake @@ -0,0 +1,75 @@ +# +# Copyright 2010-2012 Ettus Research LLC +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program.  If not, see <http://www.gnu.org/licenses/>. +# + +######################################################################## +INCLUDE(UHDPython) #requires python for parsing +FIND_PACKAGE(Git QUIET) + +######################################################################## +# Setup Version Numbers +#  - increment major on api compatibility changes +#  - increment minor on feature-level changes +#  - increment patch on for bug fixes and docs +######################################################################## +SET(UHD_VERSION_MAJOR 003) +SET(UHD_VERSION_MINOR 004) +SET(UHD_VERSION_PATCH 002) + +######################################################################## +# Version information discovery through git log +######################################################################## + +#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 +) + +#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 ${PYTHON_EXECUTABLE} -c "print '${_git_describe}'.split('-')[2]" +        OUTPUT_VARIABLE UHD_GIT_HASH 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() + +IF(UHD_RELEASE_MODE) +    SET(UHD_GIT_HASH ${UHD_RELEASE_MODE}) +ENDIF() + +######################################################################## +IF(UHD_RELEASE_MODE STREQUAL "release") +    SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_GIT_HASH}") +ELSE() +    SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_MINOR}.${UHD_VERSION_PATCH}-${UHD_GIT_COUNT}-${UHD_GIT_HASH}") +ENDIF() | 
