Made OpenVINO cmake scripts Linux flavors agnostic (#14384)

* Use prebuilt cmake in install-dependencies steps

* Removed building of custom python to save Azure CI time

* Adjusted conditions in cmake

* Download VPU custom kernels compiler only for x86

* Removed -pyver argument

* Improvements

* Detect glibc version

* Usage of new glic variable

* Fixed typo

* Increased glibc version for MYRIAD case

* Made OpenVINO cmake Linux flavors agnostic

* Detect glibc version on RedHat

* Use clcompiler only since ubuntu 18.04

* Universal way to detect glibc version

* Revert some changes

* Apply suggestions from code review

fixes issue with GNA

* Apply suggestions from code review

fixed typo
This commit is contained in:
Ilya Lavrenov
2022-12-04 22:55:52 +04:00
committed by GitHub
parent 3caebffa5c
commit 6dd8a93735
20 changed files with 128 additions and 87 deletions

View File

@@ -37,7 +37,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/wd4244)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-deprecated-register -Wno-range-loop-analysis)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
elseif(OV_COMPILER_IS_APPLECLANG)
add_link_options(-stdlib=libc++)
add_compile_options(-Wno-unused-value -Wno-range-loop-analysis)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

View File

@@ -32,7 +32,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options(/wd4244)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-deprecated-register -Wno-range-loop-analysis)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
elseif(OV_COMPILER_IS_APPLECLANG)
add_link_options(-stdlib=libc++)
add_compile_options(-Wno-unused-value -Wno-range-loop-analysis)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
@@ -40,7 +40,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-error=attributes)
endif()
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
# for proper fix need to update pybind to version which does not use PyEval_InitThreads()
add_compile_options(-Wno-deprecated-declarations -Wno-undef)
endif()

View File

@@ -79,6 +79,10 @@ macro(_ov_platform_arch)
set(_arch "x86_64")
elseif(X86)
set(_arch "i686")
elseif(RISCV64)
set(_arch "riscv64")
else()
message(FATAL_ERROR "Unknown architecture: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
endmacro()
@@ -100,23 +104,12 @@ if(APPLE AND DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
elseif(LINUX)
_ov_platform_arch()
execute_process(COMMAND ldd --version
OUTPUT_VARIABLE _libc_version
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(_libc_version MATCHES ".*([0-9]+)\\.([0-9]+).*")
set(_libc_major "${CMAKE_MATCH_1}")
set(_libc_minor "${CMAKE_MATCH_2}")
endif()
# common pattern manylinux_<libc major>_<libc minor>_<arch>
if(_libc_major AND _libc_minor AND _arch)
if(CMAKE_CROSSCOMPILING)
# TODO: think which proper tag is needed for arm / aarch64
set(PLATFORM_TAG "linux_${_arch}")
else()
set(PLATFORM_TAG "manylinux_${_libc_major}_${_libc_minor}_${_arch}")
endif()
if(CMAKE_CROSSCOMPILING)
# TODO: think which proper tag is needed for arm / aarch64
set(PLATFORM_TAG "linux_${_arch}")
else()
string(REPLACE "." "_" _ov_glibc_version "${OV_GLIBC_VERSION}")
set(PLATFORM_TAG "manylinux_${_ov_glibc_version}_${_arch}")
endif()
endif()