Ability to exclude TBB from install package (#21624)
This commit is contained in:
parent
23fae3b1bc
commit
94a21d606c
@ -69,6 +69,9 @@ macro(ov_define_component_include_rules)
|
||||
unset(OV_CPACK_COMP_CORE_C_EXCLUDE_ALL)
|
||||
unset(OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL)
|
||||
unset(OV_CPACK_COMP_CORE_C_DEV_EXCLUDE_ALL)
|
||||
# tbb
|
||||
unset(OV_CPACK_COMP_TBB_EXCLUDE_ALL)
|
||||
unset(OV_CPACK_COMP_TBB_DEV_EXCLUDE_ALL)
|
||||
# licensing
|
||||
unset(OV_CPACK_COMP_LICENSING_EXCLUDE_ALL)
|
||||
# samples
|
||||
|
@ -77,6 +77,9 @@ macro(ov_define_component_include_rules)
|
||||
set(OV_CPACK_COMP_CORE_C_EXCLUDE_ALL ${OV_CPACK_COMP_CORE_EXCLUDE_ALL})
|
||||
unset(OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL)
|
||||
set(OV_CPACK_COMP_CORE_C_DEV_EXCLUDE_ALL ${OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL})
|
||||
# tbb
|
||||
set(OV_CPACK_COMP_TBB_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
set(OV_CPACK_COMP_TBB_DEV_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
# licensing
|
||||
if(CPACK_GENERATOR STREQUAL "CONAN")
|
||||
unset(OV_CPACK_COMP_LICENSING_EXCLUDE_ALL)
|
||||
|
@ -78,6 +78,9 @@ macro(ov_define_component_include_rules)
|
||||
set(OV_CPACK_COMP_CORE_C_EXCLUDE_ALL ${OV_CPACK_COMP_CORE_EXCLUDE_ALL})
|
||||
unset(OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL)
|
||||
set(OV_CPACK_COMP_CORE_C_DEV_EXCLUDE_ALL ${OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL})
|
||||
# tbb
|
||||
set(OV_CPACK_COMP_TBB_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
set(OV_CPACK_COMP_TBB_DEV_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
# licensing
|
||||
set(OV_CPACK_COMP_LICENSING_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
# samples
|
||||
|
@ -101,6 +101,9 @@ macro(ov_define_component_include_rules)
|
||||
unset(OV_CPACK_COMP_CORE_C_EXCLUDE_ALL)
|
||||
unset(OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL)
|
||||
unset(OV_CPACK_COMP_CORE_C_DEV_EXCLUDE_ALL)
|
||||
# tbb
|
||||
unset(OV_CPACK_COMP_TBB_EXCLUDE_ALL)
|
||||
unset(OV_CPACK_COMP_TBB_DEV_EXCLUDE_ALL)
|
||||
# licensing
|
||||
unset(OV_CPACK_COMP_LICENSING_EXCLUDE_ALL)
|
||||
# samples
|
||||
|
@ -29,14 +29,18 @@ macro(ov_install_static_lib target comp)
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# ov_set_apple_rpath(<target> <lib_install_path> <dependency_install_path> ...)
|
||||
# ov_set_install_rpath(<target> <lib_install_path> <dependency_install_path> ...)
|
||||
#
|
||||
# macOS:
|
||||
# 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)$")
|
||||
# NPM:
|
||||
# we need to set RPATH, because archive must be self-sufficient
|
||||
#
|
||||
function(ov_set_install_rpath TARGET_NAME lib_install_path)
|
||||
if(APPLE AND CPACK_GENERATOR MATCHES "^(7Z|TBZ2|TGZ|TXZ|TZ|TZST|ZIP)$" OR CPACK_GENERATOR STREQUAL "NPM")
|
||||
unset(rpath_list)
|
||||
foreach(dependency_install_path IN LISTS ARGN)
|
||||
file(RELATIVE_PATH dependency_rpath "/${lib_install_path}" "/${dependency_install_path}")
|
||||
@ -44,10 +48,7 @@ function(ov_set_apple_rpath TARGET_NAME lib_install_path)
|
||||
list(APPEND rpath_list "${dependency_rpath}")
|
||||
endforeach()
|
||||
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES
|
||||
MACOSX_RPATH ON
|
||||
INSTALL_RPATH "${rpath_list}"
|
||||
INSTALL_NAME_DIR "@rpath")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "${rpath_list}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
@ -69,6 +69,9 @@ macro(ov_define_component_include_rules)
|
||||
set(OV_CPACK_COMP_CORE_C_EXCLUDE_ALL ${OV_CPACK_COMP_CORE_EXCLUDE_ALL})
|
||||
unset(OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL)
|
||||
set(OV_CPACK_COMP_CORE_C_DEV_EXCLUDE_ALL ${OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL})
|
||||
# tbb
|
||||
set(OV_CPACK_COMP_TBB_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
set(OV_CPACK_COMP_TBB_DEV_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
# licensing
|
||||
set(OV_CPACK_COMP_LICENSING_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
# samples
|
||||
|
@ -15,9 +15,6 @@ macro(ov_cpack_settings)
|
||||
if(NOT OV_CPACK_COMP_${UPPER_COMP}_EXCLUDE_ALL AND
|
||||
# because in case of VCPKG | CONAN | BREW | CONDA-FORGE distributions, python is either not needed or installed separately
|
||||
(NOT item MATCHES "^${OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE}_python.*" OR ENABLE_PYTHON_PACKAGING) AND
|
||||
# even for case of system TBB we have installation rules for wheels packages
|
||||
# so, need to skip this explicitly since they are installed in `host` section
|
||||
NOT item MATCHES "^tbb(_dev)?$" AND
|
||||
# the same for pugixml
|
||||
NOT item STREQUAL "pugixml")
|
||||
list(APPEND CPACK_COMPONENTS_ALL ${item})
|
||||
|
@ -57,9 +57,6 @@ macro(ov_cpack_settings)
|
||||
NOT item STREQUAL "nvidia" AND
|
||||
# don't install Intel OpenMP
|
||||
NOT item STREQUAL "omp" AND
|
||||
# even for case of system TBB we have installation rules for wheels packages
|
||||
# so, need to skip this explicitly
|
||||
NOT item MATCHES "^tbb(_dev)?$" AND
|
||||
# the same for pugixml
|
||||
NOT item STREQUAL "pugixml")
|
||||
list(APPEND CPACK_COMPONENTS_ALL ${item})
|
||||
|
@ -43,9 +43,6 @@ macro(ov_cpack_settings)
|
||||
NOT item STREQUAL "nvidia" AND
|
||||
# don't install Intel OpenMP
|
||||
NOT item STREQUAL "omp" AND
|
||||
# even for case of system TBB we have installation rules for wheels packages
|
||||
# so, need to skip this explicitly
|
||||
NOT item MATCHES "^tbb(_dev)?$" AND
|
||||
# the same for pugixml
|
||||
NOT item STREQUAL "pugixml")
|
||||
list(APPEND CPACK_COMPONENTS_ALL ${item})
|
||||
|
@ -33,9 +33,9 @@ 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})
|
||||
ov_set_install_rpath(${TARGET_NAME}
|
||||
# openvino_c installed in the same directory as openvino
|
||||
${OV_CPACK_RUNTIMEDIR} ${OV_CPACK_RUNTIMEDIR})
|
||||
|
||||
# export
|
||||
|
||||
|
@ -85,7 +85,7 @@ add_custom_command(TARGET ${TARGET_NAME}
|
||||
)
|
||||
|
||||
foreach(target IN LISTS INSTALLED_TARGETS)
|
||||
ov_set_apple_rpath(${target} ${OV_CPACK_PYTHONDIR}/openvino/inference_engine ${OV_CPACK_RUNTIMEDIR})
|
||||
ov_set_install_rpath(${target} ${OV_CPACK_PYTHONDIR}/openvino/inference_engine ${OV_CPACK_RUNTIMEDIR})
|
||||
endforeach()
|
||||
|
||||
# install
|
||||
|
@ -64,7 +64,7 @@ add_custom_command(TARGET _${PROJECT_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../ngraph ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ngraph
|
||||
)
|
||||
|
||||
ov_set_apple_rpath(_${PROJECT_NAME} ${OV_CPACK_PYTHONDIR} ${OV_CPACK_RUNTIMEDIR})
|
||||
ov_set_install_rpath(_${PROJECT_NAME} ${OV_CPACK_PYTHONDIR} ${OV_CPACK_RUNTIMEDIR})
|
||||
|
||||
# Install
|
||||
|
||||
|
@ -114,12 +114,12 @@ install(TARGETS ${PROJECT_NAME}
|
||||
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_set_install_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)
|
||||
|
||||
|
@ -45,5 +45,5 @@ function(frontend_module TARGET FRAMEWORK INSTALL_COMPONENT)
|
||||
COMPONENT ${INSTALL_COMPONENT}
|
||||
${OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL})
|
||||
|
||||
ov_set_apple_rpath(${TARGET_NAME} ${frontend_install_path} ${OV_CPACK_RUNTIMEDIR})
|
||||
ov_set_install_rpath(${TARGET_NAME} ${frontend_install_path} ${OV_CPACK_RUNTIMEDIR})
|
||||
endfunction()
|
||||
|
@ -84,9 +84,6 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
|
||||
( (DEFINED TBBROOT AND TBBROOT MATCHES ${TEMP}) OR
|
||||
(DEFINED TBBROOT OR DEFINED TBB_DIR OR DEFINED ENV{TBBROOT} OR
|
||||
DEFINED ENV{TBB_DIR}) OR ENABLE_SYSTEM_TBB ) )
|
||||
ov_cpack_add_component(tbb HIDDEN)
|
||||
list(APPEND core_components tbb)
|
||||
|
||||
if(TBBROOT MATCHES ${TEMP})
|
||||
set(tbb_downloaded ON)
|
||||
elseif(DEFINED ENV{TBBROOT} OR DEFINED ENV{TBB_DIR} OR
|
||||
@ -130,6 +127,9 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
|
||||
|
||||
set(TBB_LIB_INSTALL_DIR "runtime/3rdparty/tbb/lib" CACHE PATH "TBB library install directory" FORCE)
|
||||
elseif(tbb_custom)
|
||||
ov_cpack_add_component(tbb HIDDEN)
|
||||
list(APPEND core_components tbb)
|
||||
|
||||
# for custom TBB we need to install it to our package
|
||||
# to simplify life for our customers
|
||||
set(IE_TBBROOT_INSTALL "runtime/3rdparty/tbb")
|
||||
@ -185,21 +185,35 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
|
||||
|
||||
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")
|
||||
ov_cpack_add_component(tbb HIDDEN)
|
||||
list(APPEND core_components tbb)
|
||||
|
||||
if(WIN32)
|
||||
install(DIRECTORY "${TBBROOT}/bin"
|
||||
DESTINATION "${OV_TBB_DIR_INSTALL}"
|
||||
COMPONENT tbb)
|
||||
set(_ov_tbb_libs_path "${TBBROOT}/bin")
|
||||
else()
|
||||
install(DIRECTORY "${TBBROOT}/lib"
|
||||
DESTINATION "${OV_TBB_DIR_INSTALL}"
|
||||
COMPONENT tbb
|
||||
PATTERN "cmake" EXCLUDE)
|
||||
set(_ov_tbb_libs_path "${TBBROOT}/lib")
|
||||
set(ov_tbb_exclude PATTERN "cmake" EXCLUDE)
|
||||
endif()
|
||||
|
||||
if(CPACK_GENERATOR STREQUAL "NPM")
|
||||
# we need to install TBB libs to the same directory as other
|
||||
set(OV_TBB_DIR_INSTALL ${OV_CPACK_RUNTIMEDIR})
|
||||
# install content instead of whole directory
|
||||
set(_ov_tbb_libs_path "${_ov_tbb_libs_path}/")
|
||||
else()
|
||||
set(OV_TBB_DIR_INSTALL "runtime/3rdparty/tbb")
|
||||
endif()
|
||||
|
||||
install(DIRECTORY "${_ov_tbb_libs_path}"
|
||||
DESTINATION "${OV_TBB_DIR_INSTALL}"
|
||||
COMPONENT tbb
|
||||
${OV_CPACK_COMP_TBB_EXCLUDE_ALL}
|
||||
${ov_tbb_exclude})
|
||||
|
||||
install(FILES "${TBBROOT}/LICENSE"
|
||||
DESTINATION "${OV_TBB_DIR_INSTALL}"
|
||||
${OV_CPACK_COMP_TBB_EXCLUDE_ALL}
|
||||
RENAME "TBB-LICENSE"
|
||||
COMPONENT tbb)
|
||||
|
||||
# install development files
|
||||
@ -213,17 +227,20 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
|
||||
# oneTBB case
|
||||
install(DIRECTORY "${TBBROOT}/lib/cmake"
|
||||
DESTINATION "${OV_TBB_DIR_INSTALL}/lib"
|
||||
${OV_CPACK_COMP_TBB_DEV_EXCLUDE_ALL}
|
||||
COMPONENT tbb_dev)
|
||||
else()
|
||||
# tbb2020 case
|
||||
install(FILES "${TBBROOT}/cmake/TBBConfig.cmake"
|
||||
"${TBBROOT}/cmake/TBBConfigVersion.cmake"
|
||||
DESTINATION "${OV_TBB_DIR_INSTALL}/cmake"
|
||||
${OV_CPACK_COMP_TBB_DEV_EXCLUDE_ALL}
|
||||
COMPONENT tbb_dev)
|
||||
endif()
|
||||
|
||||
install(DIRECTORY "${TBBROOT}/include"
|
||||
DESTINATION "${OV_TBB_DIR_INSTALL}"
|
||||
${OV_CPACK_COMP_TBB_DEV_EXCLUDE_ALL}
|
||||
COMPONENT tbb_dev)
|
||||
|
||||
if(WIN32)
|
||||
@ -231,6 +248,7 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
|
||||
install(DIRECTORY "${TBBROOT}/lib"
|
||||
DESTINATION "${OV_TBB_DIR_INSTALL}"
|
||||
COMPONENT tbb_dev
|
||||
${OV_CPACK_COMP_TBB_DEV_EXCLUDE_ALL}
|
||||
PATTERN "cmake" EXCLUDE)
|
||||
endif()
|
||||
|
||||
|
@ -78,8 +78,8 @@ 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})
|
||||
# set RPATH / LC_RPATH to TBB library directory
|
||||
ov_set_install_rpath(${TARGET_NAME} ${OV_CPACK_RUNTIMEDIR} ${TBB_LIB_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
# must be called after all target_link_libraries
|
||||
|
Loading…
Reference in New Issue
Block a user