Added support for Visual Studio VERSIONINFO (#2900)

* Generate vs_version file

* Fixed comments

* Fixed comments
This commit is contained in:
Ilya Lavrenov 2020-10-30 21:38:34 +03:00 committed by GitHub
parent 43265b50a7
commit 2104b6dde0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 195 additions and 6 deletions

View File

@ -245,3 +245,5 @@ function(set_ci_build_number)
set(CI_BUILD_NUMBER "${CI_BUILD_NUMBER}" PARENT_SCOPE)
endfunction()
set_ci_build_number()
include(vs_version/vs_version)

View File

@ -0,0 +1,87 @@
# Copyright (C) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
macro(ie_parse_ci_build_number)
if(CI_BUILD_NUMBER MATCHES "^([0-9]+)\.([0-9]+)\.([0-9]+)\-.*")
set(IE_VERSION_MAJOR ${CMAKE_MATCH_1})
set(IE_VERSION_MINOR ${CMAKE_MATCH_2})
set(IE_VERSION_PATCH ${CMAKE_MATCH_3})
set(IE_VS_VER_HAS_WELL_DEFINED_VERSION 1)
else()
set(IE_VS_VER_HAS_WELL_DEFINED_VERSION 0)
endif()
endmacro()
ie_parse_ci_build_number()
if(IE_VS_VER_HAS_WELL_DEFINED_VERSION)
set(IE_VS_VER_FILEVERSION_QUAD "${IE_VERSION_MAJOR},${IE_VERSION_MINOR},${IE_VERSION_PATCH},0")
set(IE_VS_VER_PRODUCTVERSION_QUAD "${IE_VERSION_MAJOR},${IE_VERSION_MINOR},${IE_VERSION_PATCH},0")
set(IE_VS_VER_FILEVERSION_STR "${IE_VERSION_MAJOR}.${IE_VERSION_MINOR}.${IE_VERSION_PATCH}.0")
endif()
set(IE_VS_VER_PRODUCTVERSION_STR "${CI_BUILD_NUMBER}")
set(IE_VS_VER_PRODUCTNAME_STR "OpenVINO toolkit")
set(IE_VS_VER_COPYRIGHT_STR "Copyright (C) 2018-2020, Intel Corporation")
set(IE_VS_VER_COMMENTS_STR "https://docs.openvinotoolkit.org/")
#
# ie_add_vs_version_file(NAME <name>
# FILEDESCRIPTION <file description>
# [FILEVERSION <file version>]
# [INTERNALNAME <internal name>]
# [COPYRIGHT <name>]
# [PRODUCTNAME <name>]
# [PRODUCTVERSION <name>]
# [COMMENTS <name>]
# [FILEVERSION_QUAD <name>]
# [PRODUCTVERSION_QUAD <name>])
#
function(ie_add_vs_version_file)
if(NOT WIN32)
return()
endif()
cmake_parse_arguments(VS_VER "" "NAME;FILEDESCRIPTION;FILEVERSION;INTERNALNAME;COPYRIGHT;PRODUCTNAME;PRODUCTVERSION;COMMENTS;FILEVERSION_QUAD;PRODUCTVERSION_QUAD" "" ${ARGN})
if(NOT TARGET ${VS_VER_NAME})
message(FATAL_ERROR "${VS_VER_NAME} must define a target")
endif()
macro(_vs_ver_update_variable name)
if(VS_VER_NAME AND DEFINED IE_${VS_VER_NAME}_VS_VER_${name})
set(IE_VS_VER_${name} "${IE_${VS_VER_NAME}_VS_VER_${name}}")
elseif(VS_VER_${name})
set(IE_VS_VER_${name} "${VS_VER_${name}}")
endif()
endmacro()
_vs_ver_update_variable(FILEVERSION_QUAD)
_vs_ver_update_variable(PRODUCTVERSION_QUAD)
macro(_vs_ver_update_str_variable name)
if(VS_VER_NAME AND DEFINED IE_${VS_VER_NAME}_VS_VER_${name})
set(IE_VS_VER_${name}_STR "${IE_${VS_VER_NAME}_VS_VER_${name}}")
elseif(VS_VER_${name})
set(IE_VS_VER_${name}_STR "${VS_VER_${name}}")
endif()
endmacro()
_vs_ver_update_str_variable(FILEDESCRIPTION)
_vs_ver_update_str_variable(FILEVERSION)
_vs_ver_update_str_variable(INTERNALNAME)
_vs_ver_update_str_variable(COPYRIGHT)
_vs_ver_update_str_variable(PRODUCTNAME)
_vs_ver_update_str_variable(PRODUCTVERSION)
_vs_ver_update_str_variable(COMMENTS)
set(IE_VS_VER_ORIGINALFILENAME_STR "${CMAKE_SHARED_LIBRARY_PREFIX}${VS_VER_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(IE_VS_VER_INTERNALNAME_STR ${VS_VER_NAME})
set(vs_version_output "${CMAKE_CURRENT_BINARY_DIR}/vs_version.rc")
configure_file("${OpenVINO_MAIN_SOURCE_DIR}/cmake/vs_version/vs_version.rc.in" "${vs_version_output}" @ONLY)
source_group("src" FILES ${vs_version_output})
target_sources(${VS_VER_NAME} PRIVATE ${vs_version_output})
endfunction()

View File

@ -0,0 +1,38 @@
#include <winver.h>
VS_VERSION_INFO VERSIONINFO
#if IE_VS_VER_HAS_WELL_DEFINED_VERSION
FILEVERSION @IE_VS_VER_FILEVERSION_QUAD@
PRODUCTVERSION @IE_VS_VER_PRODUCTVERSION_QUAD@
#endif
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS 1
#else
FILEFLAGS 0
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "FileDescription", "@IE_VS_VER_FILEDESCRIPTION_STR@\0"
#if IE_VS_VER_HAS_WELL_DEFINED_VERSION
VALUE "FileVersion", "@IE_VS_VER_FILEVERSION_STR@\0"
#endif
VALUE "InternalName", "@IE_VS_VER_INTERNALNAME_STR@\0"
VALUE "LegalCopyright", "@IE_VS_VER_COPYRIGHT_STR@\0"
VALUE "OriginalFilename", "@IE_VS_VER_ORIGINALFILENAME_STR@\0"
VALUE "ProductName", "@IE_VS_VER_PRODUCTNAME_STR@\0"
VALUE "ProductVersion", "@IE_VS_VER_PRODUCTVERSION_STR@\0"
VALUE "Comments", "@IE_VS_VER_COMMENTS_STR@\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1252
END
END

View File

@ -55,6 +55,9 @@ function(ie_add_plugin)
add_library(${IE_PLUGIN_NAME} SHARED ${input_files})
target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine ${IE_PLUGIN_DEVICE_NAME} device plugin library")
if(TARGET IE::inference_engine_plugin_api)
target_link_libraries(${IE_PLUGIN_NAME} PRIVATE IE::inference_engine_plugin_api)
else()

View File

@ -19,6 +19,9 @@ add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine C API Core Runtime library")
# export
export(TARGETS ${TARGET_NAME} NAMESPACE IE:: APPEND FILE "${CMAKE_BINARY_DIR}/targets.cmake")

View File

@ -30,6 +30,13 @@ foreach(PYX_FILE ${OTHER_SOURCES})
list(APPEND INSTALLED_TARGETS ${PYX_NAME})
endforeach()
if(COMMAND ie_add_vs_version_file)
foreach(target IN LISTS INSTALLED_TARGETS)
ie_add_vs_version_file(NAME ${target}
FILEDESCRIPTION "Inference Engine Python library")
endforeach()
endif()
function(python_disable_deprecated_warnings)
disable_deprecated_warnings()
set(pyx_file "${CMAKE_CURRENT_BINARY_DIR}/ie_api.cxx" "${CMAKE_CURRENT_BINARY_DIR}/constants.cxx")

View File

@ -125,8 +125,12 @@ add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}_obj)
add_library(${TARGET_NAME} SHARED
${IE_STATIC_DEPENDENT_FILES}
${vs_version_file}
$<TARGET_OBJECTS:${TARGET_NAME}_obj>)
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine Core Runtime library")
set_ie_threading_interface_for(${TARGET_NAME})
target_link_libraries(${TARGET_NAME} PRIVATE pugixml openvino::itt ${CMAKE_DL_LIBS} Threads::Threads

View File

@ -47,6 +47,9 @@ target_include_directories(${TARGET_NAME}_obj PRIVATE
add_library(${TARGET_NAME} SHARED $<TARGET_OBJECTS:${TARGET_NAME}_obj>)
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine Legacy library")
set_ie_threading_interface_for(${TARGET_NAME})
target_link_libraries(${TARGET_NAME} PUBLIC inference_engine

View File

@ -25,6 +25,9 @@ ie_faster_build(${TARGET_NAME}
UNITY
)
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine LP transformations library")
target_compile_definitions(${TARGET_NAME} PRIVATE inference_engine_transformations_EXPORTS)
target_link_libraries(${TARGET_NAME} PUBLIC inference_engine_transformations

View File

@ -26,6 +26,9 @@ ie_faster_build(${TARGET_NAME}
PCH PRIVATE "src/precomp.hpp"
)
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine LP legacy transformations library")
target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_API
PUBLIC USE_CNNNETWORK_LPT)

View File

@ -127,6 +127,9 @@ set_ie_threading_interface_for(${TARGET_NAME}_obj)
add_library(${TARGET_NAME} SHARED
$<TARGET_OBJECTS:${TARGET_NAME}_obj>)
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine Preprocessing plugin")
set_ie_threading_interface_for(${TARGET_NAME})
target_link_libraries(${TARGET_NAME} PRIVATE fluid openvino::itt

View File

@ -20,6 +20,9 @@ ie_faster_build(${TARGET_NAME}
UNITY
)
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine IR reader plugin")
target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN
IR_READER_V10)

View File

@ -22,6 +22,9 @@ ie_faster_build(${TARGET_NAME}
UNITY
)
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine IR v7 reader plugin")
target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/"

View File

@ -16,6 +16,9 @@ source_group("src" FILES ${LIBRARY_SRC})
add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC})
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine ONNX reader plugin")
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(${TARGET_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN)

View File

@ -24,6 +24,9 @@ ie_faster_build(${TARGET_NAME}
PCH PRIVATE "src/precomp.hpp"
)
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine Transformations library")
target_link_libraries(${TARGET_NAME} PUBLIC ${NGRAPH_LIBRARIES}
PRIVATE openvino::itt ngraph::builder pugixml)

View File

@ -47,6 +47,11 @@ if(COMMAND ie_add_api_validator_post_build_step)
ie_add_api_validator_post_build_step(TARGET ngraph)
endif()
if(COMMAND ie_add_vs_version_file)
ie_add_vs_version_file(NAME ngraph
FILEDESCRIPTION "nGraph library")
endif()
set_target_properties(ngraph PROPERTIES
CXX_VISIBILITY_PRESET hidden
C_VISIBILITY_PRESET hidden

View File

@ -41,6 +41,11 @@ source_group("include" FILES ${PUBLIC_HEADERS})
add_library(onnx_importer SHARED ${LIBRARY_SRC} ${PUBLIC_HEADERS})
add_library(ngraph::onnx_importer ALIAS onnx_importer)
if(COMMAND ie_add_vs_version_file)
ie_add_vs_version_file(NAME onnx_importer
FILEDESCRIPTION "nGraph ONNX importer library")
endif()
if(COMMAND ie_faster_build)
ie_faster_build(onnx_importer
UNITY

View File

@ -59,6 +59,11 @@ if(COMMAND ie_faster_build)
)
endif()
if(COMMAND ie_add_vs_version_file)
ie_add_vs_version_file(NAME ngraph_backend
FILEDESCRIPTION "nGraph backend library")
endif()
target_compile_definitions(ngraph_backend
PRIVATE
SHARED_LIB_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}"

View File

@ -14,8 +14,6 @@
# limitations under the License.
# ******************************************************************************
set(LIBRARY_TYPE SHARED)
set(SRC
ie_backend.cpp
ie_backend.hpp
@ -26,7 +24,7 @@ set(SRC
ie_executable.hpp
)
add_library(ie_backend ${LIBRARY_TYPE} ${SRC})
add_library(ie_backend SHARED ${SRC})
if(COMMAND ie_faster_build)
ie_faster_build(ie_backend
@ -34,6 +32,11 @@ if(COMMAND ie_faster_build)
)
endif()
if(COMMAND ie_add_vs_version_file)
ie_add_vs_version_file(NAME ie_backend
FILEDESCRIPTION "nGraph IE backend library")
endif()
add_dependencies(ie_backend inference_engine)
target_compile_definitions(ie_backend PRIVATE IE_BACKEND_DLL_EXPORTS)
target_include_directories(ie_backend PUBLIC ${IE_MAIN_SOURCE_DIR}/include)

View File

@ -14,10 +14,8 @@
# limitations under the License.
# ******************************************************************************
set(LIBRARY_TYPE SHARED)
if (NGRAPH_INTERPRETER_ENABLE)
add_library(interpreter_backend ${LIBRARY_TYPE} int_backend.cpp int_executable.cpp)
add_library(interpreter_backend SHARED int_backend.cpp int_executable.cpp)
if(COMMAND ie_faster_build)
ie_faster_build(interpreter_backend
@ -25,6 +23,11 @@ if (NGRAPH_INTERPRETER_ENABLE)
)
endif()
if(COMMAND ie_add_vs_version_file)
ie_add_vs_version_file(NAME interpreter_backend
FILEDESCRIPTION "nGraph interpreter backend library")
endif()
target_compile_definitions(interpreter_backend PRIVATE INTERPRETER_BACKEND_EXPORTS)
if(NGRAPH_LIB_VERSIONING_ENABLE)
set_target_properties(interpreter_backend PROPERTIES