Rpath story (#20297)

This commit is contained in:
Ilya Lavrenov 2023-10-10 08:27:26 +04:00 committed by GitHub
parent bf9bdaa671
commit e30f75bb4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 143 additions and 95 deletions

View File

@ -192,14 +192,6 @@ ov_set_if_not_defined(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_ROOT}/${BIN_FOLDER
include(packaging/packaging)
if(APPLE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
if(DEFINED OV_CPACK_LIBRARYDIR)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OV_CPACK_LIBRARYDIR}")
else()
message(FATAL_ERROR "Internal error: OV_CPACK_LIBRARYDIR is not defined, while it's required to initialize RPATH")
endif()
# WA for Xcode generator + object libraries issue:
# https://gitlab.kitware.com/cmake/cmake/issues/20260
# http://cmake.3232098.n2.nabble.com/XCODE-DEPEND-HELPER-make-Deletes-Targets-Before-and-While-They-re-Built-td7598277.html

View File

@ -4,6 +4,15 @@
include(GNUInstallDirs)
if(APPLE)
# on macOS versions with SIP enabled, we need to use @rpath
# because DYLD_LIBRARY_PATH is ignored
set(CMAKE_SKIP_INSTALL_RPATH OFF)
else()
# we don't need RPATHs, because setupvars.sh is used
set(CMAKE_SKIP_INSTALL_RPATH ON)
endif()
#
# ov_archive_cpack_set_dirs()
#

View File

@ -4,6 +4,14 @@
include(GNUInstallDirs)
if(CPACK_GENERATOR STREQUAL "BREW")
# brew relies on RPATHs
# set(CMAKE_SKIP_INSTALL_RPATH OFF)
else()
# we don't need RPATHs, because libraries are searched by standard paths
set(CMAKE_SKIP_INSTALL_RPATH ON)
endif()
#
# ov_common_libraries_cpack_set_dirs()
#
@ -107,8 +115,3 @@ macro(ov_define_component_include_rules)
endmacro()
ov_define_component_include_rules()
if(CPACK_GENERATOR STREQUAL "BREW")
# brew relies on RPATH
set(CMAKE_SKIP_INSTALL_RPATH OFF)
endif()

View File

@ -4,9 +4,6 @@
include(CPackComponent)
# we don't need RPATHs, because setupvars.sh is used
set(CMAKE_SKIP_INSTALL_RPATH ON)
#
# ov_install_static_lib(<target> <comp>)
#
@ -31,6 +28,29 @@ macro(ov_install_static_lib target comp)
endif()
endmacro()
#
# ov_set_apple_rpath(<target> <lib_install_path> <dependency_install_path> ...)
#
# Sets LC_RPATH properties for macOS MACH-O binaries to ensure that libraries can find their dependencies
# when macOS system integrity protection (SIP) is enabled (DYLD_LIBRARY_PATH is ignored in this case).
# Note, that this is important when binaries are dynamically loaded at runtime (e.g. via Python).
#
function(ov_set_apple_rpath TARGET_NAME lib_install_path)
if(APPLE AND CPACK_GENERATOR MATCHES "^(7Z|TBZ2|TGZ|TXZ|TZ|TZST|ZIP)$")
unset(rpath_list)
foreach(dependency_install_path IN LISTS ARGN)
file(RELATIVE_PATH dependency_rpath "/${lib_install_path}" "/${dependency_install_path}")
set(dependency_rpath "@loader_path/${dependency_rpath}")
list(APPEND rpath_list "${dependency_rpath}")
endforeach()
set_target_properties(${TARGET_NAME} PROPERTIES
MACOSX_RPATH ON
INSTALL_RPATH "${rpath_list}"
INSTALL_NAME_DIR "@rpath")
endif()
endfunction()
#
# ov_get_pyversion(<OUT pyversion>)
#

View File

@ -220,7 +220,7 @@ macro (ov_add_version_defines FILE TARGET)
$<TARGET_PROPERTY:${TARGET},INTERFACE_COMPILE_OPTIONS>
$<TARGET_PROPERTY:${TARGET},COMPILE_OPTIONS>)
set_target_properties(${TARGET}_version
PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE
PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE
$<TARGET_PROPERTY:${TARGET},INTERPROCEDURAL_OPTIMIZATION_RELEASE>)
target_sources(${TARGET} PRIVATE $<TARGET_OBJECTS:${TARGET}_version>)

View File

@ -17,7 +17,7 @@ set_and_check(OpenVINO_MAIN_SOURCE_DIR "@OpenVINO_SOURCE_DIR@") # NPU
set(ov_options "@OV_OPTIONS@")
list(APPEND ov_options CMAKE_CXX_COMPILER_LAUNCHER CMAKE_C_COMPILER_LAUNCHER
CMAKE_CXX_LINKER_LAUNCHER CMAKE_C_LINKER_LAUNCHER
CMAKE_SKIP_RPATH CMAKE_INSTALL_PREFIX CPACK_GENERATOR)
CMAKE_INSTALL_PREFIX CPACK_GENERATOR)
if(APPLE)
list(APPEND ov_options CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET)

