Skip to content

Commit

Permalink
vsmigraphx: add version info
Browse files Browse the repository at this point in the history
  • Loading branch information
WolframRhodium committed Feb 29, 2024
1 parent 4962ff6 commit 9f6b753
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions vsmigraphx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
1 change: 1 addition & 0 deletions vsmigraphx/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define VERSION "@VCS_TAG@"
4 changes: 4 additions & 0 deletions vsmigraphx/vs_migraphx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <migraphx/migraphx.h>
#include <migraphx/version.h>

#include "config.h"

using namespace std::string_literals;

#define checkError(expr) do { \
Expand Down Expand Up @@ -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) +
Expand Down

0 comments on commit 9f6b753

Please sign in to comment.