aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2014-12-11 16:05:10 +0100
committerMartin Braun <martin.braun@ettus.com>2015-01-28 22:21:19 +0100
commit659d2e2c78d21ca79099c0ee0b7f5cffefbe04de (patch)
tree03c29936f8fbcfb60aeb62cd93bcea6925bee3f0
parentc0bb43a8a84599f4638df13b461659f79d980cc1 (diff)
downloaduhd-659d2e2c78d21ca79099c0ee0b7f5cffefbe04de.tar.gz
uhd-659d2e2c78d21ca79099c0ee0b7f5cffefbe04de.tar.bz2
uhd-659d2e2c78d21ca79099c0ee0b7f5cffefbe04de.zip
cmake: Dev branches can get a named version
-rw-r--r--host/cmake/Modules/UHDConfigVersion.cmake.in11
-rw-r--r--host/cmake/Modules/UHDVersion.cmake4
-rw-r--r--host/lib/CMakeLists.txt4
-rw-r--r--host/lib/uhd.rc.in4
4 files changed, 20 insertions, 3 deletions
diff --git a/host/cmake/Modules/UHDConfigVersion.cmake.in b/host/cmake/Modules/UHDConfigVersion.cmake.in
index 3d09687e1..67e0e408d 100644
--- a/host/cmake/Modules/UHDConfigVersion.cmake.in
+++ b/host/cmake/Modules/UHDConfigVersion.cmake.in
@@ -32,6 +32,7 @@ set(ENV{UHD_CONFIG_VERSION_USED} TRUE)
SET(MAJOR_VERSION @TRIMMED_VERSION_MAJOR@)
SET(MINOR_VERSION @TRIMMED_VERSION_MINOR@)
SET(PATCH_VERSION @TRIMMED_VERSION_PATCH@)
+SET(DEVEL_VERSION @UHD_VERSION_DEVEL@)
SET(PACKAGE_VERSION @TRIMMED_UHD_VERSION@)
SET(ENV{UHD_PACKAGE_VERSION} ${PACKAGE_VERSION})
@@ -48,6 +49,13 @@ IF(NOT PACKAGE_FIND_VERSION)
RETURN()
ENDIF(NOT PACKAGE_FIND_VERSION)
+# Development branches of UHD don't have a patch version. This is a hack
+# to add a fake patch version that should be higher than anything the user
+# requests.
+IF(DEVEL_VERSION)
+ SET(PACKAGE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.999")
+ENDIF(DEVEL_VERSION)
+
# assume incorrect versioning by default
SET(PACKAGE_VERSION_COMPATIBLE FALSE)
SET(PACKAGE_VERSION_EXACT FALSE)
@@ -164,3 +172,6 @@ ENDIF(UHD_USE_ABI)
IF(${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION})
SET(PACKAGE_VERSION_EXACT TRUE)
ENDIF()
+
+# Undo our patch-version-number hack
+SET(PACKAGE_VERSION @TRIMMED_UHD_VERSION@)
diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake
index 69f668d3f..bcbf66750 100644
--- a/host/cmake/Modules/UHDVersion.cmake
+++ b/host/cmake/Modules/UHDVersion.cmake
@@ -24,10 +24,12 @@ FIND_PACKAGE(Git QUIET)
# - increment major on api compatibility changes
# - increment minor on feature-level changes
# - increment patch on for bug fixes and docs
+# - set UHD_VERSION_DEVEL to true for master and development branches
########################################################################
SET(UHD_VERSION_MAJOR 003)
SET(UHD_VERSION_MINOR 008)
SET(UHD_VERSION_PATCH 001)
+SET(UHD_VERSION_DEVEL FALSE)
########################################################################
# Set up trimmed version numbers for DLL resource files and packages
@@ -36,7 +38,7 @@ SET(UHD_VERSION_PATCH 001)
FUNCTION(DEPAD_NUM input_num output_num)
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMAND ${PYTHON_EXECUTABLE} -c "print int('${input_num}')"
+ COMMAND ${PYTHON_EXECUTABLE} -c "print int('${input_num}') if isinstance('${input_num}', (int, long)) else '${input_num}'"
OUTPUT_VARIABLE depadded_num OUTPUT_STRIP_TRAILING_WHITESPACE
)
SET(${output_num} ${depadded_num} PARENT_SCOPE)
diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt
index 5755a6c4c..321278db5 100644
--- a/host/lib/CMakeLists.txt
+++ b/host/lib/CMakeLists.txt
@@ -99,6 +99,10 @@ LIBUHD_APPEND_SOURCES(
# Add DLL resource file to Windows build
########################################################################
IF(MSVC)
+ SET(RC_TRIMMED_VERSION_PATCH TRIMMED_VERSION_PATCH)
+ IF(UHD_VERSION_DEVEL)
+ SET(RC_TRIMMED_VERSION_PATCH "999")
+ ENDIF(UHD_VERSION_DEVEL)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/uhd.rc.in
${CMAKE_CURRENT_BINARY_DIR}/uhd.rc
diff --git a/host/lib/uhd.rc.in b/host/lib/uhd.rc.in
index feb006bd3..a0eb27b8c 100644
--- a/host/lib/uhd.rc.in
+++ b/host/lib/uhd.rc.in
@@ -1,8 +1,8 @@
#include <afxres.h>
VS_VERSION_INFO VERSIONINFO
- FILEVERSION @TRIMMED_VERSION_MAJOR@,@TRIMMED_VERSION_MINOR@,@TRIMMED_VERSION_PATCH@,@UHD_GIT_COUNT@
- PRODUCTVERSION @TRIMMED_VERSION_MAJOR@,@TRIMMED_VERSION_MINOR@,@TRIMMED_VERSION_PATCH@,@UHD_GIT_COUNT@
+ FILEVERSION @TRIMMED_VERSION_MAJOR@,@TRIMMED_VERSION_MINOR@,@RC_TRIMMED_VERSION_PATCH@,@UHD_GIT_COUNT@
+ PRODUCTVERSION @TRIMMED_VERSION_MAJOR@,@TRIMMED_VERSION_MINOR@,@RC_TRIMMED_VERSION_PATCH@,@UHD_GIT_COUNT@
FILEFLAGSMASK 0x3fL
#ifndef NDEBUG
FILEFLAGS 0x0L