Added python suffix to cython-based libraries (#12862)

* Fixed dependencies in case of debian package building

* Removed duplication of cython-based libraries in wheel

* Fixed that TBB is not part of the wheel

* Fixes for yocto
This commit is contained in:
Ilya Lavrenov 2022-09-02 19:33:21 +04:00 committed by GitHub
parent e2e01bff32
commit 142cfd173a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 22 deletions

View File

@ -159,12 +159,6 @@ ie_dependent_option(ENABLE_WHEEL "Build wheel packages for PyPI" ${ENABLE_WHEEL_
# Build the code
#
if(ie_python_req_FOUND)
add_subdirectory(src/compatibility/openvino)
else()
message(WARNING "NOTE: Python API for OpenVINO 1.0 is disabled")
endif()
if(DISABLE_PYBIND11)
message(WARNING "NOTE: Python API for OpenVINO 2.0 is disabled")
else()
@ -173,6 +167,12 @@ else()
add_subdirectory(src/pyopenvino)
endif()
if(ie_python_req_FOUND)
add_subdirectory(src/compatibility/openvino)
else()
message(WARNING "NOTE: Python API for OpenVINO 1.0 is disabled")
endif()
if(ENABLE_WHEEL)
add_subdirectory(wheel)
endif()

View File

@ -287,7 +287,11 @@ function( cython_add_module _name )
compile_pyx( ${_name} generated_file ${pyx_module_sources} )
include_directories( ${PYTHON_INCLUDE_DIRS} )
python_add_module ( ${_name} ${generated_file} ${other_module_sources} )
# set_target_properties(${_name} PROPERTIES PREFIX "" SUFFIX "${PYTHON_MODULE_EXTENSION}")
if(PYTHON_MODULE_EXTENSION)
set_target_properties(${_name} PROPERTIES PREFIX "" SUFFIX "${PYTHON_MODULE_EXTENSION}")
elseif(NOT CMAKE_CROSSCOMPILING)
message(FATAL_ERROR "Internal error: PYTHON_MODULE_EXTENSION is not defined")
endif()
if( APPLE )
set_target_properties( ${_name} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
else()

View File

@ -22,7 +22,7 @@ set(PUGIXML_LIBS_DIR runtime/3rdparty/pugixml/lib)
# Dependencies
#
foreach(_target ie_api constants _pyngraph pyopenvino ov_plugins ov_frontends py_ov_frontends)
foreach(_target ie_api constants _pyngraph openvino_c pyopenvino ov_plugins ov_frontends py_ov_frontends)
if(TARGET ${_target})
list(APPEND openvino_wheel_deps ${_target})
endif()

View File

@ -7,24 +7,22 @@ include(cmake/ie_parallel.cmake)
# pre-find TBB: need to provide TBB_IMPORTED_TARGETS used for installation
ov_find_package_tbb()
function(_ov_get_tbb_library_path tbb_lib tbb_libs_dir)
function(_ov_get_tbb_location tbb_target _tbb_lib_location_var)
if(NOT TBB_FOUND)
return()
endif()
# i.e. yocto case
get_target_property(_tbb_lib_location ${tbb_lib} INTERFACE_LINK_LIBRARIES)
get_target_property(_tbb_lib_location ${tbb_target} INTERFACE_LINK_LIBRARIES)
if(_tbb_lib_location)
get_filename_component(_tbb_libs_dir "${_tbb_lib_location}" DIRECTORY)
set(${tbb_libs_dir} "${_tbb_libs_dir}" PARENT_SCOPE)
set(${_tbb_lib_location_var} "${_tbb_lib_location}" PARENT_SCOPE)
return()
endif()
endif()
# usual imported library
get_target_property(_tbb_lib_location ${tbb_lib} IMPORTED_LOCATION_RELEASE)
get_target_property(_tbb_lib_location ${tbb_target} IMPORTED_LOCATION_RELEASE)
if(_tbb_lib_location)
get_filename_component(_tbb_libs_dir "${_tbb_lib_location}" DIRECTORY)
set(${tbb_libs_dir} "${_tbb_libs_dir}" PARENT_SCOPE)
set(${_tbb_lib_location_var} "${_tbb_lib_location}" PARENT_SCOPE)
return()
endif()
@ -39,7 +37,8 @@ function(_ov_detect_dynamic_tbbbind_2_5 var)
endif()
# try to select proper library directory
_ov_get_tbb_library_path(TBB::tbb _tbb_libs_dir)
_ov_get_tbb_location(TBB::tbb _tbb_lib_location)
get_filename_component(_tbb_libs_dir "${_tbb_lib_location}" DIRECTORY)
# unset for cases if user specified different TBB_DIR / TBBROOT
unset(_ov_tbbbind_2_5 CACHE)
@ -125,14 +124,14 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
# for system libraries we still need to install TBB libraries
# so, need to take locations of actual libraries and install them
foreach(tbb_lib IN LISTS TBB_IMPORTED_TARGETS)
_ov_get_tbb_library_path(${tbb_lib} tbb_loc)
# depending on the TBB, tbb_loc can be in form:
foreach(tbb_target IN LISTS TBB_IMPORTED_TARGETS)
_ov_get_tbb_location(${tbb_target} tbb_lib_location)
# depending on the TBB, tbb_lib_location can be in form:
# - libtbb.so.x.y
# - libtbb.so.x
# We need to install such files
get_filename_component(name_we "${tbb_loc}" NAME_WE)
get_filename_component(dir "${tbb_loc}" DIRECTORY)
get_filename_component(name_we "${tbb_lib_location}" NAME_WE)
get_filename_component(dir "${tbb_lib_location}" DIRECTORY)
# grab all tbb files matching pattern
file(GLOB tbb_files "${dir}/${name_we}.*")
foreach(tbb_file IN LISTS tbb_files)