From b71c2cc9938eee649d6b4a787d4c4bebe849d6e9 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Wed, 10 Jan 2018 15:38:08 +0100 Subject: build: Add patchlevel to version This adds a patchlevel to the Ouroboros version. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- CMakeLists.txt | 4 +++- cmake/GitVersionGen.cmake | 8 ++++++-- src/irmd/config.h.in | 1 + src/irmd/main.c | 5 +++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46ae6324..c8f946bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,8 @@ set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}") set(PACKAGE_DESCRIPTION "The Ouroboros prototype") set(PACKAGE_URL "http://ouroboros.ilabt.imec.be") set(PACKAGE_BUGREPORT "http://ouroboros.ilabt.imec.be/bugzilla/") -set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}") +set(PACKAGE_VERSION + "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}") if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING @@ -139,6 +140,7 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE_DESCRIPTION}") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") set(CPACK_PACKAGE_VERSION_MAJOR "${PACKAGE_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${PACKAGE_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${PACKAGE_VERSION_PATCH}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") set(CPACK_GENERATOR "TGZ") diff --git a/cmake/GitVersionGen.cmake b/cmake/GitVersionGen.cmake index 916572ff..42753d7c 100644 --- a/cmake/GitVersionGen.cmake +++ b/cmake/GitVersionGen.cmake @@ -24,13 +24,17 @@ macro(git_version_gen) message(STATUS "Repository tag is: ${_git_tag}") string(REGEX REPLACE - "[^0-9]*([0-9]+)\\.[0-9]+.*" "\\1" + "^([0-9]+)\\..*" "\\1" _version_major "${_git_tag}") string(REGEX REPLACE - "[^0-9]*[0-9]+\\.([0-9]+).*" "\\1" + "^[0-9]+\\.([0-9]+)\\..*" "\\1" _version_minor "${_git_tag}") + string(REGEX REPLACE + "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" + _version_patch "${_git_tag}") set(PACKAGE_VERSION_MAJOR "${_version_major}") set(PACKAGE_VERSION_MINOR "${_version_minor}") + set(PACKAGE_VERSION_PATCH "${_version_patch}") endmacro(git_version_gen) diff --git a/src/irmd/config.h.in b/src/irmd/config.h.in index 8ed66004..2a1a6d6a 100644 --- a/src/irmd/config.h.in +++ b/src/irmd/config.h.in @@ -30,6 +30,7 @@ #define OUROBOROS_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@ #define OUROBOROS_VERSION_MINOR @PACKAGE_VERSION_MINOR@ +#define OUROBOROS_VERSION_PATCH @PACKAGE_VERSION_PATCH@ #define PTHREAD_COND_CLOCK @PTHREAD_COND_CLOCK@ diff --git a/src/irmd/main.c b/src/irmd/main.c index 96c30b4a..f109d5e2 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -2298,9 +2298,10 @@ int main(int argc, argc--; argv++; } else if (strcmp(*argv, "--version") == 0) { - printf("Ouroboros version %d.%d\n", + printf("Ouroboros version %d.%d.%d\n", OUROBOROS_VERSION_MAJOR, - OUROBOROS_VERSION_MINOR); + OUROBOROS_VERSION_MINOR, + OUROBOROS_VERSION_PATCH); exit(EXIT_SUCCESS); } else { usage(); -- cgit v1.2.3