-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
43 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,37 @@ | ||
# get git commit hash | ||
execute_process( | ||
COMMAND git rev-parse HEAD | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} | ||
OUTPUT_VARIABLE TTMLIR_GIT_HASH | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
# get the latest tag from Git | ||
execute_process( | ||
COMMAND git describe --tags --abbrev=0 | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} | ||
OUTPUT_VARIABLE GIT_TAG | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
# get the number of commits since the latest tag | ||
execute_process( | ||
COMMAND git rev-list ${GIT_TAG}..HEAD --count | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} | ||
OUTPUT_VARIABLE GIT_COMMITS | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
|
||
# Extract the major and minor version from the tag (assumes tags are in "major.minor" format) | ||
string(REGEX MATCH "^v([0-9]+)\\.([0-9]+)$" GIT_TAG_MATCH ${GIT_TAG}) | ||
set(PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1}) | ||
set(PROJECT_VERSION_MINOR ${CMAKE_MATCH_2}) | ||
set(PROJECT_VERSION_PATCH ${GIT_COMMITS}) | ||
|
||
message(STATUS "Project commit hash: ${TTMLIR_GIT_HASH}") | ||
message(STATUS "Project version: ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") | ||
|
||
add_definitions("-DTTMLIR_GIT_HASH=${TTMLIR_GIT_HASH}") | ||
add_definitions("-DTTMLIR_VERSION_MAJOR=0") | ||
add_definitions("-DTTMLIR_VERSION_MINOR=0") | ||
add_definitions("-DTTMLIR_VERSION_RELEASE=0") | ||
add_definitions("-DTTMLIR_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}") | ||
add_definitions("-DTTMLIR_VERSION_MINOR=${PROJECT_VERSION_MINOR}") | ||
add_definitions("-DTTMLIR_VERSION_PATCH=${PROJECT_VERSION_PATCH}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ namespace tt.target; | |
struct Version { | ||
major: uint16; | ||
minor: uint16; | ||
release: uint32; | ||
patch: uint32; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters