diff --git a/projects/rocprofiler-compute/.gitignore b/projects/rocprofiler-compute/.gitignore index 95f8be7bd8..aecccd7a1a 100644 --- a/projects/rocprofiler-compute/.gitignore +++ b/projects/rocprofiler-compute/.gitignore @@ -14,6 +14,7 @@ __pycache__ .coverage saved_analysis pmc_kernel_top.csv +VERSION.sha # temp files /tests/Testing \ No newline at end of file diff --git a/projects/rocprofiler-compute/CMakeLists.txt b/projects/rocprofiler-compute/CMakeLists.txt index 3ddf8b5341..5bf9a55811 100644 --- a/projects/rocprofiler-compute/CMakeLists.txt +++ b/projects/rocprofiler-compute/CMakeLists.txt @@ -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( diff --git a/projects/rocprofiler-compute/cmake/VERSION.sha.in b/projects/rocprofiler-compute/cmake/VERSION.sha.in new file mode 100644 index 0000000000..5b3d301508 --- /dev/null +++ b/projects/rocprofiler-compute/cmake/VERSION.sha.in @@ -0,0 +1 @@ +@OMNIPERF_GIT_REV@