Conda-forge fixes (#13392)

This commit is contained in:
Ilya Lavrenov
2022-10-12 12:16:13 +04:00
committed by GitHub
parent ea3ac0d335
commit c2911adf94
59 changed files with 572 additions and 335 deletions

View File

@@ -82,12 +82,6 @@ if(ARM AND NOT CMAKE_CROSSCOMPILING)
add_compile_options(-march=armv7-a)
endif()
if(NOT COMMAND find_host_package)
macro(find_host_package)
find_package(${ARGN})
endmacro()
endif()
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
@@ -104,18 +98,29 @@ endif()
####################################
if(NOT TARGET gflags)
if(NOT APPLE AND NOT DEFINED ENV{CONDA_PREFIX})
# - conda-forge contains only dynamic libraries
# - on Apple only dynamic libraries are available
# also, we can easily mix arm64 and x86_64 binaries when cross-compile for Intel CPU
if(APPLE OR DEFINED ENV{CONDA_PREFIX} OR DEFINED ENV{HOMEBREW_PREFIX})
# conda-forge and brew contains only shared version of gflags
find_package(gflags QUIET COMPONENTS nothreads_shared)
else()
find_package(gflags QUIET COMPONENTS nothreads_static)
endif()
if(gflags_FOUND)
if(NOT TARGET ${GFLAGS_TARGET})
if(TARGET gflags_nothreads-static)
# arm cross-compilation
set(GFLAGS_TARGET gflags_nothreads-static)
else()
message(FATAL_ERROR "Failed to set GFLAGS_TARGET target")
endif()
endif()
message(STATUS "gflags (${gflags_VERSION}) is found at ${gflags_DIR}")
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags")
add_subdirectory(thirdparty/gflags EXCLUDE_FROM_ALL)
set(GFLAGS_TARGET gflags_nothreads_static)
endif()
else()
set(GFLAGS_TARGET gflags)
endif()
if(NOT ANDROID)
@@ -255,7 +260,7 @@ macro(ie_add_sample)
target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${ov_link_libraries} Threads::Threads ${IE_SAMPLE_DEPENDENCIES})
if(NOT c_sample)
target_link_libraries(${IE_SAMPLE_NAME} PRIVATE gflags)
target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${GFLAGS_TARGET})
endif()
install(TARGETS ${IE_SAMPLE_NAME}