Added support of universal2 OSX binaries (#13093)
* Added support of universal2 OSX binaries * Fixed openvino wheel for OSX: different library name structure
This commit is contained in:
parent
939f1e77f0
commit
b6ce6f4d39
@ -119,7 +119,6 @@ function(ov_download_tbb)
|
||||
SHA256 "ad9cf52e657660058aa6c6844914bc0fc66241fec89a392d8b79a7ff69c3c7f6")
|
||||
else()
|
||||
message(WARNING "Prebuilt TBB is not available on current platform")
|
||||
return()
|
||||
endif()
|
||||
|
||||
update_deps_cache(TBBROOT "${TBB}" "Path to TBB root folder")
|
||||
|
@ -43,6 +43,8 @@ elseif(MSVC AND ARM)
|
||||
set(ARCH_FOLDER arm)
|
||||
elseif(MSVC AND AARCH64)
|
||||
set(ARCH_FOLDER arm64)
|
||||
elseif(UNIVERSAL2)
|
||||
set(ARCH_FOLDER universal2)
|
||||
endif()
|
||||
|
||||
#
|
||||
|
@ -351,10 +351,6 @@ else()
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
if(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64" AND AARCH64)
|
||||
# Disable -mcpu=native
|
||||
ie_add_compiler_flags(-Wno-error=unused-command-line-argument)
|
||||
endif()
|
||||
elseif(LINUX)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
||||
|
@ -58,6 +58,7 @@ function(ie_cpack_add_component name)
|
||||
# need to store informarion about cpack_add_component arguments in CMakeCache.txt
|
||||
# to restore it later
|
||||
set(_${name}_cpack_component_args "${ARGN}" CACHE STRING "Argument for cpack_add_component for ${name} cpack component" FORCE)
|
||||
mark_as_advanced(_${name}_cpack_component_args)
|
||||
|
||||
list(APPEND IE_CPACK_COMPONENTS_ALL ${name})
|
||||
set(IE_CPACK_COMPONENTS_ALL "${IE_CPACK_COMPONENTS_ALL}" CACHE STRING "" FORCE)
|
||||
|
@ -40,8 +40,10 @@ elseif(CMAKE_OSX_ARCHITECTURES AND APPLE)
|
||||
set(AARCH64 ON)
|
||||
elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
|
||||
set(X86_64 ON)
|
||||
elseif(CMAKE_OSX_ARCHITECTURES MATCHES ".*x86_64.*" AND CMAKE_OSX_ARCHITECTURES MATCHES ".*arm64.*")
|
||||
set(UNIVERSAL2 ON)
|
||||
else()
|
||||
message(FATAL_ERROR "Universal binaries currently are not supported: CMAKE_OSX_ARCHITECTURES = ${CMAKE_OSX_ARCHITECTURES}")
|
||||
message(FATAL_ERROR "Unsupported value: CMAKE_OSX_ARCHITECTURES = ${CMAKE_OSX_ARCHITECTURES}")
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
|
||||
set(X86_64 ON)
|
||||
@ -53,11 +55,14 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
|
||||
set(ARM ON)
|
||||
endif()
|
||||
|
||||
# in case of cross-compilation (or -m32) CMAKE_SYSTEM_PROCESSOR is equal to
|
||||
# CMAKE_HOST_SYSTEM_PROCESSOR which is X86_64; patch this until a better solution
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND X86_64)
|
||||
unset(X86_64)
|
||||
set(X86 ON)
|
||||
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
|
||||
set(HOST_X86_64 ON)
|
||||
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
|
||||
set(HOST_X86 ON)
|
||||
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*)")
|
||||
set(HOST_AARCH64 ON)
|
||||
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
|
||||
set(HOST_ARM ON)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
|
@ -97,7 +97,13 @@ ie_option (ENABLE_TEMPLATE "Enable template plugin" ON)
|
||||
|
||||
ie_dependent_option (ENABLE_INTEL_MYRIAD_COMMON "common part of myriad plugin" ON "NOT WINDOWS_PHONE;NOT WINDOWS_STORE" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_INTEL_MYRIAD "myriad targeted plugin for inference engine" ON "ENABLE_INTEL_MYRIAD_COMMON" OFF)
|
||||
if(UNIVERSAL2)
|
||||
set(ENABLE_INTEL_MYRIAD_DEFAULT OFF)
|
||||
else()
|
||||
set(ENABLE_INTEL_MYRIAD_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
ie_dependent_option (ENABLE_INTEL_MYRIAD "myriad targeted plugin for inference engine" ${ENABLE_INTEL_MYRIAD_DEFAULT} "ENABLE_INTEL_MYRIAD_COMMON" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_MYRIAD_NO_BOOT "myriad plugin will skip device boot" OFF "ENABLE_INTEL_MYRIAD" OFF)
|
||||
|
||||
@ -132,7 +138,12 @@ else()
|
||||
set(ENABLE_SYSTEM_LIBS_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
set(ENABLE_SYSTEM_TBB_DEFAULT ${ENABLE_SYSTEM_LIBS_DEFAULT})
|
||||
if(APPLE AND AARCH64)
|
||||
set(ENABLE_SYSTEM_TBB_DEFAULT ON)
|
||||
else()
|
||||
set(ENABLE_SYSTEM_TBB_DEFAULT ${ENABLE_SYSTEM_LIBS_DEFAULT})
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{TBBROOT} OR DEFINED ENV{TBB_DIR} OR DEFINED TBB_DIR OR DEFINED TBBROOT)
|
||||
set(ENABLE_SYSTEM_TBB_DEFAULT OFF)
|
||||
endif()
|
||||
@ -140,7 +151,7 @@ endif()
|
||||
# for static libraries case libpugixml.a must be compiled with -fPIC
|
||||
ie_dependent_option (ENABLE_SYSTEM_PUGIXML "use the system copy of pugixml" ${ENABLE_SYSTEM_LIBS_DEFAULT} "BUILD_SHARED_LIBS" OFF)
|
||||
|
||||
ie_dependent_option (ENABLE_SYSTEM_TBB "use the system version of TBB" ${ENABLE_SYSTEM_TBB_DEFAULT} "THREADING MATCHES TBB;LINUX" OFF)
|
||||
ie_dependent_option (ENABLE_SYSTEM_TBB "use the system version of TBB" ${ENABLE_SYSTEM_TBB_DEFAULT} "THREADING MATCHES TBB" OFF)
|
||||
|
||||
ie_option (ENABLE_DEBUG_CAPS "enable OpenVINO debug capabilities at runtime" OFF)
|
||||
|
||||
|
@ -11,9 +11,9 @@ if(ENABLE_OV_ONNX_FRONTEND)
|
||||
else()
|
||||
# if requirements are not installed automatically, we need to checks whether they are here
|
||||
ov_check_pip_packages(REQUIREMENTS_FILE "${OpenVINO_SOURCE_DIR}/src/frontends/onnx/tests/requirements.txt"
|
||||
RESULT_VAR onnx_FOUND
|
||||
WARNING_MESSAGE "ONNX frontend tests will be skipped"
|
||||
MESSAGE_MODE WARNING)
|
||||
RESULT_VAR onnx_FOUND
|
||||
WARNING_MESSAGE "ONNX frontend tests will be skipped"
|
||||
MESSAGE_MODE WARNING)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -16,7 +16,8 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
if (NOT BIN_FOLDER)
|
||||
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} ARCH)
|
||||
if(ARCH STREQUAL "x86_64" OR ARCH STREQUAL "amd64") # Windows detects Intel's 64-bit CPU as AMD64
|
||||
if(ARCH STREQUAL "x86_64" OR ARCH STREQUAL "amd64" # Windows detects Intel's 64-bit CPU as AMD64
|
||||
OR CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
|
||||
set(ARCH intel64)
|
||||
elseif(ARCH STREQUAL "i386")
|
||||
set(ARCH ia32)
|
||||
@ -110,6 +111,7 @@ endif()
|
||||
if(NOT TARGET gflags)
|
||||
if(NOT APPLE)
|
||||
# on Apple only dynamic libraries are available
|
||||
# also, we can easily mix arm64 and x86_64 binaries when cross-compile for Intel CPU
|
||||
find_package(gflags QUIET COMPONENTS nothreads_static)
|
||||
endif()
|
||||
|
||||
@ -120,17 +122,17 @@ if(NOT TARGET gflags)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ANDROID)
|
||||
find_package(PkgConfig QUIET)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET zlib::zlib)
|
||||
if(NOT ANDROID)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_search_module(zlib QUIET
|
||||
IMPORTED_TARGET
|
||||
zlib)
|
||||
if(zlib_FOUND)
|
||||
set_target_properties(PkgConfig::zlib PROPERTIES IMPORTED_GLOBAL ON)
|
||||
add_library(zlib::zlib ALIAS PkgConfig::zlib)
|
||||
endif()
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_search_module(zlib QUIET
|
||||
IMPORTED_TARGET GLOBAL
|
||||
zlib)
|
||||
if(zlib_FOUND)
|
||||
add_library(zlib::zlib ALIAS PkgConfig::zlib)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -149,7 +151,16 @@ if(NOT TARGET nlohmann_json::nlohmann_json)
|
||||
find_package(nlohmann_json QUIET)
|
||||
if(nlohmann_json_FOUND)
|
||||
message(STATUS "nlohmann_json (${nlohmann_json_VERSION}) is found at ${nlohmann_json_DIR}")
|
||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nlohmann_json")
|
||||
elseif(PkgConfig_FOUND)
|
||||
pkg_search_module(nlohmann_json QUIET
|
||||
IMPORTED_TARGET GLOBAL
|
||||
nlohmann_json)
|
||||
if(nlohmann_json_FOUND)
|
||||
add_library(nlohmann_json::nlohmann_json ALIAS PkgConfig::nlohmann_json)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT nlohmann_json_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nlohmann_json")
|
||||
# suppress shadowing names warning
|
||||
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(thirdparty/nlohmann_json EXCLUDE_FROM_ALL)
|
||||
|
@ -112,7 +112,7 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
|
||||
# grab all tbb files matching pattern
|
||||
file(GLOB tbb_files "${dir}/${name_we}.*")
|
||||
foreach(tbb_file IN LISTS tbb_files)
|
||||
if(tbb_file MATCHES "^.*\.${CMAKE_SHARED_LIBRARY_SUFFIX}(\.[0-9]+)+$")
|
||||
if(tbb_file MATCHES "^.*\.${CMAKE_SHARED_LIBRARY_SUFFIX}(\.[0-9]+)*$")
|
||||
# since the setup.py for pip installs tbb component
|
||||
# explicitly, it's OK to put EXCLUDE_FROM_ALL to such component
|
||||
# to ignore from IRC / apt / yum distribution;
|
||||
|
@ -248,7 +248,6 @@ if(ENABLE_PKGCONFIG_GEN)
|
||||
|
||||
add_custom_command(TARGET openvino PRE_BUILD
|
||||
COMMAND "${PKG_CONFIG_EXECUTABLE}" --validate "${pkgconfig_out}"
|
||||
COMMAND cat "${pkgconfig_out}"
|
||||
COMMENT "[pkg-config] validating openvino.pc"
|
||||
VERBATIM)
|
||||
endif()
|
||||
|
@ -49,10 +49,11 @@ function(ie_add_onednn)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override")
|
||||
endif()
|
||||
if(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
|
||||
ie_add_compiler_flags(-Wno-undef)
|
||||
set(DNNL_TARGET_ARCH "X64")
|
||||
elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
||||
set(DNNL_TARGET_ARCH "AARCH64")
|
||||
endif()
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
|
||||
ie_add_compiler_flags(-Wno-undef)
|
||||
ie_add_compiler_flags(-Wno-missing-declarations)
|
||||
elseif(UNIX AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
|
@ -212,7 +212,7 @@ std::map<std::string, uint64_t> engine::get_memory_statistics() const {
|
||||
return statistics;
|
||||
}
|
||||
|
||||
void engine::add_memory_used(size_t bytes, allocation_type type) {
|
||||
void engine::add_memory_used(uint64_t bytes, allocation_type type) {
|
||||
std::lock_guard<std::mutex> guard(_mutex);
|
||||
if (!_memory_usage_map.count(type) && !_peak_memory_usage_map.count(type)) {
|
||||
_memory_usage_map[type] = 0;
|
||||
@ -224,7 +224,7 @@ void engine::add_memory_used(size_t bytes, allocation_type type) {
|
||||
}
|
||||
}
|
||||
|
||||
void engine::subtract_memory_used(size_t bytes, allocation_type type) {
|
||||
void engine::subtract_memory_used(uint64_t bytes, allocation_type type) {
|
||||
std::lock_guard<std::mutex> guard(_mutex);
|
||||
auto iter = _memory_usage_map.find(type);
|
||||
if (iter != _memory_usage_map.end()) {
|
||||
|
10
thirdparty/CMakeLists.txt
vendored
10
thirdparty/CMakeLists.txt
vendored
@ -92,8 +92,14 @@ if(ENABLE_SYSTEM_PUGIXML)
|
||||
get_target_property(imported_config ${pugixml_target} IMPORTED_CONFIGURATIONS)
|
||||
get_target_property(pugixml_loc ${pugixml_target} IMPORTED_LOCATION_${imported_config})
|
||||
get_filename_component(pugixml_dir "${pugixml_loc}" DIRECTORY)
|
||||
get_target_property(pugixml_soname_loc ${pugixml_target} IMPORTED_SONAME_${imported_config})
|
||||
set(pugixml_libs "${pugixml_loc}" "${pugixml_dir}/${pugixml_soname_loc}")
|
||||
get_filename_component(name_we "${pugixml_loc}" NAME_WE)
|
||||
# grab all tbb files matching pattern
|
||||
file(GLOB pugixml_files "${pugixml_dir}/${name_we}.*")
|
||||
foreach(pugixml_file IN LISTS pugixml_files)
|
||||
if(pugixml_file MATCHES "^.*\.${CMAKE_SHARED_LIBRARY_SUFFIX}(\.[0-9]+)*$")
|
||||
list(APPEND pugixml_libs "${pugixml_file}")
|
||||
endif()
|
||||
endforeach()
|
||||
elseif(target_type STREQUAL "INTERFACE_LIBRARY")
|
||||
get_target_property(pugixml_loc ${pugixml_target} INTERFACE_LINK_LIBRARIES)
|
||||
file(GLOB pugixml_libs_all "${pugixml_loc}.*")
|
||||
|
5
thirdparty/protobuf/CMakeLists.txt
vendored
5
thirdparty/protobuf/CMakeLists.txt
vendored
@ -26,9 +26,8 @@ set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE)
|
||||
set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
|
||||
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support" FORCE)
|
||||
|
||||
if(CMAKE_CROSSCOMPILING OR
|
||||
(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64" AND AARCH64) OR
|
||||
(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64" AND X86_64))
|
||||
# note: HOST_AARCH64 AND X86_64 are not handled for Apple explicitly, becuase it can work via Rosetta
|
||||
if(CMAKE_CROSSCOMPILING OR (APPLE AND (HOST_X86_64 AND AARCH64)) )
|
||||
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "Build protoc binaries" FORCE)
|
||||
else()
|
||||
set(protobuf_BUILD_PROTOC_BINARIES ON CACHE BOOL "Build protoc binaries" FORCE)
|
||||
|
Loading…
Reference in New Issue
Block a user