View File

@ -13,7 +13,7 @@ set_and_check(OpenVINO_SOURCE_DIR "@OpenVINO_SOURCE_DIR@")
set(ov_options "@OV_OPTIONS@")
list(APPEND ov_options CMAKE_CXX_COMPILER_LAUNCHER CMAKE_C_COMPILER_LAUNCHER
CMAKE_CXX_LINKER_LAUNCHER CMAKE_C_LINKER_LAUNCHER
CMAKE_SKIP_RPATH CMAKE_INSTALL_PREFIX CPACK_GENERATOR)
CMAKE_INSTALL_PREFIX CPACK_GENERATOR)
if(APPLE)
list(APPEND ov_options CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET)
@ -42,6 +42,9 @@ foreach(option IN LISTS ov_options)
endforeach()
message(" ")
# Restore TBB installation directory (requires for proper LC_RPATH on macOS with SIP)
load_cache("${cache_path}" READ_WITH_PREFIX "" TBB_INSTALL_DIR)
# activate generation of plugins.xml
set(ENABLE_PLUGINS_XML ON)

View File

@ -223,7 +223,9 @@ macro(ov_add_sample)
endif()
set_target_properties(${SAMPLE_NAME} PROPERTIES FOLDER ${folder_name}
COMPILE_PDB_NAME ${SAMPLE_NAME})
COMPILE_PDB_NAME ${SAMPLE_NAME}
# to ensure out of box LC_RPATH on macOS with SIP
INSTALL_RPATH_USE_LINK_PATH ON)
if(SAMPLE_INCLUDE_DIRECTORIES)
target_include_directories(${SAMPLE_NAME} PRIVATE ${SAMPLE_INCLUDE_DIRECTORIES})

View File

@ -32,6 +32,10 @@ set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_REL
ov_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "OpenVINO C API Core Runtime library")
ov_set_apple_rpath(${TARGET_NAME}
# openvino_c installed in the same directory as openvino
${OV_CPACK_RUNTIMEDIR} ${OV_CPACK_RUNTIMEDIR})
# export
set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME runtime::c)

View File

@ -84,6 +84,10 @@ add_custom_command(TARGET ${TARGET_NAME}
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/__init__.py
)
foreach(target IN LISTS INSTALLED_TARGETS)
ov_set_apple_rpath(${target} ${OV_CPACK_PYTHONDIR}/openvino/inference_engine ${OV_CPACK_RUNTIMEDIR})
endforeach()
# install
install(TARGETS ${INSTALLED_TARGETS}

View File

@ -68,6 +68,8 @@ if(OpenVINO_SOURCE_DIR)
)
endif()
ov_set_apple_rpath(_${PROJECT_NAME} ${OV_CPACK_PYTHONDIR} ${OV_CPACK_RUNTIMEDIR})
# Install
if(OpenVINO_SOURCE_DIR OR OpenVINODeveloperPackage_FOUND)

