Skip to content

Commit

Permalink
fix: fw version is git tag only; don't include dirty
Browse files Browse the repository at this point in the history
  • Loading branch information
JPHutchins committed Dec 5, 2023
1 parent 9bfbc5a commit 58e067d
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/ic_project.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function(ic_project
else()
set(has_git_tag 1)
execute_process(
COMMAND git describe --tags --dirty=+ --always --abbrev=7
COMMAND git describe --tags --always --abbrev=7
OUTPUT_VARIABLE git_tag
OUTPUT_STRIP_TRAILING_WHITESPACE
)
Expand All @@ -125,14 +125,6 @@ function(ic_project
)
set_definition("${out_git_hash}" ${git_hash} PARENT_SCOPE)

if(NOT DEFINED ${out_fw_version})
if(${has_git_tag})
set_definition("${out_fw_version}" ${git_tag} PARENT_SCOPE)
else()
set_definition("${out_fw_version}" ${git_hash} PARENT_SCOPE)
endif()
endif()

# Set git dirty commit
string(FIND ${git_hash} + res)
if(res EQUAL -1)
Expand Down Expand Up @@ -160,6 +152,18 @@ function(ic_project
set_definition("${out_git_tag_rev}" "" PARENT_SCOPE)
endif()

if(NOT DEFINED ${out_fw_version})
if(${has_git_tag})
if(NOT "${git_tag_rev}" STREQUAL "")
set_definition("${out_fw_version}" "${git_label}-${git_tag_rev}" PARENT_SCOPE)
else()
set_definition("${out_fw_version}" "${git_label}" PARENT_SCOPE)
endif()
else()
set_definition("${out_fw_version}" ${git_hash} PARENT_SCOPE)
endif()
endif()

string(TIMESTAMP build_date "%Y%m%d")
set_definition("${out_build_date}" ${build_date} PARENT_SCOPE)
string(TIMESTAMP timestamp)
Expand Down

0 comments on commit 58e067d

Please sign in to comment.