Skip to content

Commit

Permalink
Merge pull request #721 from argilo/fix-volk-version
Browse files Browse the repository at this point in the history
Express version information in decimal
  • Loading branch information
jdemel authored Dec 17, 2023
2 parents f653de9 + 8b5183b commit f2fb33c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
17 changes: 4 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions include/volk/volk_version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ __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
* (VOLK_VERSION / 100) % 100 is the MINOR version
* (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

Expand Down

0 comments on commit f2fb33c

Please sign in to comment.