aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'host/cmake/Modules')
-rw-r--r--host/cmake/Modules/UHDBuildInfo.cmake60
-rw-r--r--host/cmake/Modules/UHDVersion.cmake46
2 files changed, 102 insertions, 4 deletions
diff --git a/host/cmake/Modules/UHDBuildInfo.cmake b/host/cmake/Modules/UHDBuildInfo.cmake
new file mode 100644
index 000000000..bc30b99ee
--- /dev/null
+++ b/host/cmake/Modules/UHDBuildInfo.cmake
@@ -0,0 +1,60 @@
+#
+# Copyright 2015 National Instruments Corp.
+#
+# 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/>.
+#
+
+#
+# We need this to be macro because GET_DIRECTORY_PROPERTY works with
+# the current directory.
+#
+MACRO(UHD_LOAD_BUILD_INFO)
+ MESSAGE(STATUS "")
+ MESSAGE(STATUS "Loading build info.")
+
+ # Build date
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c
+ "import time; print(time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime()))"
+ OUTPUT_VARIABLE UHD_BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ # Compiler name
+ IF(MSVC)
+ IF(MSVC10)
+ SET(UHD_C_COMPILER "MSVC 2010")
+ SET(UHD_CXX_COMPILER "MSVC 2010")
+ ELSEIF(MSVC11)
+ SET(UHD_C_COMPILER "MSVC 2012")
+ SET(UHD_CXX_COMPILER "MSVC 2012")
+ ELSEIF(MSVC12)
+ SET(UHD_C_COMPILER "MSVC 2013")
+ SET(UHD_CXX_COMPILER "MSVC 2013")
+ ELSEIF(MSVC14)
+ SET(UHD_C_COMPILER "MSVC 2015")
+ SET(UHD_CXX_COMPILER "MSVC 2015")
+ ELSE()
+ # Go with the ugly string
+ SET(UHD_C_COMPILER "MSVC ${CMAKE_C_COMPILER_VERSION}")
+ SET(UHD_CXX_COMPILER "MSVC ${CMAKE_CXX_COMPILER_VERSION}")
+ ENDIF(MSVC10)
+ ELSE()
+ SET(UHD_C_COMPILER "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
+ SET(UHD_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
+ ENDIF(MSVC)
+
+ # Compiler flags
+ GET_DIRECTORY_PROPERTY(uhd_flags COMPILE_DEFINITIONS)
+ SET(UHD_C_FLAGS "${uhd_flags}${CMAKE_C_FLAGS}") # CMAKE_C_FLAGS starts with a space
+ SET(UHD_CXX_FLAGS "${uhd_flags}${CMAKE_CXX_FLAGS}") # CMAKE_CXX_FLAGS starts with a space
+ENDMACRO(UHD_LOAD_BUILD_INFO)
diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake
index 4b26efdb2..2b105585b 100644
--- a/host/cmake/Modules/UHDVersion.cmake
+++ b/host/cmake/Modules/UHDVersion.cmake
@@ -27,14 +27,52 @@ FIND_PACKAGE(Git QUIET)
# - set UHD_VERSION_DEVEL to true for master and development branches
########################################################################
SET(UHD_VERSION_MAJOR 003)
-SET(UHD_VERSION_MINOR 009)
-SET(UHD_VERSION_PATCH 004)
-SET(UHD_VERSION_DEVEL FALSE)
+SET(UHD_VERSION_MINOR 010)
+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(DEFINED UHD_VERSION_PATCH_OVERRIDE)
+ SET(UHD_VERSION_DEVEL FALSE)
+ SET(UHD_VERSION_PATCH ${UHD_VERSION_PATCH_OVERRIDE})
+ENDIF(DEFINED UHD_VERSION_PATCH_OVERRIDE)
+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}