Add OV developer config (#9298)

* Introduced OV developer package config

* Remove new targets from old configs

* Fixed python build

* Removed OpenVINO_SOURCE_DIR from developer config
This commit is contained in:
Ilya Churaev 2021-12-21 12:25:07 +03:00 committed by GitHub
parent 3032f20e03
commit ec858fcffd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 110 additions and 29 deletions

View File

@ -26,6 +26,33 @@ function(ie_generate_dev_package_config)
@ONLY)
endfunction()
function(ov_generate_dev_package_config)
# dummy check that OpenCV is here
find_package(OpenCV QUIET)
set(all_dev_targets gflags ov_runtime_libraries)
foreach(component IN LISTS openvino_export_components)
string(FIND "${component}" "_legacy" index)
if (index EQUAL -1)
# export all targets with prefix and use them during extra modules build
export(TARGETS ${${component}} NAMESPACE openvino::
APPEND FILE "${CMAKE_BINARY_DIR}/ov_${component}_dev_targets.cmake")
list(APPEND all_dev_targets ${${component}})
endif()
endforeach()
add_custom_target(ov_dev_targets DEPENDS ${all_dev_targets})
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in"
"${CMAKE_BINARY_DIR}/OpenVINODeveloperPackageConfig.cmake"
INSTALL_DESTINATION share # not used
PATH_VARS "OpenVINO_SOURCE_DIR;gflags_BINARY_DIR"
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig-version.cmake.in"
"${CMAKE_BINARY_DIR}/OpenVINODeveloperPackageConfig-version.cmake"
@ONLY)
endfunction()
#
# Add extra modules
#
@ -97,6 +124,7 @@ endfunction()
# during extra modules build since it's generated after modules
# are configured
ie_generate_dev_package_config()
ov_generate_dev_package_config()
# extra modules must be registered after inference_engine library
# and all other IE common libraries (ov_runtime_libraries) are creared

View File

