Revert IE cmake config back (#21842)

This commit is contained in:
Ilya Lavrenov 2023-12-22 15:43:24 +04:00 committed by GitHub
parent a88679aeb8
commit a0d3610518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 247 additions and 2 deletions

View File

@ -0,0 +1,29 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
set(PACKAGE_VERSION_MAJOR @OpenVINO_VERSION_MAJOR@)
set(PACKAGE_VERSION_MINOR @OpenVINO_VERSION_MINOR@)
set(PACKAGE_VERSION_PATCH @OpenVINO_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)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
message(WARNING "Inference Engine versioning has changed. Use ${PACKAGE_VERSION} instead of ${PACKAGE_FIND_VERSION}")
endif()
endif()
if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT True)
set(PACKAGE_VERSION_COMPATIBLE True)
endif()
if(PACKAGE_FIND_VERSION_MAJOR EQUAL PACKAGE_VERSION_MAJOR AND
PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION)
set(PACKAGE_VERSION_COMPATIBLE True)
endif()

View File

@ -0,0 +1,87 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
#
# Inference Engine cmake config
# ------
#
# This config defines the following variables:
#
# InferenceEngine_FOUND - True if the system has the Inference Engine library
# InferenceEngine_INCLUDE_DIRS - Inference Engine include directories
# InferenceEngine_LIBRARIES - Inference Engine libraries
#
# and the following imported targets:
#
# 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@
message(WARNING "find_package(InferenceEngine) is deprecated and will be removed in 2024.0 release. Please, use find_package(OpenVINO)")
if(NOT DEFINED CMAKE_FIND_PACKAGE_NAME)
set(CMAKE_FIND_PACKAGE_NAME InferenceEngine)
set(_ie_need_package_name_reset ON)
endif()
# need to store current PACKAGE_PREFIX_DIR, because it's overwritten by sub-package one
set(_ie_package_prefix_dir "${PACKAGE_PREFIX_DIR}")
include(CMakeFindDependencyMacro)
find_dependency(OpenVINO
PATHS "${CMAKE_CURRENT_LIST_DIR}"
"${CMAKE_CURRENT_LIST_DIR}/../openvino${InferenceEngine_VERSION}"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
# create targets with old names for compatibility
if(TARGET openvino::runtime AND NOT TARGET IE::inference_engine)
add_library(IE::inference_engine INTERFACE IMPORTED)
set_target_properties(IE::inference_engine PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::runtime)
endif()
if(TARGET openvino::runtime::c AND NOT TARGET IE::inference_engine_c_api)
add_library(IE::inference_engine_c_api INTERFACE IMPORTED)
set_target_properties(IE::inference_engine_c_api PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::runtime::c)
endif()
# mark components as available
foreach(comp inference_engine inference_engine_c_api)
set(${CMAKE_FIND_PACKAGE_NAME}_${comp}_FOUND ON)
endforeach()
if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS inference_engine inference_engine_c_api)
endif()
unset(InferenceEngine_LIBRARIES)
foreach(comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
# check if the component is available
if(${CMAKE_FIND_PACKAGE_NAME}_${comp}_FOUND)
set(pcomp IE::${comp})
list(APPEND InferenceEngine_LIBRARIES ${pcomp})
endif()
endforeach()
# restore PACKAGE_PREFIX_DIR
set(PACKAGE_PREFIX_DIR ${_ie_package_prefix_dir})
unset(_ie_package_prefix_dir)
check_required_components(${CMAKE_FIND_PACKAGE_NAME})
if(_ie_need_package_name_reset)
unset(CMAKE_FIND_PACKAGE_NAME)
unset(_ie_need_package_name_reset)
endif()

View File

@ -0,0 +1,102 @@
# ******************************************************************************
# Copyright 2017-2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ******************************************************************************
#
#
# ngraph config file
# ------
#
# This script defines the following variables and imported targets:
#
# ngraph::ngraph - nGraph core target
# ngraph_FOUND - True if the system has the nGraph library
# NGRAPH_LIBRARIES - nGraph libraries
#
# Frontends:
#
# ngraph_onnx_frontend_FOUND - True if the system has ngraph::onnx_frontend library
# ngraph::onnx_frontend - ONNX FrontEnd target (optional)
#
# ngraph_paddle_frontend_FOUND - True if the system has Paddle frontend
# ngraph::paddle_frontend - nGraph Paddle frontend (optional)
#
# ngraph_ir_frontend_FOUND - True if the system has OpenVINO IR frontend
#
# ngraph_tensorflow_frontend_FOUND - True if the system has TensorFlow frontend
# ngraph::tensorflow_frontend - nGraph TensorFlow frontend (optional)
#
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
message(WARNING "find_package(ngraph) is deprecated and will be removed in 2024.0 release. Please, use find_package(OpenVINO)")
find_dependency(OpenVINO
PATHS "${CMAKE_CURRENT_LIST_DIR}"
"${CMAKE_CURRENT_LIST_DIR}/../openvino${ngraph_VERSION}"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
# create targets with old names for compatibility
if(TARGET openvino::runtime AND NOT TARGET ngraph::ngraph)
add_library(ngraph::ngraph INTERFACE IMPORTED)
set_target_properties(ngraph::ngraph PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::runtime)
endif()
if(TARGET openvino::frontend::onnx AND NOT TARGET ngraph::onnx_frontend)
add_library(ngraph::onnx_frontend INTERFACE IMPORTED)
set_target_properties(ngraph::onnx_frontend PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::frontend::onnx)
endif()
if(TARGET openvino::frontend::paddle AND NOT TARGET ngraph::paddle_frontend)
add_library(ngraph::paddle_frontend INTERFACE IMPORTED)
set_target_properties(ngraph::paddle_frontend PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::frontend::paddle)
endif()
if(TARGET openvino::frontend::tensorflow AND NOT TARGET ngraph::tensorflow_frontend)
add_library(ngraph::tensorflow_frontend INTERFACE IMPORTED)
set_target_properties(ngraph::tensorflow_frontend PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::frontend::tensorflow)
endif()
set(ngraph_ngraph_FOUND ON)
set(NGRAPH_LIBRARIES ngraph::ngraph)
set(ngraph_onnx_frontend_FOUND ${OpenVINO_Frontend_ONNX_FOUND})
set(ngraph_tensorflow_frontend_FOUND ${OpenVINO_Frontend_TensorFlow_FOUND})
set(ngraph_paddle_frontend_FOUND ${OpenVINO_Frontend_Paddle_FOUND})
set(ngraph_onnx_importer_FOUND ${OpenVINO_Frontend_ONNX_FOUND})
if(ngraph_onnx_importer_FOUND)
set(ONNX_IMPORTER_LIBRARIES ngraph::onnx_frontend)
# ngraph::onnx_importer target and variables are deprecated
# but need to create a dummy target for BW compatibility
if(NOT TARGET ngraph::onnx_importer)
add_library(ngraph::onnx_importer INTERFACE IMPORTED)
set_target_properties(ngraph::onnx_importer PROPERTIES
INTERFACE_LINK_LIBRARIES ngraph::onnx_frontend)
endif()
endif()
set(ngraph_paddle_frontend_FOUND ${OpenVINO_Frontend_Paddle_FOUND})
set(ngraph_tensorflow_frontend_FOUND ${OpenVINO_Frontend_TensorFlow_FOUND})
set(ngraph_onnx_frontend_FOUND ${OpenVINO_Frontend_ONNX_FOUND})
set(ngraph_ir_frontend_FOUND ${OpenVINO_Frontend_IR_FOUND})
check_required_components(ngraph)

View File

@ -94,7 +94,8 @@ install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets
ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${OV_CPACK_COMP_CORE} ${OV_CPACK_COMP_CORE_EXCLUDE_ALL}
LIBRARY DESTINATION ${OV_CPACK_LIBRARYDIR} COMPONENT ${OV_CPACK_COMP_CORE} ${OV_CPACK_COMP_CORE_EXCLUDE_ALL}
NAMELINK_COMPONENT ${OV_CPACK_COMP_CORE_DEV}
INCLUDES DESTINATION ${OV_CPACK_INCLUDEDIR})
INCLUDES DESTINATION ${OV_CPACK_INCLUDEDIR}
${OV_CPACK_INCLUDEDIR}/ie)
# OpenVINO runtime library dev
@ -174,7 +175,6 @@ if(ENABLE_ONEDNN_FOR_GPU)
list(APPEND BUILD_PATH_VARS "ONEDNN_GPU_LIB_PATH")
endif()
set(PUBLIC_HEADERS_DIR "${OpenVINO_SOURCE_DIR}/src/inference/include")
set(OV_TBB_DIR "${TBB_DIR}")
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig.cmake.in"
@ -196,14 +196,27 @@ if(WIN32)
set(GNA_PATH "${OV_CPACK_LIBRARYDIR}/../Release")
endif()
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig.cmake.in"
"${CMAKE_BINARY_DIR}/share/InferenceEngineConfig.cmake"
INSTALL_DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR}
PATH_VARS ${PATH_VARS} ${INSTALL_PATH_VARS})
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig.cmake.in"
"${CMAKE_BINARY_DIR}/share/OpenVINOConfig.cmake"
INSTALL_DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR}
PATH_VARS ${PATH_VARS} ${INSTALL_PATH_VARS})
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake" @ONLY)
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig-version.cmake.in"
"${CMAKE_BINARY_DIR}/OpenVINOConfig-version.cmake" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/share/InferenceEngineConfig.cmake"
"${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake"
DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR}
COMPONENT ${OV_CPACK_COMP_CORE_DEV}
${OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL})
install(FILES "${CMAKE_BINARY_DIR}/share/OpenVINOConfig.cmake"
"${CMAKE_BINARY_DIR}/OpenVINOConfig-version.cmake"
DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR}

View File

@ -158,3 +158,17 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
FILES_MATCHING
PATTERN "*.hpp"
PATTERN "*.h")
configure_package_config_file(${OpenVINO_SOURCE_DIR}/cmake/templates/ngraphConfig.cmake.in
${CMAKE_BINARY_DIR}/ngraphConfig.cmake
INSTALL_DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR})
write_basic_package_version_file(${CMAKE_BINARY_DIR}/ngraphConfigVersion.cmake
VERSION ${OpenVINO_VERSION_MAJOR}.${OpenVINO_VERSION_MINOR}.${OpenVINO_VERSION_PATCH}
COMPATIBILITY SameMajorVersion)
install(FILES ${CMAKE_BINARY_DIR}/ngraphConfig.cmake
${CMAKE_BINARY_DIR}/ngraphConfigVersion.cmake
DESTINATION ${OV_CPACK_OPENVINO_CMAKEDIR}
COMPONENT ${OV_CPACK_COMP_CORE_DEV}
${OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL})