From a990e8c0435627ad1dfe2e04219512ad78342b56 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Mon, 17 Oct 2022 09:37:13 -0400 Subject: [PATCH 1/2] pin to specific version of VG cmake kit --- CMakeLists.txt | 2 ++ bin/admin/dependency-versions-update-hook.py | 2 +- external/versions.cmake | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5158b622..e66f212fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.15.0) # need list(PREPEND for toolchains ############################################################################### # Bring ValeevGroup cmake toolkit ############################################################################### +include(external/versions.cmake) include(FetchContent) if (DEFINED PROJECT_BINARY_DIR) set(VG_CMAKE_KIT_PREFIX_DIR PROJECT_BINARY_DIR) @@ -13,6 +14,7 @@ FetchContent_Declare( vg_cmake_kit QUIET GIT_REPOSITORY https://github.com/ValeevGroup/kit-cmake.git + GIT_TAG ${SEQUANT_TRACKED_VGCMAKEKIT_TAG} SOURCE_DIR ${${VG_CMAKE_KIT_PREFIX_DIR}}/cmake/vg BINARY_DIR ${${VG_CMAKE_KIT_PREFIX_DIR}}/cmake/vg-build SUBBUILD_DIR ${${VG_CMAKE_KIT_PREFIX_DIR}}/cmake/vg-subbuild diff --git a/bin/admin/dependency-versions-update-hook.py b/bin/admin/dependency-versions-update-hook.py index 5904443d7..f381ccc11 100755 --- a/bin/admin/dependency-versions-update-hook.py +++ b/bin/admin/dependency-versions-update-hook.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function import sys diff --git a/external/versions.cmake b/external/versions.cmake index 5224a7b94..b53e14b02 100644 --- a/external/versions.cmake +++ b/external/versions.cmake @@ -1,6 +1,8 @@ # for each dependency track both current and previous id (the variable for the latter must contain PREVIOUS) # to be able to auto-update them +set(SEQUANT_TRACKED_VGCMAKEKIT_TAG 3091737b0a536616f1d12f0128b88de7bd1119cb) + set(SEQUANT_TRACKED_BOOST_VERSION 1.67) set(SEQUANT_TRACKED_BOOST_PREVIOUS_VERSION 1.67) From a623b8db0fb2e9e65de991290cbb54305a0b72e3 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Mon, 17 Oct 2022 09:38:19 -0400 Subject: [PATCH 2/2] - sequant::revision -> sequant::git_revision - introduced sequant::git_description --- CMakeLists.txt | 26 ++++++++------------------ SeQuant/version.cpp | 7 ++++++- SeQuant/version.hpp.in | 11 ++++++++++- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e66f212fb..a5b311999 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,18 +34,9 @@ else (SEQUANT_PRERELEASE_ID) set(SEQUANT_EXT_VERSION "${SEQUANT_VERSION}") endif (SEQUANT_PRERELEASE_ID) -# extract git revision -if (EXISTS ${PROJECT_SOURCE_DIR}/.git) - find_package(Git REQUIRED) - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse -q HEAD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_VARIABLE SEQUANT_REVISION) - string(REGEX MATCH "[0-9a-f]*" - SEQUANT_REVISION "${SEQUANT_REVISION}") -else () - set(SEQUANT_REVISION "unknown") -endif () +# extract git metadata +include(GetGitMetadata) +vgkit_cmake_git_metadata() # make SeQuant project project(SeQuant LANGUAGES CXX VERSION "${SEQUANT_VERSION}" DESCRIPTION "SEcond QUANTization toolkit") @@ -81,7 +72,6 @@ include(FetchContent) include(AddCustomTargetSubproject) include(FeatureSummary) include(CMakePackageConfigHelpers) -include(external/versions.cmake) ########################## # Standard build variables @@ -261,11 +251,11 @@ add_library(SeQuant SeQuant/domain/mbpt/antisymmetrizer.hpp SeQuant/domain/mbpt/rdm.hpp ) -# feed SEQUANT_REVISION to SeQuant/version.cpp only to avoid recompiling everything -set_property( - SOURCE SeQuant/version.cpp - PROPERTY COMPILE_DEFINITIONS - SEQUANT_REVISION=\"${SEQUANT_REVISION}\" +# feed SEQUANT_GIT_REVISION and SEQUANT_GIT_DESCRIPTION to SeQuant/version.cpp only to avoid recompiling everything +set_source_files_properties( + SeQuant/version.cpp + PROPERTIES COMPILE_DEFINITIONS + "SEQUANT_GIT_REVISION=\"${SEQUANT_GIT_REVISION}\";SEQUANT_GIT_DESCRIPTION=\"${SEQUANT_GIT_DESCRIPTION}\"" ) target_link_libraries(SeQuant PUBLIC range-v3::range-v3 Boost::regex Boost::boost SeQuant-bliss Threads::Threads) diff --git a/SeQuant/version.cpp b/SeQuant/version.cpp index c412c8007..742ff4502 100644 --- a/SeQuant/version.cpp +++ b/SeQuant/version.cpp @@ -7,8 +7,13 @@ namespace sequant { const char* revision() noexcept { - static const char revision[] = SEQUANT_REVISION; + static const char revision[] = SEQUANT_GIT_REVISION; return revision; } +const char* git_description() noexcept { + static const char description[] = SEQUANT_GIT_DESCRIPTION; + return description; +} + } // namespace sequant diff --git a/SeQuant/version.hpp.in b/SeQuant/version.hpp.in index 189bf238a..e52962ee5 100644 --- a/SeQuant/version.hpp.in +++ b/SeQuant/version.hpp.in @@ -21,8 +21,17 @@ #define SEQUANT_PRERELEASE_ID "@SEQUANT_PRERELEASE_ID@" namespace sequant { + /** \return a string with the Git SHA1 revision hash tag of SeQuant */ -const char* revision() noexcept; +const char* git_revision() noexcept; + +/** + * \return a string with the human-readable description of the current source + * tree of SeQuant + * \note see `git describe --dirty` for the format description + * */ +const char* git_description() noexcept; + } // namespace sequant #endif // SEQUANT_SRC_SEQUANT_VERSION_H_IN_H