View File

@ -72,7 +72,7 @@ endif()
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(${PROJECT_NAME} PRIVATE
openvino::runtime::dev openvino::runtime ${OFFLINE_TRANSFORMATIONS_LIB})
openvino::core::dev openvino::runtime ${OFFLINE_TRANSFORMATIONS_LIB})
set_target_properties(${PROJECT_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}
OUTPUT_NAME "_pyopenvino")
@ -124,6 +124,13 @@ if(OpenVINO_SOURCE_DIR OR OpenVINODeveloperPackage_FOUND)
COMPONENT ${OV_CPACK_COMP_PYTHON_OPENVINO}_${pyversion}
${OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL})
ov_set_apple_rpath(${PROJECT_NAME} ${OV_CPACK_PYTHONDIR}/openvino
# path to OpenVINO C++ libraries
${OV_CPACK_RUNTIMEDIR}
# pyopenvino also depends on TBB because of:
# pyopenvino => openvino::offline_transformations => TBB optimized openvino::reference
${TBB_LIB_INSTALL_DIR})
ov_cpack_add_component(${OV_CPACK_COMP_OPENVINO_REQ_FILES} HIDDEN)
install(FILES ${OpenVINOPython_SOURCE_DIR}/requirements.txt

View File

@ -3,7 +3,6 @@
#include "pyopenvino/core/async_infer_queue.hpp"
#include <ie_common.h>
#include <pybind11/functional.h>
#include <pybind11/stl.h>

View File

@ -9,13 +9,12 @@
#include <pybind11/stl.h>
#include <pybind11/iostream.h>
#include <openvino/core/type/element_type.hpp>
#include <ngraph/runtime/shared_buffer.hpp>
#include <string>
#include <iterator>
#include <climits>
#include "Python.h"
#include "openvino/core/type/element_type.hpp"
#include "openvino/runtime/compiled_model.hpp"
#include "openvino/runtime/infer_request.hpp"
#include "openvino/runtime/tensor.hpp"

View File

@ -4,7 +4,6 @@
#include "pyopenvino/core/core.hpp"
#include <ie_extension.h>
#include <pybind11/stl.h>
#include <openvino/core/any.hpp>

View File

@ -3,7 +3,6 @@
#include "pyopenvino/core/infer_request.hpp"
#include <ie_common.h>
#include <pybind11/functional.h>
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>

View File

@ -25,7 +25,7 @@ function(frontend_module TARGET FRAMEWORK INSTALL_COMPONENT)
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
"${OpenVINOPython_SOURCE_DIR}/src/pyopenvino/utils/")
target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime openvino::runtime::dev openvino::frontend::${FRAMEWORK})
target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime openvino::core::dev openvino::frontend::${FRAMEWORK})
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
@ -39,8 +39,11 @@ function(frontend_module TARGET FRAMEWORK INSTALL_COMPONENT)
COMMAND ${CMAKE_COMMAND} -E copy ${OpenVINOPython_SOURCE_DIR}/src/openvino/frontend/${FRAMEWORK}/__init__.py
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/__init__.py)
set(frontend_install_path ${OV_CPACK_PYTHONDIR}/openvino/frontend/${FRAMEWORK})
install(TARGETS ${TARGET_NAME}
DESTINATION ${OV_CPACK_PYTHONDIR}/openvino/frontend/${FRAMEWORK}
DESTINATION ${frontend_install_path}
COMPONENT ${INSTALL_COMPONENT}
${OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL})
ov_set_apple_rpath(${TARGET_NAME} ${frontend_install_path} ${OV_CPACK_RUNTIMEDIR})
endfunction()

View File

@ -17,7 +17,6 @@
#include <vector>
#include "dict_attribute_visitor.hpp"
#include "ngraph/check.hpp"
#include "openvino/core/except.hpp"
#include "openvino/core/node.hpp"
#include "openvino/core/op_extension.hpp"

