Skip to content

Commit

Permalink
Log git hash with version
Browse files Browse the repository at this point in the history
  • Loading branch information
bozbez committed Feb 18, 2022
1 parent 203defd commit ac2da3f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ configure_file(
installer/installer.iss.in
../installer/installer.generated.iss
)

execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

configure_file(
src/plugin-macros.h.in
${CMAKE_SOURCE_DIR}/src/plugin-macros.generated.h
src/plugin-macros.hpp.in
${CMAKE_SOURCE_DIR}/src/plugin-macros.generated.hpp
)

find_package(LibObs REQUIRED)
Expand Down
1 change: 1 addition & 0 deletions src/plugin-macros.h.in → src/plugin-macros.hpp.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once

#define PLUGIN_VERSION "@CMAKE_PROJECT_VERSION@"
#define GIT_HASH "@GIT_HASH@"
5 changes: 3 additions & 2 deletions src/plugin.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <obs-module.h>

#include "common.hpp"
#include "plugin-macros.generated.h"
#include "plugin-macros.generated.hpp"

OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("win-capture-audio", "en-GB")
Expand All @@ -9,7 +10,7 @@ extern struct obs_source_info audio_capture_info;

bool obs_module_load(void)
{
blog(LOG_INFO, "[win-capture-audio] Version %s", PLUGIN_VERSION);
blog(LOG_INFO, "[win-capture-audio] Version %s (%s)", PLUGIN_VERSION, GIT_HASH);
obs_register_source(&audio_capture_info);
return true;
}
Expand Down

0 comments on commit ac2da3f

Please sign in to comment.