add capture of git revision into VERSION.sha

Signed-off-by: Karl W. Schulz <karl.schulz@amd.com>
This commit is contained in:
Karl W. Schulz
2022-11-11 06:44:40 -06:00
committed by Karl W. Schulz
parent 7d7687e804
commit 0d314be72d
3 changed files with 17 additions and 0 deletions
+1
View File
@@ -14,6 +14,7 @@ __pycache__
.coverage
saved_analysis
pmc_kernel_top.csv
VERSION.sha
# temp files
/tests/Testing
+15
View File
@@ -33,6 +33,17 @@ project(
include(ExternalProject)
include(GNUInstallDirs)
# version control info
find_package(Git)
if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
execute_process(
COMMAND git log --pretty=format:%h -n 1
OUTPUT_VARIABLE OMNIPERF_GIT_REV
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
endif()
message(STATUS "Git revision: ${GIT_REV}")
set(CMAKE_BUILD_TYPE "Release")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
@@ -151,6 +162,10 @@ if(LOCALHOST MATCHES "TheraS01|.*\.thera\.amd\.com|thera-hn")
list(POP_BACK CMAKE_MESSAGE_INDENT)
endif()
# git versioning file
configure_file(${PROJECT_SOURCE_DIR}/cmake/VERSION.sha.in
${PROJECT_SOURCE_DIR}/VERSION.sha @ONLY)
enable_testing()
add_test(
+1
View File
@@ -0,0 +1 @@
@OMNIPERF_GIT_REV@