diff --git a/CMakeLists.txt b/CMakeLists.txt index b4219e5..9a21658 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/plugin-macros.h.in b/src/plugin-macros.hpp.in similarity index 68% rename from src/plugin-macros.h.in rename to src/plugin-macros.hpp.in index bb93b61..8535c03 100644 --- a/src/plugin-macros.h.in +++ b/src/plugin-macros.hpp.in @@ -1,3 +1,4 @@ #pragma once #define PLUGIN_VERSION "@CMAKE_PROJECT_VERSION@" +#define GIT_HASH "@GIT_HASH@" \ No newline at end of file diff --git a/src/plugin.cpp b/src/plugin.cpp index e48dca1..0c037dc 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -1,6 +1,7 @@ #include + #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") @@ -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; }