Use system gflags only in samples (#18478)
This commit is contained in:
parent
3daa387692
commit
bca3f3e441
@ -147,6 +147,7 @@ jobs:
|
|||||||
- script: |
|
- script: |
|
||||||
git submodule update --init -- $(OPENVINO_REPO_DIR)/src/plugins
|
git submodule update --init -- $(OPENVINO_REPO_DIR)/src/plugins
|
||||||
git submodule update --init -- $(OPENVINO_REPO_DIR)/thirdparty/gtest
|
git submodule update --init -- $(OPENVINO_REPO_DIR)/thirdparty/gtest
|
||||||
|
git submodule update --init -- $(OPENVINO_REPO_DIR)/thirdparty/gflags
|
||||||
git submodule update --init -- $(OPENVINO_REPO_DIR)/thirdparty/open_model_zoo
|
git submodule update --init -- $(OPENVINO_REPO_DIR)/thirdparty/open_model_zoo
|
||||||
displayName: 'Init submodules for non Conan dependencies'
|
displayName: 'Init submodules for non Conan dependencies'
|
||||||
|
|
||||||
|
@ -100,12 +100,11 @@ endif()
|
|||||||
if(TARGET gflags)
|
if(TARGET gflags)
|
||||||
set(GFLAGS_TARGET gflags)
|
set(GFLAGS_TARGET gflags)
|
||||||
elseif(gflags_required)
|
elseif(gflags_required)
|
||||||
if(EXISTS /etc/debian_version)
|
set(GFLAGS_USE_TARGET_NAMESPACE ON)
|
||||||
set(gflags_component nothreads_static)
|
set(GFLAGS_SHARED OFF)
|
||||||
else()
|
set(GFLAGS_NOTHREADS ON)
|
||||||
set(gflags_component shared)
|
|
||||||
endif()
|
find_package(gflags QUIET)
|
||||||
find_package(gflags QUIET OPTIONAL_COMPONENTS ${gflags_component})
|
|
||||||
if(gflags_FOUND)
|
if(gflags_FOUND)
|
||||||
if(TARGET ${GFLAGS_TARGET})
|
if(TARGET ${GFLAGS_TARGET})
|
||||||
# nothing
|
# nothing
|
||||||
|
52
thirdparty/dependencies.cmake
vendored
52
thirdparty/dependencies.cmake
vendored
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg" OR DEFINED VCPKG_VERBOSE)
|
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg" OR DEFINED VCPKG_VERBOSE)
|
||||||
set(OV_VCPKG_BUILD ON)
|
set(OV_VCPKG_BUILD ON)
|
||||||
elseif(CMAKE_TOOLCHAIN_FILE MATCHES "conan_toolchain" OR DEFINED CONAN_EXPORTED)
|
|
||||||
set(OV_CONAN_BUILD)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(_old_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
set(_old_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
@ -369,51 +367,8 @@ endif()
|
|||||||
#
|
#
|
||||||
|
|
||||||
if(ENABLE_SAMPLES OR ENABLE_TESTS)
|
if(ENABLE_SAMPLES OR ENABLE_TESTS)
|
||||||
if(OV_VCPKG_BUILD OR OV_CONAN_BUILD)
|
add_subdirectory(thirdparty/gflags EXCLUDE_FROM_ALL)
|
||||||
# vcpkg contains only libs compiled with threads
|
openvino_developer_export_targets(COMPONENT openvino_common TARGETS gflags)
|
||||||
# conan case
|
|
||||||
find_package(gflags QUIET)
|
|
||||||
elseif(APPLE OR WIN32)
|
|
||||||
# on Windows and macOS we don't use gflags, because will be dynamically linked
|
|
||||||
elseif(CMAKE_HOST_LINUX AND LINUX)
|
|
||||||
if(OV_OS_RHEL)
|
|
||||||
set(gflag_component nothreads_shared)
|
|
||||||
elseif(OV_OS_DEBIAN)
|
|
||||||
set(gflag_component nothreads_static)
|
|
||||||
endif()
|
|
||||||
find_package(gflags QUIET OPTIONAL_COMPONENTS ${gflag_component})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(gflags_FOUND)
|
|
||||||
if(TARGET gflags)
|
|
||||||
# no extra steps
|
|
||||||
elseif(TARGET gflags_nothreads-static)
|
|
||||||
# Debian 9: gflag_component is ignored
|
|
||||||
set(gflags_target gflags_nothreads-static)
|
|
||||||
elseif(TARGET gflags_nothreads-shared)
|
|
||||||
# CentOS / RHEL / Fedora case
|
|
||||||
set(gflags_target gflags_nothreads-shared)
|
|
||||||
elseif(TARGET ${GFLAGS_TARGET})
|
|
||||||
set(gflags_target ${GFLAGS_TARGET})
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Internal error: failed to find imported target 'gflags' using '${gflag_component}' component")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(gflags_target)
|
|
||||||
if(OV_PkgConfig_VISILITY)
|
|
||||||
# need to set GLOBAL visibility in order to create ALIAS for this target
|
|
||||||
set_target_properties(${gflags_target} PROPERTIES IMPORTED_GLOBAL ON)
|
|
||||||
endif()
|
|
||||||
add_library(gflags ALIAS ${gflags_target})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "gflags (${gflags_VERSION}) is found at ${gflags_DIR} using '${gflag_component}' component")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT TARGET gflags)
|
|
||||||
add_subdirectory(thirdparty/gflags EXCLUDE_FROM_ALL)
|
|
||||||
openvino_developer_export_targets(COMPONENT openvino_common TARGETS gflags)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -635,9 +590,6 @@ endif()
|
|||||||
if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW|CONAN|VCPKG)$")
|
if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW|CONAN|VCPKG)$")
|
||||||
# These libraries are dependencies for openvino-samples package
|
# These libraries are dependencies for openvino-samples package
|
||||||
if(ENABLE_SAMPLES OR ENABLE_TESTS)
|
if(ENABLE_SAMPLES OR ENABLE_TESTS)
|
||||||
if(NOT gflags_FOUND AND CPACK_GENERATOR MATCHES "^(DEB|RPM)$")
|
|
||||||
message(FATAL_ERROR "gflags must be used as a ${CPACK_GENERATOR} package. Install libgflags-dev / gflags-devel")
|
|
||||||
endif()
|
|
||||||
if(NOT (zlib_FOUND OR ZLIB_FOUND))
|
if(NOT (zlib_FOUND OR ZLIB_FOUND))
|
||||||
message(FATAL_ERROR "zlib must be used as a ${CPACK_GENERATOR} package. Install zlib1g-dev / zlib-devel")
|
message(FATAL_ERROR "zlib must be used as a ${CPACK_GENERATOR} package. Install zlib1g-dev / zlib-devel")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user