Make RPM packages compatible with wide range of RHEL systems (#20762)
This commit is contained in:
1 parent
991b9848fa
commit
b13cb8ce12
18 files changed
+157
-325
No files matched your search
@@ -108,42 +108,15 @@ endif()
|
||||
if(TARGET gflags)
|
||||
set(GFLAGS_TARGET gflags)
|
||||
elseif(gflags_required)
|
||||
if(EXISTS /etc/debian_version)
|
||||
set(gflags_component nothreads_static)
|
||||
set(GFLAGS_TARGET gflags_nothreads_static)
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags")
|
||||
add_subdirectory(thirdparty/gflags EXCLUDE_FROM_ALL)
|
||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gflags")
|
||||
# Allow running samples CMakeLists.txt as stand alone from openvino sources
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gflags"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/thirdparty/gflags" EXCLUDE_FROM_ALL)
|
||||
else()
|
||||
set(gflags_component shared)
|
||||
endif()
|
||||
find_package(gflags QUIET OPTIONAL_COMPONENTS ${gflags_component})
|
||||
if(gflags_FOUND)
|
||||
if(TARGET ${GFLAGS_TARGET})
|
||||
# nothing
|
||||
elseif(TARGET gflags_nothreads-static)
|
||||
# Debian 9: gflag_component is ignored
|
||||
set(GFLAGS_TARGET gflags_nothreads-static)
|
||||
elseif(TARGET gflags-shared)
|
||||
# gflags shared case for CentOS / RHEL / Fedora
|
||||
set(GFLAGS_TARGET gflags-shared)
|
||||
elseif(TARGET gflags::gflags)
|
||||
# gflags case for Conan
|
||||
set(GFLAGS_TARGET gflags::gflags)
|
||||
else()
|
||||
message(FATAL_ERROR "Internal error: failed to find imported target 'gflags' using '${gflags_component}' component")
|
||||
endif()
|
||||
|
||||
message(STATUS "gflags (${gflags_VERSION}) is found at ${gflags_DIR} using '${gflags_component}' component")
|
||||
endif()
|
||||
|
||||
if(NOT gflags_FOUND)
|
||||
set(GFLAGS_TARGET gflags_nothreads_static)
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags")
|
||||
add_subdirectory(thirdparty/gflags EXCLUDE_FROM_ALL)
|
||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gflags")
|
||||
# Allow running samples CMakeLists.txt as stand alone from openvino sources
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/gflags"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/thirdparty/gflags" EXCLUDE_FROM_ALL)
|
||||
else()
|
||||
message(FATAL_ERROR "Failed to find 'gflags' library using '${gflags_component}' component")
|
||||
endif()
|
||||
message(FATAL_ERROR "Failed to find 'gflags' library using '${gflags_component}' component")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -15,62 +15,20 @@ ov_add_sample(NAME ${TARGET_NAME}
|
||||
# Required nlohmann_json dependency
|
||||
|
||||
if(NOT TARGET nlohmann_json::nlohmann_json)
|
||||
find_package(PkgConfig QUIET)
|
||||
find_package(nlohmann_json QUIET
|
||||
# exception for Ubuntu 18.04, where cmake files for nlohmann_json
|
||||
# are located in a wrong directory
|
||||
HINTS /usr/lib/cmake)
|
||||
if(TARGET nlohmann_json)
|
||||
# Ubuntu 18.04 case where target 'nlohmann_json' is here, but nlohmann_json_FOUND is OFF
|
||||
if(NOT TARGET nlohmann_json::nlohmann_json)
|
||||
set_target_properties(nlohmann_json PROPERTIES IMPORTED_GLOBAL ON)
|
||||
add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json)
|
||||
endif()
|
||||
set(nlohmann_json_FOUND ON)
|
||||
endif()
|
||||
if(nlohmann_json_FOUND)
|
||||
message(STATUS "nlohmann_json (${nlohmann_json_VERSION}) is found at ${nlohmann_json_DIR}")
|
||||
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)
|
||||
# try to find header file json.hpp
|
||||
# for example, on debian 9 there is no cmake / pkgconfig files
|
||||
find_file(nlohmann_include_file
|
||||
NAMES "json.hpp"
|
||||
"Path to json.hpp (nlohmann-json-dev)")
|
||||
if(nlohmann_include_file)
|
||||
add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED)
|
||||
get_filename_component(nlohmann_include_dir "${nlohmann_include_file}" PATH)
|
||||
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_include_dir}"
|
||||
INTERFACE_COMPILE_DEFINITIONS JSON_HEADER)
|
||||
set(nlohmann_json_FOUND ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT nlohmann_json_FOUND)
|
||||
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/nlohmann_json")
|
||||
# OpenVINO package puts thirdparty to samples dir
|
||||
# suppress shadowing names warning
|
||||
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/nlohmann_json"
|
||||
"${Samples_BINARY_DIR}/thirdparty/nlohmann_json" EXCLUDE_FROM_ALL)
|
||||
elseif(EXISTS "${Samples_SOURCE_DIR}/../../thirdparty/json/nlohmann_json")
|
||||
# Allow running samples CMakeLists.txt as stand alone from openvino sources
|
||||
# suppress shadowing names warning
|
||||
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory("${Samples_SOURCE_DIR}/../../thirdparty/json/nlohmann_json"
|
||||
"${Samples_BINARY_DIR}/thirdparty/nlohmann_json" EXCLUDE_FROM_ALL)
|
||||
else()
|
||||
message(FATAL_ERROR "Failed to find / build nlohmann_json library")
|
||||
endif()
|
||||
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/nlohmann_json")
|
||||
# OpenVINO package puts thirdparty to samples dir
|
||||
# suppress shadowing names warning
|
||||
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/nlohmann_json"
|
||||
"${Samples_BINARY_DIR}/thirdparty/nlohmann_json" EXCLUDE_FROM_ALL)
|
||||
elseif(EXISTS "${Samples_SOURCE_DIR}/../../thirdparty/json/nlohmann_json")
|
||||
# Allow running samples CMakeLists.txt as stand alone from openvino sources
|
||||
# suppress shadowing names warning
|
||||
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory("${Samples_SOURCE_DIR}/../../thirdparty/json/nlohmann_json"
|
||||
"${Samples_BINARY_DIR}/thirdparty/nlohmann_json" EXCLUDE_FROM_ALL)
|
||||
else()
|
||||
message(FATAL_ERROR "Failed to find / build nlohmann_json library")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -8,22 +8,8 @@ file (GLOB HDR ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
|
||||
|
||||
# Required zlib and cnpy dependencies
|
||||
|
||||
find_package(ZLIB QUIET)
|
||||
|
||||
if(NOT TARGET ZLIB::ZLIB)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_search_module(zlib QUIET
|
||||
IMPORTED_TARGET GLOBAL
|
||||
zlib)
|
||||
if(zlib_FOUND)
|
||||
add_library(ZLIB::ZLIB ALIAS PkgConfig::zlib)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(zlib_FOUND)
|
||||
message(STATUS "${PKG_CONFIG_EXECUTABLE}: zlib (${zlib_VERSION}) is found at ${zlib_PREFIX}")
|
||||
elseif(EXISTS "${Samples_SOURCE_DIR}/thirdparty/zlib")
|
||||
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/zlib")
|
||||
# OpenVINO package puts thirdparty to samples dir
|
||||
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/zlib"
|
||||
"${Samples_BINARY_DIR}/thirdparty/zlib" EXCLUDE_FROM_ALL)
|
||||
|
||||
Reference in new issue
Block a user