View File

@ -128,7 +128,7 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
endforeach()
endforeach()
set(pkg_config_tbb_lib_dir "runtime/3rdparty/tbb/lib")
set(TBB_LIB_INSTALL_DIR "runtime/3rdparty/tbb/lib" CACHE PATH "TBB library install directory" FORCE)
elseif(tbb_custom)
# for custom TBB we need to install it to our package
# to simplify life for our customers
@ -183,7 +183,7 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
endif()
endforeach()
set(pkg_config_tbb_lib_dir "${IE_TBBROOT_INSTALL}/${tbb_libs_dir}")
set(TBB_LIB_INSTALL_DIR "${IE_TBBROOT_INSTALL}/${tbb_libs_dir}" CACHE PATH "TBB library install directory" FORCE)
elseif(tbb_downloaded)
set(OV_TBB_DIR_INSTALL "runtime/3rdparty/tbb")
@ -234,13 +234,16 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
PATTERN "cmake" EXCLUDE)
endif()
set(pkg_config_tbb_lib_dir "${OV_TBB_DIR_INSTALL}/lib")
set(TBB_LIB_INSTALL_DIR "${OV_TBB_DIR_INSTALL}/lib" CACHE PATH "TBB library install directory" FORCE)
else()
unset(TBB_LIB_INSTALL_DIR CACHE)
message(WARNING "TBB of unknown origin. TBB files are not installed")
endif()
unset(tbb_downloaded)
unset(tbb_custom)
else()
unset(TBB_LIB_INSTALL_DIR CACHE)
endif()
# install tbbbind for static OpenVINO case

View File

