From: Gereon Kremer Date: Tue, 7 Dec 2021 23:26:52 +0000 (-0800) Subject: Simpler versioning if release flag is set (#7758) X-Git-Tag: cvc5-1.0.0~709 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5aa96010b548a8ec0964fb002246e21ced2cac9;p=cvc5.git Simpler versioning if release flag is set (#7758) Following some discussion, this PR introduces a simpler versioning scheme if the CVC5_IS_RELEASE flag is set. In our regular versioning scheme, the first commit after release x.y.z has the version x.y.(z+1)-dev.1.abcdef0. Some users however may want to apply some patches, and still have cvc5 show the release version. With this PR, the version printed (if any commits are present since the tag) is x.y.z-modified if the CVC5_IS_RELEASE flag is still true. We always set it to false immediately after the tagged commit, so it does not change the versions printed by mainline cvc5. --- diff --git a/cmake/version-base.cmake b/cmake/version-base.cmake index c3cca6a08..811209a96 100644 --- a/cmake/version-base.cmake +++ b/cmake/version-base.cmake @@ -5,7 +5,6 @@ set(CVC5_IS_RELEASE "false") # These are used in other places in cmake # If possible, they are updated by version.cmake set(GIT_BUILD "false") -set(CVC5_IS_RELEASE "false") set(CVC5_VERSION "${CVC5_LAST_RELEASE}") set(CVC5_FULL_VERSION "${CVC5_LAST_RELEASE}") set(CVC5_GIT_INFO "") diff --git a/cmake/version-base.cmake.template b/cmake/version-base.cmake.template index e149ea380..ec31ccd69 100644 --- a/cmake/version-base.cmake.template +++ b/cmake/version-base.cmake.template @@ -5,7 +5,6 @@ set(CVC5_IS_RELEASE "{{IS_RELEASE}}") # These are used in other places in cmake # If possible, they are updated by version.cmake set(GIT_BUILD "false") -set(CVC5_IS_RELEASE "false") set(CVC5_VERSION "${CVC5_LAST_RELEASE}") set(CVC5_FULL_VERSION "${CVC5_LAST_RELEASE}") set(CVC5_GIT_INFO "") diff --git a/cmake/version.cmake b/cmake/version.cmake index e6edd528c..183fe213b 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -25,13 +25,20 @@ if(CMAKE_SCRIPT_MODE_FILE) else() # was run within the overall cmake project # add target to update versioninfo.cpp at build time - add_custom_target(gen-versioninfo - BYPRODUCTS + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/src/base/versioninfo.cpp COMMAND ${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} - -P ${PROJECT_SOURCE_DIR}/cmake/version.cmake) + -P ${PROJECT_SOURCE_DIR}/cmake/version.cmake + DEPENDS + ${PROJECT_SOURCE_DIR}/cmake/version-base.cmake + ${PROJECT_SOURCE_DIR}/cmake/version.cmake + ) + add_custom_target(gen-versioninfo + DEPENDS ${CMAKE_BINARY_DIR}/src/base/versioninfo.cpp + ) endif() # include basic version information @@ -112,8 +119,13 @@ if(GIT_FOUND) list(LENGTH VERSION_LIST VERSION_LIST_LENGTH) endwhile() - set(CVC5_VERSION "${GIT_LAST_TAG}-dev") - set(CVC5_FULL_VERSION "${GIT_LAST_TAG}-dev.${GIT_COMMITS_SINCE_TAG}.${GIT_COMMIT}") + if(CVC5_IS_RELEASE) + set(CVC5_VERSION "${CVC5_VERSION}-modified") + set(CVC5_FULL_VERSION "${CVC5_FULL_VERSION}-modified") + else() + set(CVC5_VERSION "${GIT_LAST_TAG}-dev") + set(CVC5_FULL_VERSION "${GIT_LAST_TAG}-dev.${GIT_COMMITS_SINCE_TAG}.${GIT_COMMIT}") + endif() set(CVC5_GIT_INFO "git ${GIT_COMMIT} on branch ${GIT_BRANCH}${GIT_DIRTY_MSG}") endif() endif() diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index d2c763159..8769ac323 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -48,7 +48,6 @@ file(GLOB_RECURSE source_files ${PROJECT_SOURCE_DIR}/src/*.cc ${PROJECT_SOURCE_DIR}/src/*.h ${PROJECT_SOURCE_DIR}/src/*.g) -string(REPLACE ";" " " source_files_list "${source_files}") add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.h diff --git a/src/base/versioninfo.cpp.in b/src/base/versioninfo.cpp.in index 0e873d7b3..af4129f6d 100644 --- a/src/base/versioninfo.cpp.in +++ b/src/base/versioninfo.cpp.in @@ -19,4 +19,4 @@ const bool ::cvc5::Configuration::GIT_BUILD = @GIT_BUILD@; const bool ::cvc5::Configuration::CVC5_IS_RELEASE = @CVC5_IS_RELEASE@; const char* const ::cvc5::Configuration::CVC5_VERSION = "@CVC5_VERSION@"; const char* const ::cvc5::Configuration::CVC5_FULL_VERSION = "@CVC5_FULL_VERSION@"; -const char* const ::cvc5::Configuration::CVC5_GIT_INFO = "@CVC5_GIT_INFO@"; \ No newline at end of file +const char* const ::cvc5::Configuration::CVC5_GIT_INFO = "@CVC5_GIT_INFO@";