diff --git a/CMakeLists.txt b/CMakeLists.txt index e5ee874a7ac8d9..328090276e3fb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID message (STATUS "CMAKE_BUILD_TYPE ...................... " ${CMAKE_BUILD_TYPE}) # remove file with exported developer targets to force its regeneration +file(REMOVE "${CMAKE_BINARY_DIR}/ngraph/ngraphTargets.cmake") file(REMOVE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake") file(REMOVE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") foreach(component IN LISTS openvino_export_components) diff --git a/cmake/templates/InferenceEngineConfig.cmake.in b/cmake/templates/InferenceEngineConfig.cmake.in index c5b95bd75efc68..0db3e2f3619e11 100644 --- a/cmake/templates/InferenceEngineConfig.cmake.in +++ b/cmake/templates/InferenceEngineConfig.cmake.in @@ -25,111 +25,29 @@ @PACKAGE_INIT@ -# -# Common functions -# - if(NOT DEFINED CMAKE_FIND_PACKAGE_NAME) set(CMAKE_FIND_PACKAGE_NAME InferenceEngine) - set(_need_package_name_reset ON) + set(_ie_need_package_name_reset ON) endif() -# we have to use our own version of find_dependency because of support cmake 3.7 -macro(_ie_find_dependency dep) - set(cmake_fd_quiet_arg) - if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - set(cmake_fd_quiet_arg QUIET) - endif() - set(cmake_fd_required_arg) - if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - set(cmake_fd_required_arg REQUIRED) - endif() - - get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY - _CMAKE_${dep}_TRANSITIVE_DEPENDENCY) - - find_package(${dep} ${ARGN} - ${cmake_fd_quiet_arg} - ${cmake_fd_required_arg}) +include(CMakeFindDependencyMacro) - if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive) - set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE) - endif() - - if(NOT ${dep}_FOUND) - set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.") - set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False) - return() - endif() - - set(cmake_fd_required_arg) - set(cmake_fd_quiet_arg) -endmacro() - -function(_ie_target_no_deprecation_error) - if(NOT MSVC) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(flags "-diag-warning=1786") - else() - set(flags "-Wno-error=deprecated-declarations") - endif() - if(CMAKE_CROSSCOMPILING) - set_target_properties(${ARGV} PROPERTIES - INTERFACE_LINK_OPTIONS "-Wl,--allow-shlib-undefined") - endif() +find_dependency(OpenVINO + PATHS "${CMAKE_CURRENT_LIST_DIR}" + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) - set_target_properties(${ARGV} PROPERTIES INTERFACE_COMPILE_OPTIONS ${flags}) - endif() -endfunction() - -# -# Inference Engine config -# - -# need to store current PACKAGE_PREFIX_DIR, because it's overwritten by ngraph one -set(IE_PACKAGE_PREFIX_DIR "${PACKAGE_PREFIX_DIR}") - -set(THREADING "@THREADING@") -if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" AND NOT TBB_FOUND) - set_and_check(_tbb_dir "@PACKAGE_IE_TBB_DIR@") - _ie_find_dependency(TBB - COMPONENTS tbb tbbmalloc - CONFIG - PATHS ${TBBROOT}/cmake - ${_tbb_dir} - 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() -set_and_check(_ngraph_dir "@PACKAGE_IE_NGRAPH_DIR@") -_ie_find_dependency(ngraph - CONFIG - PATHS ${_ngraph_dir} - NO_CMAKE_FIND_ROOT_PATH - NO_DEFAULT_PATH) - -if(NOT TARGET inference_engine) - set(_ie_as_external_package ON) - include("${CMAKE_CURRENT_LIST_DIR}/InferenceEngineTargets.cmake") - - # create targets with old names for compatibility - if(TARGET IE::runtime AND NOT TARGET IE::inference_engine) - add_library(IE::inference_engine INTERFACE IMPORTED) - set_target_properties(IE::inference_engine PROPERTIES - INTERFACE_LINK_LIBRARIES IE::runtime) - endif() - - if(TARGET IE::core AND NOT TARGET ngraph::ngraph) - add_library(IE::ngraph INTERFACE IMPORTED) - set_target_properties(IE::ngraph PROPERTIES - INTERFACE_LINK_LIBRARIES IE::core) - endif() - - if(TARGET IE::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 IE::runtime::c) - 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 @@ -167,7 +85,7 @@ set_and_check(InferenceEngine_INCLUDE_DIRS "@PACKAGE_IE_INCLUDE_DIR@") check_required_components(${CMAKE_FIND_PACKAGE_NAME}) -if(_need_package_name_reset) +if(_ie_need_package_name_reset) unset(CMAKE_FIND_PACKAGE_NAME) - unset(_need_package_name_reset) + unset(_ie_need_package_name_reset) endif() diff --git a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in index cdb02f8b8afa5f..f3fb7a9479cc6f 100644 --- a/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in +++ b/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in @@ -44,10 +44,18 @@ find_dependency(InferenceEngine NO_CMAKE_FIND_ROOT_PATH NO_DEFAULT_PATH) -find_dependency(OpenVINO - PATHS "${CMAKE_CURRENT_LIST_DIR}" - NO_CMAKE_FIND_ROOT_PATH - NO_DEFAULT_PATH) +# create targets with old names for compatibility +if(TARGET openvino::core AND NOT TARGET IE::core) + add_library(IE::core INTERFACE IMPORTED) + set_target_properties(IE::core PROPERTIES + INTERFACE_LINK_LIBRARIES openvino::core) +endif() + +if(TARGET openvino::runtime AND NOT TARGET IE::runtime) + add_library(IE::runtime INTERFACE IMPORTED) + set_target_properties(IE::runtime PROPERTIES + INTERFACE_LINK_LIBRARIES openvino::runtime) +endif() # WA for cmake: it exports ngraph as IE::ngraph in the IE export list # while we already have ngraph export in its own export list as ngraph::ngraph diff --git a/cmake/templates/ngraphConfig.cmake.in b/cmake/templates/ngraphConfig.cmake.in index 52a107da536391..a94e6b50a58933 100644 --- a/cmake/templates/ngraphConfig.cmake.in +++ b/cmake/templates/ngraphConfig.cmake.in @@ -37,41 +37,45 @@ @PACKAGE_INIT@ -if(NOT TARGET ngraph) - include("${CMAKE_CURRENT_LIST_DIR}/ngraphTargets.cmake") +include(CMakeFindDependencyMacro) - # create targets with old names for compatibility - if(TARGET ngraph::core AND NOT TARGET ngraph::ngraph) - add_library(ngraph::ngraph INTERFACE IMPORTED) - set_target_properties(ngraph::ngraph PROPERTIES - INTERFACE_LINK_LIBRARIES ngraph::core) - endif() +find_dependency(OpenVINO + PATHS "${CMAKE_CURRENT_LIST_DIR}" + "${CMAKE_CURRENT_LIST_DIR}/ngraph" + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) - if(TARGET ngraph::frontend::manager AND NOT TARGET ngraph::frontend_manager) - add_library(ngraph::frontend_manager INTERFACE IMPORTED) - set_target_properties(ngraph::frontend_manager PROPERTIES - INTERFACE_LINK_LIBRARIES ngraph::frontend::manager) - endif() +# create targets with old names for compatibility +if(TARGET openvino::core AND NOT TARGET ngraph::ngraph) + add_library(ngraph::ngraph INTERFACE IMPORTED) + set_target_properties(ngraph::ngraph PROPERTIES + INTERFACE_LINK_LIBRARIES openvino::core) +endif() - if(TARGET ngraph::frontend::onnx AND NOT TARGET ngraph::onnx_ngraph_frontend) - add_library(ngraph::onnx_ngraph_frontend INTERFACE IMPORTED) - set_target_properties(ngraph::onnx_ngraph_frontend PROPERTIES - INTERFACE_LINK_LIBRARIES ngraph::frontend::onnx) - endif() +if(TARGET openvino::frontend::manager AND NOT TARGET ngraph::frontend_manager) + add_library(ngraph::frontend_manager INTERFACE IMPORTED) + set_target_properties(ngraph::frontend_manager PROPERTIES + INTERFACE_LINK_LIBRARIES openvino::frontend::manager) +endif() - if(TARGET ngraph::frontend::paddlepaddle AND NOT TARGET ngraph::paddlepaddle_ngraph_frontend) - add_library(ngraph::paddlepaddle_ngraph_frontend INTERFACE IMPORTED) - set_target_properties(ngraph::paddlepaddle_ngraph_frontend PROPERTIES - INTERFACE_LINK_LIBRARIES ngraph::frontend::paddlepaddle) - endif() +if(TARGET openvino::frontend::onnx AND NOT TARGET ngraph::onnx_ngraph_frontend) + add_library(ngraph::onnx_ngraph_frontend INTERFACE IMPORTED) + set_target_properties(ngraph::onnx_ngraph_frontend PROPERTIES + INTERFACE_LINK_LIBRARIES openvino::frontend::onnx) +endif() + +if(TARGET openvino::frontend::paddlepaddle AND NOT TARGET ngraph::paddlepaddle_ngraph_frontend) + add_library(ngraph::paddlepaddle_ngraph_frontend INTERFACE IMPORTED) + set_target_properties(ngraph::paddlepaddle_ngraph_frontend PROPERTIES + INTERFACE_LINK_LIBRARIES openvino::frontend::paddlepaddle) endif() set(ngraph_ngraph_FOUND ON) set(NGRAPH_LIBRARIES ngraph::ngraph) -set(ngraph_onnx_ngraph_frontend_FOUND @NGRAPH_ONNX_FRONTEND_ENABLE@) +set(ngraph_onnx_ngraph_frontend_FOUND ${OpenVINO_Frontend_ONNX_FOUND}) +set(ngraph_onnx_importer_FOUND ${OpenVINO_Frontend_ONNX_FOUND}) -set(ngraph_onnx_importer_FOUND @NGRAPH_ONNX_FRONTEND_ENABLE@) if(ngraph_onnx_importer_FOUND) set(ONNX_IMPORTER_LIBRARIES ngraph::onnx_ngraph_frontend) # ngraph::onnx_importer target and variables are deprecated @@ -83,6 +87,6 @@ if(ngraph_onnx_importer_FOUND) endif() endif() -set(ngraph_paddlepaddle_frontend_FOUND @NGRAPH_PDPD_FRONTEND_ENABLE@) +set(ngraph_paddlepaddle_frontend_FOUND ${OpenVINO_Frontend_PaddlePaddle_FOUND}) check_required_components(ngraph) diff --git a/inference-engine/ie_bridges/c/src/CMakeLists.txt b/inference-engine/ie_bridges/c/src/CMakeLists.txt index 5cf46942f50d5f..d09b267731641a 100644 --- a/inference-engine/ie_bridges/c/src/CMakeLists.txt +++ b/inference-engine/ie_bridges/c/src/CMakeLists.txt @@ -26,9 +26,6 @@ ie_add_vs_version_file(NAME ${TARGET_NAME} # export -export(TARGETS ${TARGET_NAME} NAMESPACE IE:: - APPEND FILE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake") - set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime::c) export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake") @@ -38,12 +35,6 @@ export(TARGETS ${TARGET_NAME} NAMESPACE openvino:: ie_cpack_add_component(core_c DEPENDS core) ie_cpack_add_component(core_c_dev DEPENDS core_c) -install(TARGETS ${TARGET_NAME} EXPORT InferenceEngineTargets - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core_c - ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core_c - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core_c - INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include/ie) - install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core_c ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core_c diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index f0cb4a1348e377..e0521d4f24f558 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -281,12 +281,6 @@ ie_cpack_add_component(core_dev REQUIRED core ngraph_dev) install(DIRECTORY "${PUBLIC_HEADERS_DIR}" DESTINATION ${IE_CPACK_IE_DIR} COMPONENT core_dev) -install(TARGETS ${TARGET_NAME} EXPORT InferenceEngineTargets - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core - ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core - INCLUDES DESTINATION ${IE_CPACK_IE_DIR}/include/ie) - set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime) install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core @@ -311,12 +305,6 @@ endif() # Install cmake scripts -install(EXPORT InferenceEngineTargets - FILE InferenceEngineTargets.cmake - NAMESPACE IE:: - DESTINATION ${IE_CPACK_IE_DIR}/share - COMPONENT core_dev) - install(EXPORT OpenVINOTargets FILE OpenVINOTargets.cmake NAMESPACE openvino:: diff --git a/inference-engine/src/transformations/CMakeLists.txt b/inference-engine/src/transformations/CMakeLists.txt index 59af88ea36e439..21d27abf18eff8 100644 --- a/inference-engine/src/transformations/CMakeLists.txt +++ b/inference-engine/src/transformations/CMakeLists.txt @@ -49,19 +49,7 @@ openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${TARGET_NA # install -install(TARGETS ${TARGET_NAME} EXPORT InferenceEngineTargets - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core - ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) - install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) - -# because inference_engine_transformations is exported in multiple export list -# it needs to be exported in each list it's used -install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core - ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) \ No newline at end of file diff --git a/ngraph/core/CMakeLists.txt b/ngraph/core/CMakeLists.txt index 076958a3be4906..f0e683e5fd9f06 100644 --- a/ngraph/core/CMakeLists.txt +++ b/ngraph/core/CMakeLists.txt @@ -98,20 +98,6 @@ export(TARGETS ngraph NAMESPACE openvino:: # Installation logic... #----------------------------------------------------------------------------------------------- -install(TARGETS ngraph EXPORT ngraphTargets - RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - INCLUDES DESTINATION ${NGRAPH_INSTALL_INCLUDE}) - -# because ngraph is exported in multiple export list -# it needs to be exported in each list it's used -install(TARGETS ngraph EXPORT InferenceEngineTargets - RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - INCLUDES DESTINATION ${NGRAPH_INSTALL_INCLUDE}) - install(TARGETS ngraph EXPORT OpenVINOTargets RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph @@ -130,12 +116,6 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/ngraph/version.hpp DESTINATION ${NGRAPH_INSTALL_INCLUDE}/ngraph COMPONENT ngraph_dev) -install(EXPORT ngraphTargets - FILE ngraphTargets.cmake - NAMESPACE ngraph:: - DESTINATION "deployment_tools/ngraph/cmake" - COMPONENT ngraph_dev) - configure_package_config_file(${OpenVINO_SOURCE_DIR}/cmake/templates/ngraphConfig.cmake.in ${ngraph_BINARY_DIR}/ngraphConfig.cmake INSTALL_DESTINATION cmake) diff --git a/ngraph/frontend/frontend_manager/CMakeLists.txt b/ngraph/frontend/frontend_manager/CMakeLists.txt index df6cbe07a09a24..a8f7eaa601b0d5 100644 --- a/ngraph/frontend/frontend_manager/CMakeLists.txt +++ b/ngraph/frontend/frontend_manager/CMakeLists.txt @@ -50,11 +50,6 @@ endif() # Installation rules for shared version only -install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets - RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) - set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::manager) install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph diff --git a/ngraph/frontend/onnx/frontend/CMakeLists.txt b/ngraph/frontend/onnx/frontend/CMakeLists.txt index 20a773650d8956..5c411e936624ed 100644 --- a/ngraph/frontend/onnx/frontend/CMakeLists.txt +++ b/ngraph/frontend/onnx/frontend/CMakeLists.txt @@ -57,11 +57,6 @@ if(NGRAPH_USE_PROTOBUF_LITE) target_compile_definitions(${TARGET_NAME} PRIVATE NGRAPH_USE_PROTOBUF_LITE) endif() -install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets - RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) - set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::onnx) install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph diff --git a/ngraph/frontend/paddlepaddle/CMakeLists.txt b/ngraph/frontend/paddlepaddle/CMakeLists.txt index e0d43583988ecc..70713e21a749dc 100644 --- a/ngraph/frontend/paddlepaddle/CMakeLists.txt +++ b/ngraph/frontend/paddlepaddle/CMakeLists.txt @@ -82,11 +82,6 @@ target_link_libraries(${TARGET_NAME} PRIVATE frontend_manager::static add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME} EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS}) -install(TARGETS ${TARGET_NAME} EXPORT ngraphTargets - RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph - LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph) - set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::paddlepaddle) install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph