Openvino autogenerated cmake (#5484)
* 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 7cb5d1563c.
* 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
* WIP
This commit is contained in:
@@ -18,7 +18,6 @@ else()
|
||||
set(MODELS_BRANCH "master")
|
||||
endif()
|
||||
|
||||
|
||||
if (ENABLE_DATA)
|
||||
add_models_repo(${ENABLE_DATA} "data:https://github.com/openvinotoolkit/testdata.git")
|
||||
set(MODELS_PATH "${TEMP}/models/src/data")
|
||||
@@ -294,8 +293,6 @@ else()
|
||||
reset_deps_cache(OpenCV_DIR)
|
||||
endif()
|
||||
|
||||
# TODO: remove global CMAKE_MODULE_PATH
|
||||
list(APPEND CMAKE_MODULE_PATH "${IEDevScripts_DIR}")
|
||||
include(cmake/ie_parallel.cmake)
|
||||
|
||||
if (ENABLE_GNA)
|
||||
|
||||
@@ -3,8 +3,28 @@
|
||||
#
|
||||
|
||||
function(set_ie_threading_interface_for TARGET_NAME)
|
||||
macro(ext_message TRACE_LEVEL)
|
||||
if (TRACE_LEVEL STREQUAL FATAL_ERROR)
|
||||
if(InferenceEngine_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "${ARGN}")
|
||||
elseif(NOT InferenceEngine_FIND_QUIETLY)
|
||||
message(WARNING "${ARGN}")
|
||||
endif()
|
||||
return()
|
||||
elseif(NOT InferenceEngine_FIND_QUIETLY)
|
||||
message(${TRACE_LEVEL} "${ARGN}")
|
||||
endif ()
|
||||
endmacro()
|
||||
|
||||
if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" AND NOT TBB_FOUND)
|
||||
find_package(TBB COMPONENTS tbb tbbmalloc)
|
||||
if(IEDevScripts_DIR)
|
||||
find_package(TBB COMPONENTS tbb tbbmalloc
|
||||
PATHS IEDevScripts_DIR
|
||||
NO_CMAKE_FIND_ROOT_PATH
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_dependency(TBB COMPONENTS tbb tbbmalloc)
|
||||
endif()
|
||||
set("TBB_FOUND" ${TBB_FOUND} PARENT_SCOPE)
|
||||
set("TBB_IMPORTED_TARGETS" ${TBB_IMPORTED_TARGETS} PARENT_SCOPE)
|
||||
set("TBB_VERSION" ${TBB_VERSION} PARENT_SCOPE)
|
||||
@@ -15,12 +35,22 @@ function(set_ie_threading_interface_for TARGET_NAME)
|
||||
endif()
|
||||
|
||||
get_target_property(target_type ${TARGET_NAME} TYPE)
|
||||
|
||||
if(target_type STREQUAL "INTERFACE_LIBRARY")
|
||||
set(LINK_TYPE "INTERFACE")
|
||||
elseif(target_type STREQUAL "EXECUTABLE" OR target_type STREQUAL "OBJECT_LIBRARY")
|
||||
elseif(target_type STREQUAL "EXECUTABLE" OR target_type STREQUAL "OBJECT_LIBRARY" OR
|
||||
target_type STREQUAL "MODULE_LIBRARY")
|
||||
set(LINK_TYPE "PRIVATE")
|
||||
elseif(target_type STREQUAL "STATIC_LIBRARY")
|
||||
# Affected libraries: inference_engine_s, inference_engine_preproc_s
|
||||
# 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?
|
||||
set(LINK_TYPE "PRIVATE")
|
||||
else()
|
||||
set(LINK_TYPE "PUBLIC")
|
||||
ext_message(WARNING "Unknown target type")
|
||||
endif()
|
||||
|
||||
function(ie_target_link_libraries TARGET_NAME LINK_TYPE)
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
#
|
||||
# FindIE
|
||||
# ------
|
||||
#
|
||||
# This will define 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
|
||||
#
|
||||
|
||||
if(DEFINED IE_MAIN_SOURCE_DIR AND TARGET inference_engine)
|
||||
set(InferenceEngine_LIBRARIES inference_engine inference_engine_c_api)
|
||||
if(NOT TARGET IE::inference_engine)
|
||||
add_library(IE::inference_engine ALIAS inference_engine)
|
||||
endif()
|
||||
if(TARGET inference_engine_c_api AND NOT TARGET IE::inference_engine_c_api)
|
||||
add_library(IE::inference_engine_c_api ALIAS inference_engine_c_api)
|
||||
endif()
|
||||
else()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/inference_engine_targets.cmake")
|
||||
|
||||
file(TO_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}" cache_path)
|
||||
set (ie_options THREADING)
|
||||
load_cache("${cache_path}" READ_WITH_PREFIX "" ${ie_options})
|
||||
message(STATUS "The following CMake options are exported from the Inference Engine build tree")
|
||||
message("")
|
||||
foreach(option IN LISTS ie_options)
|
||||
message(" ${option}: ${${option}}")
|
||||
endforeach()
|
||||
message("")
|
||||
|
||||
# inherit TBB from main IE project if enabled
|
||||
if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
|
||||
load_cache("${cache_path}" READ_WITH_PREFIX "" TBB_DIR;ENABLE_TBB_RELEASE_ONLY)
|
||||
set(TBB_FIND_RELEASE_ONLY ${ENABLE_TBB_RELEASE_ONLY})
|
||||
find_package(TBB)
|
||||
endif()
|
||||
|
||||
get_target_property(InferenceEngine_INCLUDE_DIRS IE::inference_engine INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(InferenceEngine_LIBRARIES IE::inference_engine IE::inference_engine_c_api)
|
||||
|
||||
foreach(library IN LISTS InferenceEngine_LIBRARIES)
|
||||
if(CMAKE_CROSSCOMPILING AND NOT MSVC)
|
||||
set_property(TARGET ${library} PROPERTY
|
||||
INTERFACE_LINK_OPTIONS "-Wl,--allow-shlib-undefined")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT MSVC)
|
||||
set_target_properties(${InferenceEngine_LIBRARIES} PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "-Wno-error=deprecated-declarations")
|
||||
endif()
|
||||
endif()
|
||||
@@ -2,17 +2,23 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set(InferenceEngine_VERSION 2.1.0)
|
||||
set(PACKAGE_VERSION ${InferenceEngine_VERSION})
|
||||
# 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 "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
|
||||
|
||||
set(PACKAGE_VERSION_EXACT False)
|
||||
set(PACKAGE_VERSION_COMPATIBLE False)
|
||||
|
||||
if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT True)
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
set(PACKAGE_VERSION_EXACT True)
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
if(PACKAGE_FIND_VERSION_MAJOR EQUAL PACKAGE_VERSION_MAJOR AND
|
||||
PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE True)
|
||||
endif()
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
# Copyright (C) 2018-2020 Intel Corporation
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
#
|
||||
# FindIE
|
||||
# Inference Engine cmake config
|
||||
# ------
|
||||
#
|
||||
# You can specify the path to Inference Engine files in IE_ROOT_DIR
|
||||
#
|
||||
# This will define the following variables:
|
||||
#
|
||||
# InferenceEngine_FOUND - True if the system has the Inference Engine library
|
||||
@@ -19,150 +17,55 @@
|
||||
# IE::inference_engine_c_api - The Inference Engine C API library
|
||||
#
|
||||
|
||||
macro(ext_message TRACE_LEVEL)
|
||||
if (${TRACE_LEVEL} STREQUAL FATAL_ERROR)
|
||||
if(InferenceEngine_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "${ARGN}")
|
||||
elseif(NOT InferenceEngine_FIND_QUIETLY)
|
||||
message(WARNING "${ARGN}")
|
||||
endif()
|
||||
return()
|
||||
elseif(NOT InferenceEngine_FIND_QUIETLY)
|
||||
message(${TRACE_LEVEL} "${ARGN}")
|
||||
endif ()
|
||||
endmacro()
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set(InferenceEngine_FOUND FALSE)
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
if(TARGET IE::inference_engine)
|
||||
set(InferenceEngine_FOUND TRUE)
|
||||
get_target_property(InferenceEngine_INCLUDE_DIRS IE::inference_engine INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(InferenceEngine_LIBRARIES IE::inference_engine
|
||||
IE::inference_engine_c_api)
|
||||
else()
|
||||
if (WIN32)
|
||||
set(_ARCH intel64)
|
||||
else()
|
||||
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} _ARCH)
|
||||
if(_ARCH STREQUAL "x86_64" OR _ARCH STREQUAL "amd64") # Windows detects Intel's 64-bit CPU as AMD64
|
||||
set(_ARCH intel64)
|
||||
elseif(_ARCH STREQUAL "i386")
|
||||
set(_ARCH ia32)
|
||||
endif()
|
||||
endif()
|
||||
# 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@")
|
||||
|
||||
# check whether setvars.sh is sourced
|
||||
if(NOT IE_ROOT_DIR AND (DEFINED ENV{InferenceEngine_DIR} OR InferenceEngine_DIR OR DEFINED ENV{INTEL_OPENVINO_DIR}))
|
||||
if (EXISTS "${InferenceEngine_DIR}")
|
||||
# InferenceEngine_DIR manually set via command line params
|
||||
set(IE_ROOT_DIR "${InferenceEngine_DIR}/..")
|
||||
elseif (EXISTS "$ENV{InferenceEngine_DIR}")
|
||||
# InferenceEngine_DIR manually set via env
|
||||
set(IE_ROOT_DIR "$ENV{InferenceEngine_DIR}/..")
|
||||
elseif (EXISTS "$ENV{INTEL_OPENVINO_DIR}/inference_engine")
|
||||
# if we installed DL SDK
|
||||
set(IE_ROOT_DIR "$ENV{INTEL_OPENVINO_DIR}/inference_engine")
|
||||
elseif (EXISTS "$ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine")
|
||||
# CV SDK is installed
|
||||
set(IE_ROOT_DIR "$ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT IE_ROOT_DIR)
|
||||
ext_message(FATAL_ERROR "inference_engine root directory is not found")
|
||||
endif()
|
||||
|
||||
find_path(IE_INCLUDE_DIR inference_engine.hpp "${IE_ROOT_DIR}/include" NO_DEFAULT_PATH)
|
||||
|
||||
set(IE_LIB_DIR "${IE_ROOT_DIR}/lib/${_ARCH}")
|
||||
set(IE_LIB_REL_DIR "${IE_LIB_DIR}/Release")
|
||||
set(IE_LIB_DBG_DIR "${IE_LIB_DIR}/Debug")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if(WIN32)
|
||||
find_library(IE_RELEASE_LIBRARY inference_engine@IE_RELEASE_POSTFIX_WIN@ "${IE_LIB_REL_DIR}" NO_DEFAULT_PATH)
|
||||
find_library(IE_C_API_RELEASE_LIBRARY inference_engine_c_api@IE_RELEASE_POSTFIX_WIN@ "${IE_LIB_REL_DIR}" NO_DEFAULT_PATH)
|
||||
elseif(APPLE)
|
||||
find_library(IE_RELEASE_LIBRARY inference_engine@IE_RELEASE_POSTFIX_MAC@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
|
||||
find_library(IE_C_API_RELEASE_LIBRARY inference_engine_c_api@IE_RELEASE_POSTFIX_MAC@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library(IE_RELEASE_LIBRARY inference_engine@IE_RELEASE_POSTFIX_LIN@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
|
||||
find_library(IE_C_API_RELEASE_LIBRARY inference_engine_c_api@IE_RELEASE_POSTFIX_LIN@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args( InferenceEngine
|
||||
FOUND_VAR INFERENCEENGINE_FOUND
|
||||
REQUIRED_VARS IE_RELEASE_LIBRARY IE_C_API_RELEASE_LIBRARY IE_INCLUDE_DIR
|
||||
FAIL_MESSAGE "Some of mandatory Inference Engine components are not found. Please consult InferenceEgnineConfig.cmake module's help page.")
|
||||
|
||||
if(INFERENCEENGINE_FOUND)
|
||||
# to keep this line for successful execution in CMake 2.8
|
||||
set(InferenceEngine_FOUND TRUE)
|
||||
|
||||
foreach(ie_library_suffix "" "_c_api")
|
||||
string(TOUPPER "${ie_library_suffix}" ie_library_usuffix)
|
||||
add_library(IE::inference_engine${ie_library_suffix} SHARED IMPORTED GLOBAL)
|
||||
|
||||
if (WIN32)
|
||||
set_target_properties(IE::inference_engine${ie_library_suffix} PROPERTIES
|
||||
IMPORTED_CONFIGURATIONS RELEASE
|
||||
IMPORTED_IMPLIB_RELEASE "${IE${ie_library_usuffix}_RELEASE_LIBRARY}"
|
||||
MAP_IMPORTED_CONFIG_RELEASE Release
|
||||
MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${IE_INCLUDE_DIR}")
|
||||
|
||||
# Debug binaries are optional
|
||||
find_library(IE${ie_library_usuffix}_DEBUG_LIBRARY inference_engine${ie_library_suffix}@IE_DEBUG_POSTFIX_WIN@
|
||||
"${IE_LIB_DBG_DIR}" NO_DEFAULT_PATH)
|
||||
if (IE${ie_library_usuffix}_DEBUG_LIBRARY)
|
||||
set_property(TARGET IE::inference_engine${ie_library_suffix} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(IE::inference_engine${ie_library_suffix} PROPERTIES
|
||||
IMPORTED_IMPLIB_DEBUG "${IE${ie_library_usuffix}_DEBUG_LIBRARY}"
|
||||
MAP_IMPORTED_CONFIG_DEBUG Debug)
|
||||
else()
|
||||
ext_message(WARNING "Inference Engine DEBUG binaries are missed.")
|
||||
endif()
|
||||
elseif (APPLE)
|
||||
set_target_properties(IE::inference_engine${ie_library_suffix} PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${IE${ie_library_usuffix}_RELEASE_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${IE_INCLUDE_DIR}"
|
||||
INTERFACE_COMPILE_OPTIONS "-Wno-error=deprecated-declarations")
|
||||
|
||||
# Debug binaries are optional
|
||||
find_library(IE${ie_library_usuffix}_DEBUG_LIBRARY inference_engine${ie_library_suffix}@IE_DEBUG_POSTFIX_MAC@ "${IE_LIB_DIR}" NO_DEFAULT_PATH)
|
||||
if (IE${ie_library_usuffix}_DEBUG_LIBRARY)
|
||||
set_target_properties(IE::inference_engine${ie_library_suffix} PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${IE${ie_library_usuffix}_DEBUG_LIBRARY}")
|
||||
else()
|
||||
ext_message(WARNING "Inference Engine DEBUG binaries are missed")
|
||||
endif()
|
||||
else()
|
||||
# Only Release binaries are distributed for Linux systems
|
||||
set_target_properties(IE::inference_engine${ie_library_suffix} PROPERTIES
|
||||
IMPORTED_LOCATION "${IE${ie_library_usuffix}_RELEASE_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${IE_INCLUDE_DIR}")
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
set_target_properties(IE::inference_engine${ie_library_suffix} PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "-diag-warning=1786")
|
||||
else()
|
||||
set_target_properties(IE::inference_engine${ie_library_suffix} PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "-Wno-error=deprecated-declarations")
|
||||
if(CMAKE_CROSSCOMPILING AND NOT MSVC)
|
||||
set_property(TARGET IE::inference_engine${ie_library_suffix} PROPERTY
|
||||
INTERFACE_LINK_OPTIONS "-Wl,--allow-shlib-undefined")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(InferenceEngine_INCLUDE_DIRS ${IE_INCLUDE_DIR})
|
||||
set(InferenceEngine_LIBRARIES IE::inference_engine
|
||||
IE::inference_engine_c_api)
|
||||
|
||||
set(IE_EXTERNAL_DIR "${IE_ROOT_DIR}/external")
|
||||
include("${IE_ROOT_DIR}/share/ie_parallel.cmake")
|
||||
endif()
|
||||
set(THREADING "@THREADING@")
|
||||
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
|
||||
set_and_check(_tbb_dir "@PACKAGE_IE_TBB_DIR@")
|
||||
find_dependency(TBB
|
||||
COMPONENTS tbb tbbmalloc
|
||||
CONFIG
|
||||
PATHS ${TBBROOT}/cmake
|
||||
${_tbb_dir}
|
||||
NO_CMAKE_FIND_ROOT_PATH
|
||||
NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
set_and_check(_ngraph_dir "@PACKAGE_IE_NGRAPH_DIR@")
|
||||
find_dependency(ngraph
|
||||
CONFIG
|
||||
PATHS ${_ngraph_dir}
|
||||
NO_CMAKE_FIND_ROOT_PATH
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
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()
|
||||
|
||||
set_target_properties(${ARGV} PROPERTIES INTERFACE_COMPILE_OPTIONS ${flags})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(TARGET inference_engine)
|
||||
set(InferenceEngine_LIBRARIES inference_engine inference_engine_c_api)
|
||||
else()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/InferenceEngineTargets.cmake")
|
||||
set(InferenceEngine_LIBRARIES IE::inference_engine IE::inference_engine_c_api)
|
||||
_ie_target_no_deprecation_error(${InferenceEngine_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# restore PACKAGE_PREFIX_DIR
|
||||
set(PACKAGE_PREFIX_DIR ${IE_PACKAGE_PREFIX_DIR})
|
||||
|
||||
set_and_check(InferenceEngine_INCLUDE_DIRS "@PACKAGE_IE_INCLUDE_DIR@")
|
||||
|
||||
check_required_components(InferenceEngine)
|
||||
|
||||
Reference in New Issue
Block a user