From 9f6b753a5d9bbdcfb6b0d6fc4cfd0706d7e9a714 Mon Sep 17 00:00:00 2001 From: WolframRhodium Date: Fri, 1 Mar 2024 07:28:06 +0800 Subject: [PATCH] vsmigraphx: add version info --- vsmigraphx/CMakeLists.txt | 10 ++++++++++ vsmigraphx/config.h.in | 1 + vsmigraphx/vs_migraphx.cpp | 4 ++++ 3 files changed, 15 insertions(+) create mode 100644 vsmigraphx/config.h.in diff --git a/vsmigraphx/CMakeLists.txt b/vsmigraphx/CMakeLists.txt index 3b09208..5e43fe2 100644 --- a/vsmigraphx/CMakeLists.txt +++ b/vsmigraphx/CMakeLists.txt @@ -24,6 +24,16 @@ set_target_properties(vsmigraphx PROPERTIES CXX_STANDARD_REQUIRED ON ) +find_package(Git REQUIRED) +execute_process( + COMMAND ${GIT_EXECUTABLE} describe --tags --long --always + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE VCS_TAG +) +string(STRIP ${VCS_TAG} VCS_TAG) +configure_file(config.h.in config.h) +target_include_directories(vsmigraphx PUBLIC "${PROJECT_BINARY_DIR}") + install(TARGETS vsmigraphx LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/vsmigraphx/config.h.in b/vsmigraphx/config.h.in new file mode 100644 index 0000000..9ed7797 --- /dev/null +++ b/vsmigraphx/config.h.in @@ -0,0 +1 @@ +#define VERSION "@VCS_TAG@" \ No newline at end of file diff --git a/vsmigraphx/vs_migraphx.cpp b/vsmigraphx/vs_migraphx.cpp index 91703ae..b7b477f 100644 --- a/vsmigraphx/vs_migraphx.cpp +++ b/vsmigraphx/vs_migraphx.cpp @@ -20,6 +20,8 @@ #include #include +#include "config.h" + using namespace std::string_literals; #define checkError(expr) do { \ @@ -906,6 +908,8 @@ VS_EXTERNAL_API(void) VapourSynthPluginInit( ); auto getVersion = [](const VSMap *, VSMap * out, void *, VSCore *, const VSAPI *vsapi) { + vsapi->propSetData(out, "version", VERSION, -1, paReplace); + vsapi->propSetData( out, "migraphx_version_build", (std::to_string(MIGRAPHX_VERSION_MAJOR) +