@ -72,6 +72,14 @@ endif()
ov_set_threading_interface_for(${TARGET_NAME})
ov_mark_target_as_cc(${TARGET_NAME})
if(TBB_FOUND)
if(NOT TBB_LIB_INSTALL_DIR)
message(FATAL_ERROR "Internal error: variable 'TBB_LIB_INSTALL_DIR' is not defined")
endif()
# set LC_RPATH to TBB library directory
ov_set_apple_rpath(${TARGET_NAME} ${OV_CPACK_RUNTIMEDIR} ${TBB_LIB_INSTALL_DIR})
endif()
# must be called after all target_link_libraries
ov_add_api_validator_post_build_step(TARGET ${TARGET_NAME} EXTRA ${TBB_IMPORTED_TARGETS})
@ -96,7 +104,7 @@ install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets
# OpenVINO runtime library dev
#
# Add openvin::dev target
# Add openvino::runtine::dev target
#
add_library(${TARGET_NAME}_dev INTERFACE)
@ -112,6 +120,7 @@ target_compile_definitions(${TARGET_NAME}_dev INTERFACE
target_link_libraries(${TARGET_NAME}_dev INTERFACE ${TARGET_NAME} openvino::core::dev)
# TODO: remove once NPU will use explicltly `ov_set_threading_interface_for`
ov_set_threading_interface_for(${TARGET_NAME}_dev)
set_target_properties(${TARGET_NAME}_dev PROPERTIES EXPORT_NAME runtime::dev)
@ -253,11 +262,11 @@ if(ENABLE_PKGCONFIG_GEN)
if(ENABLE_SYSTEM_TBB)
set(PKGCONFIG_OpenVINO_PRIVATE_DEPS "-ltbb")
elseif(TBB_FOUND)
if(NOT pkg_config_tbb_lib_dir)
message(FATAL_ERROR "Internal error: variable 'pkg_config_tbb_lib_dir' is not defined")
if(NOT TBB_LIB_INSTALL_DIR)
message(FATAL_ERROR "Internal error: variable 'TBB_LIB_INSTALL_DIR' is not defined")
endif()
set(PKGCONFIG_OpenVINO_PRIVATE_DEPS "-L\${prefix}/${pkg_config_tbb_lib_dir} -ltbb")
set(PKGCONFIG_OpenVINO_PRIVATE_DEPS "-L\${prefix}/${TBB_LIB_INSTALL_DIR} -ltbb")
endif()
if(ENABLE_SYSTEM_PUGIXML)

View File

@ -261,18 +261,16 @@ function(ov_set_threading_interface_for TARGET_NAME)
if(target_type STREQUAL "INTERFACE_LIBRARY")
set(LINK_TYPE "INTERFACE")
set(COMPILE_DEF_TYPE "INTERFACE")
elseif(target_type STREQUAL "EXECUTABLE" OR target_type STREQUAL "OBJECT_LIBRARY" OR
target_type STREQUAL "MODULE_LIBRARY")
elseif(target_type MATCHES "^(EXECUTABLE|OBJECT_LIBRARY|MODULE_LIBRARY)$")
set(LINK_TYPE "PRIVATE")
set(COMPILE_DEF_TYPE "PUBLIC")
set(COMPILE_DEF_TYPE "PRIVATE")
elseif(target_type STREQUAL "STATIC_LIBRARY")
# Affected libraries: inference_engine_s, openvino_gapi_preproc_s
# they don't have TBB in public headers => PRIVATE
set(LINK_TYPE "PRIVATE")
set(COMPILE_DEF_TYPE "PUBLIC")
elseif(target_type STREQUAL "SHARED_LIBRARY")
# Affected libraries: inference_engine only
# TODO: why TBB propogates its headers to inference_engine?
# Affected libraries: 'openvino' only
set(LINK_TYPE "PRIVATE")
set(COMPILE_DEF_TYPE "PUBLIC")
else()

View File

@ -19,11 +19,7 @@ source_group("include" FILES ${PUBLIC_HEADERS})
add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS})
target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime::dev openvino::itt openvino::pugixml openvino::reference
openvino::runtime)
set_source_files_properties(INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:openvino::pugixml,INTERFACE_INCLUDE_DIRECTORIES>)
target_link_libraries(${TARGET_NAME} PRIVATE openvino::core::dev openvino::reference openvino::runtime)
target_include_directories(${TARGET_NAME} PUBLIC ${PUBLIC_HEADERS_DIR}
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src")

View File

@ -44,6 +44,8 @@ ov_add_test_target(
LINK_LIBRARIES
gmock
func_test_utils
DEFINES
${COMPILE_DEFINITIONS}
INCLUDES
$<TARGET_PROPERTY:inference_engine_obj,SOURCE_DIR>/src
${CMAKE_CURRENT_SOURCE_DIR}
@ -52,4 +54,4 @@ ov_add_test_target(
OV UNIT RUNTIME
)
add_compile_definitions(${TARGET_NAME} ${COMPILE_DEFINITIONS})
ov_set_threading_interface_for(${TARGET_NAME})

View File

@ -19,3 +19,5 @@ ov_add_test_target(
LABELS
OV UNIT RUNTIME
)
ov_set_threading_interface_for(${TARGET_NAME})

View File

@ -1,8 +1,7 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# RPATH is always enabled for unit tests
set(CMAKE_SKIP_RPATH OFF)
# because unit tests use plugins object files compiled with LTO
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})

View File

@ -18,17 +18,13 @@ ov_add_plugin(NAME ${TARGET_NAME}
SOURCES ${SOURCES} ${HEADERS}
VERSION_DEFINES_FOR src/plugin.cpp ADD_CLANG_FORMAT)
target_link_libraries(${TARGET_NAME} PRIVATE Threads::Threads)
ov_set_threading_interface_for(${TARGET_NAME})
# must be called after all target_link_libraries
ov_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
if(ENABLE_FUNCTIONAL_TESTS)
add_subdirectory(tests/functional)
endif()
if(ENABLE_TESTS)
add_subdirectory(tests/unit)
add_subdirectory(tests)
endif()

View File

@ -0,0 +1,6 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
add_subdirectory(unit)
add_subdirectory(functional)

View File