@ -49,13 +49,6 @@ find_dependency(ngraph
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
# create targets with old names for compatibility
if(TARGET openvino::runtime AND NOT TARGET IE::core)
add_library(IE::core INTERFACE IMPORTED)
set_target_properties(IE::core PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::runtime)
endif()
if(TARGET openvino::runtime AND NOT TARGET IE::runtime)
add_library(IE::runtime INTERFACE IMPORTED)
set_target_properties(IE::runtime PROPERTIES

View File

@ -0,0 +1,76 @@
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
# Variables to export in plugin's projects
set(ie_options "@IE_OPTIONS@;CMAKE_BUILD_TYPE;CMAKE_SKIP_RPATH")
list(APPEND ie_options CMAKE_CXX_COMPILER_LAUNCHER CMAKE_C_COMPILER_LAUNCHER)
file(TO_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}" cache_path)
message(STATUS "The following CMake options are exported from Inference Engine Developer package")
message("")
foreach(option IN LISTS ie_options)
if(NOT DEFINED "${option}")
load_cache("${cache_path}" READ_WITH_PREFIX "" ${option})
endif()
message(" ${option}: ${${option}}")
endforeach()
message("")
# for samples in 3rd party projects
set_and_check(gflags_DIR "@gflags_BINARY_DIR@")
#
# Content
#
find_dependency(IEDevScripts
PATHS "@OpenVINO_SOURCE_DIR@/cmake/developer_package"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
find_dependency(OpenVINO
PATHS "${CMAKE_CURRENT_LIST_DIR}"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
foreach(component @openvino_export_components@)
string(FIND "${component}" "_legacy" index)
if (index EQUAL -1)
include("${CMAKE_CURRENT_LIST_DIR}/ov_${component}_dev_targets.cmake")
endif()
endforeach()
if(ENABLE_SYSTEM_PUGIXML)
find_dependency(PugiXML)
set_property(TARGET pugixml PROPERTY IMPORTED_GLOBAL TRUE)
add_library(IE::pugixml ALIAS pugixml)
endif()
# inherit OpenCV from main IE project if enabled
if ("@OpenCV_FOUND@")
load_cache("${cache_path}" READ_WITH_PREFIX "" OpenCV_DIR)
find_dependency(OpenCV)
endif()
#
# Extra Compile Flags
#
if(NOT MSVC)
ie_add_compiler_flags(-Wno-error=unused-variable)
if(CMAKE_COMPILER_IS_GNUCXX)
ie_add_compiler_flags(-Wno-error=unused-but-set-variable)
if(SUGGEST_OVERRIDE_SUPPORTED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override")
endif()
endif()
endif()
# Don't threat deprecated API warnings as errors in 3rd party apps
ie_deprecated_no_errors()

View File

@ -26,8 +26,6 @@
#
# Frontends:
#
# ngraph::common - nGraph frontend common
#
# ngraph_ov_onnx_frontend_FOUND - True if the system has ov_onnx_frontend library
# ngraph::ov_onnx_frontend - ONNX FrontEnd target (optional)
#
@ -52,19 +50,6 @@ if(TARGET openvino::runtime AND NOT TARGET ngraph::ngraph)
INTERFACE_LINK_LIBRARIES openvino::runtime)
endif()
if(TARGET openvino::runtime AND NOT TARGET openvino::frontend::common)
add_library(openvino::frontend::common INTERFACE IMPORTED)
set_target_properties(openvino::frontend::common PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::runtime)
endif()
if(TARGET openvino::runtime AND NOT TARGET ngraph::frontend_common)
add_library(ngraph::frontend_common INTERFACE IMPORTED)
set_target_properties(ngraph::frontend_common PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::runtime)
endif()
if(TARGET openvino::frontend::onnx AND NOT TARGET ngraph::ov_onnx_frontend)
add_library(ngraph::ov_onnx_frontend INTERFACE IMPORTED)
set_target_properties(ngraph::ov_onnx_frontend PROPERTIES

View File

@ -54,7 +54,7 @@ pybind11_add_module(_${PROJECT_NAME} MODULE ${SOURCES})
target_include_directories(_${PROJECT_NAME} PRIVATE "../")
target_link_libraries(_${PROJECT_NAME} PRIVATE openvino::core)
target_link_libraries(_${PROJECT_NAME} PRIVATE openvino::runtime)
# perform copy
if(OpenVINO_SOURCE_DIR)

View File

@ -61,7 +61,7 @@ else()
endif()
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(${PROJECT_NAME} PRIVATE openvino::runtime ${OFFLINE_TRANSFORMATIONS_LIB} openvino::frontend::common)
target_link_libraries(${PROJECT_NAME} PRIVATE openvino::runtime ${OFFLINE_TRANSFORMATIONS_LIB})
# perform copy
if(OpenVINO_SOURCE_DIR)

View File

@ -51,7 +51,7 @@ target_include_directories(${TARGET_NAME} INTERFACE
# developer package
openvino_developer_export_targets(COMPONENT core TARGETS ${TARGET_NAME})
openvino_developer_export_targets(COMPONENT core_legacy TARGETS ${TARGET_NAME})
# install

View File

@ -52,7 +52,7 @@ target_link_libraries(${TARGET_NAME} INTERFACE openvino::runtime)
# developer package
openvino_developer_export_targets(COMPONENT core TARGETS ${TARGET_NAME})
openvino_developer_export_targets(COMPONENT core_legacy TARGETS ${TARGET_NAME})
# install

View File

@ -117,7 +117,6 @@ target_include_directories(ngraph INTERFACE $<BUILD_INTERFACE:${OV_CORE_INCLUDE_
# Export for build tree
#-----------------------------------------------------------------------------------------------
set_target_properties(ngraph PROPERTIES EXPORT_NAME core)
export(TARGETS ngraph NAMESPACE openvino::
APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")

View File

@ -66,7 +66,7 @@ add_library(ngraph::${TARGET_NAME} ALIAS ${TARGET_NAME})
add_library(openvino::frontend::common ALIAS ${TARGET_NAME})
add_library(${TARGET_NAME}::static ALIAS ${TARGET_NAME})
openvino_developer_export_targets(COMPONENT core TARGETS ${TARGET_NAME})
openvino_developer_export_targets(COMPONENT core_legacy TARGETS ${TARGET_NAME})
# Installation rules for shared version only

View File

@ -212,7 +212,7 @@ export(TARGETS ${TARGET_NAME} NAMESPACE openvino::
# Export for developer package
openvino_developer_export_targets(COMPONENT core TARGETS ${TARGET_NAME}_plugin_api)
openvino_developer_export_targets(COMPONENT core_legacy TARGETS ${TARGET_NAME}_plugin_api)
install(DIRECTORY "${PUBLIC_HEADERS_DIR}/" DESTINATION runtime/include
COMPONENT core_dev)