Skip to content

Commit

Permalink
Inference engine versioning (openvinotoolkit#5562)
Browse files Browse the repository at this point in the history
* Exclude xbyak from install

* Added automatically generated InferenceEngineConfig.cmake

* Reverted a version back

* Fixed issues with target aliases

* Make TBB dependency private

* Made ie_parallel.cmake self-sufficient

* Don't expose ie_paralle.cmake to end users

* Fixed compilation with TBB

* Fixes for TBB

* Fixed vpu_graph_transformer compilation

* Fixed tests compilation

* Added install of ie_parallel.cmake

* Switched ENABLE_ALTERNATIVE_TEMP to OFF. Fixed COMPONENTS for TBB

* Fixed file name in install rules

* Added find_dependency for TBB in ie_parallel.cmake

* WA for cmake bug with PACKAGE_PREFIX_DIR

* Fixed no-deprecation to fix speech-library build

* Reverted version from 2.1.0 to 2.1

* Revert "Reverted version from 2.1.0 to 2.1"

This reverts commit 7cb5d15.

* Added versions to cmake

* Added versions to ie_version.hpp

* Returned custom version file back

* Added InferenceEngineConfig-version.cmake to share as well

* Disabled one more GPU test

* Added one more WA for CI

* WA for CI issue for C API

* Added InferenceEngineConfig-version.cmake to share as well

* Added verison parsing from ie_version.hpp

* Revert "[CPU] Add Roll support (openvinotoolkit#5112)"

This reverts commit 5d8f209.

* Revert "[CPU] windows_Interpolate_fused-FQ_nearest-mode_nspc-layout_fix (openvinotoolkit#5317)"

This reverts commit 0808975.

* Revert "[INT8][BF16] INT8 + BF16 feature was enabled (openvinotoolkit#5059)"

This reverts commit 7d2ec02.

* Support for components

* No version for IEDevScripts package

* Removed IE_VS_VER_HAS_VERSION from vs_version.rc.in

* Added compatibility for 2.x old versioning
  • Loading branch information
ilya-lavrenov authored and yekruglov committed Jun 7, 2021
1 parent 2215e22 commit 410f49c
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 46 deletions.
8 changes: 7 additions & 1 deletion cmake/developer_package/IEDevScriptsConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ set(CMAKE_MODULE_PATH "${IEDevScripts_DIR}")
function(set_ci_build_number)
set(repo_root "${CMAKE_SOURCE_DIR}")
include(version)
set(CI_BUILD_NUMBER "${CI_BUILD_NUMBER}" PARENT_SCOPE)
foreach(var CI_BUILD_NUMBER IE_VERSION
IE_VERSION_MAJOR IE_VERSION_MINOR IE_VERSION_PATCH)
if(NOT DEFINED ${var})
message(FATAL_ERROR "${var} version component is not defined")
endif()
set(${var} "${${var}}" PARENT_SCOPE)
endforeach()
endfunction()

set_ci_build_number()
Expand Down
54 changes: 54 additions & 0 deletions cmake/developer_package/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,55 @@ function (commitHash VAR)
set (${VAR} ${GIT_COMMIT_HASH} PARENT_SCOPE)
endfunction()

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(has_ci_version ON)
else()
set(IE_VERSION_MAJOR 0)
set(IE_VERSION_MINOR 0)
set(IE_VERSION_PATCH 0)
endif()

if(NOT DEFINED repo_root)
message(FATAL_ERROR "repo_root is not defined")
endif()

if(DEFINED InferenceEngineDeveloperPackage_DIR)
set(ie_version_hpp "${IE_MAIN_SOURCE_DIR}/include/ie_version.hpp")
if(NOT EXISTS ${ie_version_hpp})
message(FATAL_ERROR "File ie_version.hpp with IE_VERSION definitions is not found")
endif()

file(STRINGS "${ie_version_hpp}" IE_VERSION_PARTS REGEX "#define IE_VERSION_[A-Z]+[ ]+" )

string(REGEX REPLACE ".+IE_VERSION_MAJOR[ ]+([0-9]+).*" "\\1"
IE_VERSION_MAJOR_HPP "${IE_VERSION_PARTS}")
string(REGEX REPLACE ".+IE_VERSION_MINOR[ ]+([0-9]+).*" "\\1"
IE_VERSION_MINOR_HPP "${IE_VERSION_PARTS}")
string(REGEX REPLACE ".+IE_VERSION_PATCH[ ]+([0-9]+).*" "\\1"
IE_VERSION_PATCH_HPP "${IE_VERSION_PARTS}")

foreach(var IE_VERSION_MAJOR IE_VERSION_MINOR IE_VERSION_PATCH)
if(DEFINED ${var} AND NOT ${var} EQUAL ${var}_HPP)
message(FATAL_ERROR "${var} parsed from CI_BUILD_NUMBER (${${var}}) \
and from ie_version.hpp (${${var}_HPP}) are different")
else()
# CI_BUILD_NUMBER is not defined well, take info from ie_verison.hpp as a baseline
set(${var} ${${var}_HPP})
endif()
endforeach()
elseif(has_ci_version)
message(WARNING "IE_MAIN_SOURCE_DIR is not defined. No way to compare versions")
else()
message(WARNING "No way to detect OpenVINO version. Supposing 0.0.0.0")
endif()

set(IE_VERSION "${IE_VERSION_MAJOR}.${IE_VERSION_MINOR}.${IE_VERSION_PATCH}")
endmacro()

if (DEFINED ENV{CI_BUILD_NUMBER})
set(CI_BUILD_NUMBER $ENV{CI_BUILD_NUMBER})
else()
Expand All @@ -36,6 +85,11 @@ else()
set(CI_BUILD_NUMBER "${custom_build}")
endif()

# provides Inference Engine version
# 1. If CI_BUILD_NUMBER is defined, parses this information
# 2. Otherwise, parses ie_version.hpp
ie_parse_ci_build_number()

function (addVersionDefines FILE)
foreach (VAR ${ARGN})
if (DEFINED ${VAR} AND NOT "${${VAR}}" STREQUAL "")
Expand Down
21 changes: 3 additions & 18 deletions cmake/developer_package/vs_version/vs_version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,9 @@
# 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_VERSION 1)
else()
set(IE_VS_VER_HAS_VERSION 0)
endif()
endmacro()

ie_parse_ci_build_number()

if(IE_VS_VER_HAS_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_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")

set(IE_VS_VER_COMPANY_NAME_STR "Intel Corporation")
set(IE_VS_VER_PRODUCTVERSION_STR "${CI_BUILD_NUMBER}")
Expand Down
4 changes: 0 additions & 4 deletions cmake/developer_package/vs_version/vs_version.rc.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include <winver.h>

VS_VERSION_INFO VERSIONINFO
#if @IE_VS_VER_HAS_VERSION@
FILEVERSION @IE_VS_VER_FILEVERSION_QUAD@
PRODUCTVERSION @IE_VS_VER_PRODUCTVERSION_QUAD@
#endif
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS 1
Expand All @@ -21,9 +19,7 @@ BEGIN
BEGIN
VALUE "CompanyName", "@IE_VS_VER_COMPANY_NAME_STR@\0"
VALUE "FileDescription", "@IE_VS_VER_FILEDESCRIPTION_STR@\0"
#if @IE_VS_VER_HAS_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"
Expand Down
2 changes: 1 addition & 1 deletion inference-engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ configure_file(
configure_file(
"${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig-version.cmake"
COPYONLY)
@ONLY)

#
# Coverage
Expand Down
4 changes: 2 additions & 2 deletions inference-engine/cmake/ie_parallel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function(set_ie_threading_interface_for TARGET_NAME)
# they don't have TBB in public headers => PRIVATE
set(LINK_TYPE "PRIVATE")
elseif(target_type STREQUAL "SHARED_LIBRARY")
# TODO: inference_engine only
# Why TBB propogates its headers to inference_engine?
# Affected libraries: inference_engine only
# TODO: why TBB propogates its headers to inference_engine?
set(LINK_TYPE "PRIVATE")
else()
ext_message(WARNING "Unknown target type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
# SPDX-License-Identifier: Apache-2.0
#

# TODO: hardcode will be fixed separatelly
set(PACKAGE_VERSION_MAJOR 2)
set(PACKAGE_VERSION_MINOR 1)
set(PACKAGE_VERSION_PATCH 0)
set(PACKAGE_VERSION_COUNT 3)

set(PACKAGE_VERSION_MAJOR @IE_VERSION_MAJOR@)
set(PACKAGE_VERSION_MINOR @IE_VERSION_MINOR@)
set(PACKAGE_VERSION_PATCH @IE_VERSION_PATCH@)
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")

set(PACKAGE_VERSION_EXACT False)
set(PACKAGE_VERSION_COMPATIBLE False)

# Compatibility with old versioning for 2.x
if(PACKAGE_FIND_VERSION_MAJOR VERSION_EQUAL 2)
set(PACKAGE_VERSION_COMPATIBLE True)
endif()

if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT True)
set(PACKAGE_VERSION_COMPATIBLE True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
# IE::inference_engine - The Inference Engine library
# IE::inference_engine_c_api - The Inference Engine C API library
#
# Inference Engine version variables:
#
# InferenceEngine_VERSION_MAJOR - major version component
# InferenceEngine_VERSION_MINOR - minor version component
# InferenceEngine_VERSION_PATCH - patch version component
#

@PACKAGE_INIT@

Expand Down
4 changes: 0 additions & 4 deletions inference-engine/ie_bridges/c/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ ie_add_vs_version_file(NAME ${TARGET_NAME}
export(TARGETS ${TARGET_NAME} NAMESPACE IE::
APPEND FILE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake")

# WA for CI issue
export(TARGETS ${TARGET_NAME} NAMESPACE IE::
APPEND FILE "${CMAKE_BINARY_DIR}/share/InferenceEngineTargets.cmake")

# install

ie_cpack_add_component(core_c DEPENDS core)
Expand Down
17 changes: 16 additions & 1 deletion inference-engine/include/ie_version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@
//

/**
* @brief A header file that provides versioning information for the inference engine shared library
* @brief A header file that provides versioning information for the Inference Engine library
*
* @file ie_version.hpp
*/
#pragma once

/**
* @def IE_VERSION_MAJOR
* @brief Defines Inference Engine major version
*
* @def IE_VERSION_MINOR
* @brief Defines Inference Engine minor version
*
* @def IE_VERSION_PATCH
* @brief Defines Inference Engine patch version
*/

#define IE_VERSION_MAJOR 2021
#define IE_VERSION_MINOR 4
#define IE_VERSION_PATCH 0

#include "ie_api.h"

/**
Expand Down
2 changes: 1 addition & 1 deletion inference-engine/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()

find_package(InferenceEngine 2.1.0 EXACT REQUIRED)
find_package(InferenceEngine REQUIRED)

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/utils")
add_subdirectory(common/utils)
Expand Down
9 changes: 1 addition & 8 deletions inference-engine/src/inference_engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,7 @@ configure_package_config_file("${InferenceEngine_SOURCE_DIR}/cmake/templates/Inf

configure_file("${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake"
COPYONLY)

# WA for CI
configure_file("${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in"
"${CMAKE_BINARY_DIR}/share/InferenceEngineConfig-version.cmake"
COPYONLY)
export(TARGETS ${TARGET_NAME} NAMESPACE IE::
APPEND FILE "${CMAKE_BINARY_DIR}/share/InferenceEngineTargets.cmake")
@ONLY)

install(FILES "${CMAKE_BINARY_DIR}/share/InferenceEngineConfig.cmake"
"${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake"
Expand Down
3 changes: 3 additions & 0 deletions ngraph/cmake/share/ngraphConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ if(NOT TARGET ngraph)
include("${CMAKE_CURRENT_LIST_DIR}/ngraphTargets.cmake")
endif()

set(ngraph_ngraph_FOUND ON)
set(NGRAPH_LIBRARIES ngraph::ngraph)

set(ngraph_onnx_importer_FOUND @NGRAPH_ONNX_IMPORT_ENABLE@)
if(ngraph_onnx_importer_FOUND)
set(ONNX_IMPORTER_LIBRARIES ngraph::onnx_importer)
endif()

check_required_components(ngraph)

0 comments on commit 410f49c

Please sign in to comment.