@ -29,38 +29,31 @@ ov_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
if(BUILD_SHARED_LIBS)
set(OBJ_NAME ${TARGET_NAME}_obj)
add_library(${OBJ_NAME} OBJECT ${SOURCES} ${HEADERS})
ov_link_system_libraries(${OBJ_NAME} PUBLIC openvino::pugixml)
ov_add_version_defines(src/version.cpp ${OBJ_NAME})
target_include_directories(${OBJ_NAME}
PRIVATE
$<TARGET_PROPERTY:openvino::runtime::dev,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:openvino::itt,INTERFACE_INCLUDE_DIRECTORIES>
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
$<TARGET_PROPERTY:openvino::conditional_compilation,INTERFACE_INCLUDE_DIRECTORIES>)
ov_set_threading_interface_for(${OBJ_NAME})
target_compile_definitions(${OBJ_NAME}
PRIVATE
USE_STATIC_IE IMPLEMENT_INFERENCE_ENGINE_PLUGIN IMPLEMENT_INFERENCE_EXTENSION_API
$<TARGET_PROPERTY:ngraph,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_COMPILE_DEFINITIONS>)
set_target_properties(${TARGET_NAME}_obj PROPERTIES EXCLUDE_FROM_ALL ON)
set_target_properties(${TARGET_NAME}_obj PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
endif()
if(ENABLE_TESTS)
add_subdirectory(tests/unit)
endif()
if(BUILD_SHARED_LIBS)
set(OBJ_NAME ${TARGET_NAME}_obj)
if(ENABLE_FUNCTIONAL_TESTS)
add_subdirectory(tests/functional)
add_library(${OBJ_NAME} OBJECT ${SOURCES} ${HEADERS})
ov_link_system_libraries(${OBJ_NAME} PUBLIC openvino::pugixml)
ov_add_version_defines(src/version.cpp ${OBJ_NAME})
target_include_directories(${OBJ_NAME}
PRIVATE
$<TARGET_PROPERTY:openvino::runtime::dev,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:openvino::itt,INTERFACE_INCLUDE_DIRECTORIES>
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
$<TARGET_PROPERTY:openvino::conditional_compilation,INTERFACE_INCLUDE_DIRECTORIES>)
ov_set_threading_interface_for(${OBJ_NAME})
target_compile_definitions(${OBJ_NAME}
PRIVATE
USE_STATIC_IE IMPLEMENT_INFERENCE_ENGINE_PLUGIN IMPLEMENT_INFERENCE_EXTENSION_API
$<TARGET_PROPERTY:ngraph,INTERFACE_COMPILE_DEFINITIONS>
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_COMPILE_DEFINITIONS>)
endif()
add_subdirectory(tests)
endif()

View File

@ -0,0 +1,6 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
add_subdirectory(unit)
add_subdirectory(functional)

View File

@ -8,7 +8,6 @@ ov_add_test_target(
NAME ${TARGET_NAME}
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDENCIES
openvino::runtime
mock_engine
openvino_hetero_plugin
LINK_LIBRARIES

View File

@ -24,7 +24,6 @@ ov_add_test_target(
ov_models
DEPENDENCIES
mock_engine
ov_models
ADD_CLANG_FORMAT
LABELS
OV UNIT HETERO

View File

@ -8,9 +8,6 @@ set(TARGET_NAME InferenceEngineUnitTests)
ov_disable_deprecated_warnings()
# rpath enabled for unit tests only
SET (CMAKE_SKIP_RPATH OFF)
# collect sources
file(GLOB

View File

@ -4,9 +4,6 @@
set(TARGET_NAME ov_gna_unit_tests)
# RPATH is always enabled for unit tests
set(CMAKE_SKIP_RPATH OFF)
# because unit tests use plugins object files compiled with LTO
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})

View File

@ -65,6 +65,8 @@ target_link_libraries(${TARGET_NAME} PRIVATE openvino_intel_gpu_graph openvino::
target_include_directories(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include/)
ov_set_threading_interface_for(${TARGET_NAME})
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
# Workaround to avoid warnings during LTO build