Simpler versioning if release flag is set (#7758)
authorGereon Kremer <gkremer@stanford.edu>
Tue, 7 Dec 2021 23:26:52 +0000 (15:26 -0800)
committerGitHub <noreply@github.com>
Tue, 7 Dec 2021 23:26:52 +0000 (23:26 +0000)
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.

cmake/version-base.cmake
cmake/version-base.cmake.template
cmake/version.cmake
src/base/CMakeLists.txt
src/base/versioninfo.cpp.in

index c3cca6a089df9abb71769b0a4547c965d2d99808..811209a96cf742d9ccc00afe5a3856bf24b9520d 100644 (file)
@@ -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 "")
index e149ea3800181bf9332dfaa1b9a8ca971dae94af..ec31ccd696ebdacbe7eb5f0e703bc0a0c4ebe355 100644 (file)
@@ -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 "")
index e6edd528c23c27ed93c79bbc3087729bc8ab2914..183fe213b7a4c62b9ec7200c545dd1862650826a 100644 (file)
@@ -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()
index d2c7631594511abec11aa3028de18a64d523a672..8769ac323a7eb5e8af5641fd2e8051b89eed03e6 100644 (file)
@@ -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
index 0e873d7b38a468386257da0b7974a78a53d5ccaa..af4129f6d9beb8402e6914181dc83b556cea9e6b 100644 (file)
@@ -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@";