Skip to content

Commit

Permalink
cmake/libobs: Set OBS_COMMIT based on git describe
Browse files Browse the repository at this point in the history
  • Loading branch information
derrod committed Nov 22, 2022
1 parent 10a68b5 commit cdc9313
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmake/Modules/VersionConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ if(NOT DEFINED OBS_VERSION_OVERRIDE)
string(REPLACE "." ";" _CANONICAL_SPLIT ${_CANONICAL_SPLIT})
list(GET _CANONICAL_SPLIT 0 1 2 _OBS_VERSION_CANONICAL)
string(REPLACE "." ";" _OBS_VERSION ${_OBS_VERSION})
# Get 8-character commit hash without "g" prefix
foreach(VERSION_PART ${_CANONICAL_SPLIT})
if(VERSION_PART MATCHES "^g")
string(SUBSTRING ${VERSION_PART}, 1, 8, OBS_COMMIT)
break()
endif()
endforeach()
endif()
endif()
endif()
Expand Down
1 change: 1 addition & 0 deletions libobs/obsconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define OBS_PLUGIN_DESTINATION "@OBS_PLUGIN_DESTINATION@"
#define OBS_QT_VERSION @_QT_VERSION@

#cmakedefine OBS_COMMIT "@OBS_COMMIT@"
#cmakedefine LINUX_PORTABLE
#cmakedefine GIO_FOUND
#cmakedefine PULSEAUDIO_FOUND
Expand Down

0 comments on commit cdc9313

Please sign in to comment.