Skip to content

Commit b16ff9f

Browse files
committed
[Comgr] Add VERSION.txt file to track version
Instead of hardcoding the version into CMakeLists.txt, we can create a seprate VERSION.txt file to track the version, and have CMakeLists.txt pull from that file. The VERSION.txt file will also make it easier for other python/bash scripts to query the Comgr version Change-Id: I501485c51ef3b8769e1a6be4af15dbcf1db98a87
1 parent 2d007c7 commit b16ff9f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

amd/comgr/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
cmake_minimum_required(VERSION 3.13.4)
22

3-
project(amd_comgr VERSION "2.7.0" LANGUAGES C CXX)
3+
file(READ "VERSION.txt" comgr_ver_file)
4+
5+
string(REGEX MATCH "#COMGR_VERSION_MAJOR\n([0-9]*)" _ ${comgr_ver_file})
6+
set (ver_major ${CMAKE_MATCH_1})
7+
string(REGEX MATCH "#COMGR_VERSION_MINOR\n([0-9]*)" _ ${comgr_ver_file})
8+
set (ver_minor ${CMAKE_MATCH_1})
9+
10+
message("Comgr Version: ${ver_major}.${ver_minor}.0")
11+
12+
project(amd_comgr VERSION "${ver_major}.${ver_minor}.0" LANGUAGES C CXX)
413
set(amd_comgr_NAME "${PROJECT_NAME}")
514

615
# Get git branch and commit hash to add to log for easier debugging.

amd/comgr/VERSION.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#COMGR_VERSION_MAJOR
2+
2
3+
#COMGR_VERSION_MINOR
4+
7

0 commit comments

Comments
 (0)