OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[Protopipe] Add versioning for protopipe (#30592)
fcmironb0d5fe46954a
diff --git a/src/plugins/intel_npu/tools/protopipe/CMakeLists.txt b/src/plugins/intel_npu/tools/protopipe/CMakeLists.txtindex 6e9edde7c93..c77fa6ae689 100644--- a/src/plugins/intel_npu/tools/protopipe/CMakeLists.txt+++ b/src/plugins/intel_npu/tools/protopipe/CMakeLists.txt@@ -6,12 +6,34 @@set(TARGET_NAME protopipe)if (NOT DEFINED PROJECT_NAME)+ set(STANDALONE true)+endif()++# Enable CMP0048 policy+if(POLICY CMP0048)+ cmake_policy(SET CMP0048 NEW)+endif()++project(protopipe VERSION 1.0.0)++execute_process(+ COMMAND git rev-parse --short HEAD+ OUTPUT_VARIABLE GIT_SHA+ OUTPUT_STRIP_TRAILING_WHITESPACE+)++configure_file(+ ${CMAKE_CURRENT_SOURCE_DIR}/version.hpp.in+ ${CMAKE_CURRENT_BINARY_DIR}/version/version.hpp+ @ONLY+)++if (STANDALONE)if(WIN32)cmake_minimum_required(VERSION 3.16)else()cmake_minimum_required(VERSION 3.13)endif()- project(protopipe_standalone)include("cmake/standalone.cmake")return()endif()@@ -52,7 +74,7 @@ ov_add_target(ADD_CPPLINTNAME ${TARGET_NAME}ROOT ${CMAKE_CURRENT_SOURCE_DIR}ADDITIONAL_SOURCE_DIRS ${PROTOPIPE_SOURCE_DIR}- INCLUDES ${PROTOPIPE_SOURCE_DIR}+ INCLUDES ${PROTOPIPE_SOURCE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/version"LINK_LIBRARIES PRIVATE ${DEPENDENCIES})set_target_properties(${TARGET_NAME} PROPERTIESdiff --git a/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake b/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmakeindex 05db8f15322..320c0ae172c 100644--- a/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake+++ b/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake@@ -57,7 +57,9 @@ list(APPEND SOURCES main.cpp)add_executable(${TARGET_NAME} ${SOURCES})target_link_libraries(${TARGET_NAME} PRIVATE ${DEPENDENCIES})-target_include_directories(${TARGET_NAME} PUBLIC "${PROJECT_SOURCE_DIR}/src/")+target_include_directories(${TARGET_NAME} PUBLIC "${PROJECT_SOURCE_DIR}/src/"+ PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/version")+install(TARGETS ${TARGET_NAME}DESTINATION "tools/${TARGET_NAME}"diff --git a/src/plugins/intel_npu/tools/protopipe/main.cpp b/src/plugins/intel_npu/tools/protopipe/main.cppindex 23840a9852a..0b127f4ad9e 100644--- a/src/plugins/intel_npu/tools/protopipe/main.cpp+++ b/src/plugins/intel_npu/tools/protopipe/main.cpp@@ -17,6 +17,7 @@#include "utils/error.hpp"#include "utils/logger.hpp"+#include "version.hpp"static constexpr char help_message[] = "Optional. Print the usage message.";static constexpr char cfg_message[] = "Path to the configuration file.";@@ -34,6 +35,7 @@ static constexpr char inference_only_message[] =" Applicable only for \"performance\" mode. (default: true).";static constexpr char exec_filter_msg[] = "Optional. Run the scenarios that match provided string pattern.";+static constexpr char version_message[] = "Optional. Print the version";DEFINE_bool(h, false, help_message);DEFINE_string(cfg, "", cfg_message);@@ -45,6 +47,7 @@ DEFINE_uint64(niter, 0, niter_message);DEFINE_uint64(t, 0, exec_time_message);DEFINE_bool(inference_only, true, inference_only_message);DEFINE_string(exec_filter, ".*", exec_filter_msg);+DEFINE_bool(v, false, version_message);static void showUsage() {std::cout << "protopipe [OPTIONS]" << std::endl;@@ -60,6 +63,8 @@ static void showUsage() {std::cout << " -t <value> " << exec_time_message << std::endl;std::cout << " -inference_only " << inference_only_message << std::endl;std::cout << " -exec_filter " << exec_filter_msg << std::endl;+ std::cout << " -v " << version_message << std::endl;+std::cout << std::endl;}@@ -70,7 +75,10 @@ bool parseCommandLine(int* argc, char*** argv) {showUsage();return false;}-+ if (FLAGS_v) {+ std::cout << APP_VERSION << std::endl;+ return false;+ }if (FLAGS_cfg.empty()) {throw std::invalid_argument("Path to config file is required");}diff --git a/src/plugins/intel_npu/tools/protopipe/version.hpp.in b/src/plugins/intel_npu/tools/protopipe/version.hpp.innew file mode 100644index 00000000000..7870c90c703--- /dev/null+++ b/src/plugins/intel_npu/tools/protopipe/version.hpp.in@@ -0,0 +1,8 @@+#pragma once++#define VERSION_MAJOR "@PROJECT_VERSION_MAJOR@"+#define VERSION_MINOR "@PROJECT_VERSION_MINOR@"+#define VERSION_PATCH "@PROJECT_VERSION_PATCH@"+#define VERSION_SHA "@GIT_SHA@"++#define APP_VERSION "v@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@-@GIT_SHA@"