[PATCH 7/7] Express version information in decimal
authorClayton Smith <argilo@gmail.com>
Mon, 11 Dec 2023 19:10:20 +0000 (14:10 -0500)
committerA. Maitland Bottoms <bottoms@debian.org>
Sat, 16 Dec 2023 14:31:28 +0000 (09:31 -0500)
Signed-off-by: Clayton Smith <argilo@gmail.com>
Gbp-Pq: Name 0007-Express-version-information-in-decimal.patch

CMakeLists.txt
include/volk/volk_version.h.in

index 2416eb261e7bb0557f96be628aab999c3700c6f6..2ff536a7ca1305a7d90edaef891235821703bf38 100644 (file)
@@ -80,19 +80,10 @@ set(VERSION_INFO_MINOR_VERSION 1)
 set(VERSION_INFO_MAINT_VERSION 0)
 include(VolkVersion) #setup version info
 
-macro(set_version_str VAR)
-  set(IN_VER ${VERSION_INFO_${VAR}_VERSION})
-  string(LENGTH "${IN_VER}" VER_LEN)
-  if(${VER_LEN} EQUAL 1)
-    set(VOLK_VERSION_${VAR} "0${IN_VER}")
-  else()
-    set(VOLK_VERSION_${VAR} "${IN_VER}")
-  endif()
-endmacro()
-
-set_version_str(MAJOR)
-set_version_str(MINOR)
-set_version_str(MAINT)
+math(EXPR VOLK_VERSION_DECIMAL
+    "${VERSION_INFO_MAJOR_VERSION} * 10000
+    + ${VERSION_INFO_MINOR_VERSION} * 100
+    + ${VERSION_INFO_MAINT_VERSION}")
 
 configure_file(
     ${CMAKE_SOURCE_DIR}/include/volk/volk_version.h.in
index e565048902328fcbcf85cf1b2fe9ac25c34487b3..5fce7d306bf54ed9695090cc648e14ea04f1afed 100644 (file)
@@ -20,9 +20,9 @@ __VOLK_DECL_BEGIN
  * some specific API is present and functional.
  */
 
-#define VOLK_VERSION_MAJOR @VOLK_VERSION_MAJOR@
-#define VOLK_VERSION_MINOR @VOLK_VERSION_MINOR@
-#define VOLK_VERSION_MAINT @VOLK_VERSION_MAINT@
+#define VOLK_VERSION_MAJOR @VERSION_INFO_MAJOR_VERSION@
+#define VOLK_VERSION_MINOR @VERSION_INFO_MINOR_VERSION@
+#define VOLK_VERSION_MAINT @VERSION_INFO_MAINT_VERSION@
 
 /*
  * VOLK_VERSION % 100 is the MAINT version
@@ -30,7 +30,7 @@ __VOLK_DECL_BEGIN
  * (VOLK_VERSION / 100) / 100 is the MAJOR version
  */
 
-#define VOLK_VERSION @VOLK_VERSION_MAJOR@@VOLK_VERSION_MINOR@@VOLK_VERSION_MAINT@
+#define VOLK_VERSION @VOLK_VERSION_DECIMAL@
 
 __VOLK_DECL_END