Use system dependencies (#11419)
* Try to improve gflags * Try to improve gflags: part 2 * Tried to use dependencies on system * Use nlohmann_jsonConfig from system * Enabled nlohmann_json from system * Improvements * handle system gflags in developer package * Simplifications * Simplify dependency management * Corrected package names * Fixed subgraphsDumper configure stage * Try to fix rhel8 * Try to fix macosx * Fixed VPUX build * Fixed aliasing issues * Suppress some wanrings * export gflags when build it * Fixed some LTO * Try to fix Mac * revert * use gflags as private dependency * Aligned targets in developer package * Fixed frontends tests build on U20 with LTO * PAssed * Don't use pkg_search_module(zlib ..) during cross-compilation * Removed unused variables * Fixed finding of zlib during cross-compilation
This commit is contained in:
@@ -91,6 +91,12 @@ 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)
|
||||
@@ -106,21 +112,48 @@ if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
endif()
|
||||
####################################
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags" AND
|
||||
NOT DEFINED OpenVINO_SOURCE_DIR)
|
||||
add_subdirectory(thirdparty/gflags EXCLUDE_FROM_ALL)
|
||||
if(NOT TARGET gflags)
|
||||
find_package(gflags QUIET COMPONENTS nothreads_shared)
|
||||
|
||||
if(gflags_FOUND)
|
||||
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)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib")
|
||||
add_subdirectory(thirdparty/zlib EXCLUDE_FROM_ALL)
|
||||
if(NOT TARGET zlib::zlib)
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
find_host_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()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(zlib_FOUND)
|
||||
message(STATUS "zlib (${zlib_VERSION}) is found at ${zlib_PREFIX}")
|
||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib")
|
||||
add_subdirectory(thirdparty/zlib EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cnpy")
|
||||
add_subdirectory(thirdparty/cnpy EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json")
|
||||
add_subdirectory(thirdparty/json EXCLUDE_FROM_ALL)
|
||||
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/json")
|
||||
add_subdirectory(thirdparty/json EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/utils")
|
||||
@@ -215,12 +248,10 @@ macro(ie_add_sample)
|
||||
target_link_libraries(${IE_SAMPLE_NAME} PRIVATE gflags)
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS ${IE_SAMPLE_NAME}
|
||||
RUNTIME DESTINATION samples_bin/
|
||||
COMPONENT samples_bin
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
install(TARGETS ${IE_SAMPLE_NAME}
|
||||
RUNTIME DESTINATION samples_bin/
|
||||
COMPONENT samples_bin
|
||||
EXCLUDE_FROM_ALL)
|
||||
|
||||
# create global target with all samples / demo apps
|
||||
if(NOT TARGET ie_samples)
|
||||
|
||||
@@ -10,7 +10,7 @@ file (GLOB HDR ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
|
||||
ie_add_sample(NAME ${TARGET_NAME}
|
||||
SOURCES ${SRC}
|
||||
HEADERS ${HDR}
|
||||
DEPENDENCIES nlohmann_json format_reader ie_samples_utils)
|
||||
DEPENDENCIES nlohmann_json::nlohmann_json format_reader ie_samples_utils)
|
||||
|
||||
# Optional OpenCL dependnency
|
||||
|
||||
@@ -63,7 +63,6 @@ endif()
|
||||
find_package(OpenCV COMPONENTS core QUIET)
|
||||
if(NOT OpenCV_FOUND)
|
||||
message(WARNING "OpenCV is disabled or not found, ${TARGET_NAME} will be built without OpenCV support. Set OpenCV_DIR")
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE nlohmann_json_schema_validator)
|
||||
else()
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE USE_OPENCV)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE opencv_core)
|
||||
|
||||
@@ -14,7 +14,7 @@ target_include_directories(${TARGET_NAME}
|
||||
|
||||
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime gflags)
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime PRIVATE gflags)
|
||||
|
||||
if(COMMAND add_clang_format_target)
|
||||
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
|
||||
|
||||
Reference in New Issue
Block a user