Adjusted dependencies (#13942)

* Adjusted dependencies

* Fixed paths on Windows

* Move dependencies close to usage

* Updates
This commit is contained in:
Ilya Lavrenov 2022-11-14 12:57:27 +04:00 committed by GitHub
parent fce64834d2
commit 55a45a4d1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 118 additions and 81 deletions

View File

@ -14,10 +14,14 @@ macro(ov_common_libraries_cpack_set_dirs)
set(OV_CPACK_TOOLSDIR ${CMAKE_INSTALL_BINDIR}) # only C++ tools are here
set(OV_CPACK_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
set(OV_CPACK_LIBRARYDIR ${CMAKE_INSTALL_LIBDIR})
if(WIN32)
set(OV_CPACK_RUNTIMEDIR ${CMAKE_INSTALL_BINDIR})
else()
set(OV_CPACK_RUNTIMEDIR ${CMAKE_INSTALL_LIBDIR})
endif()
set(OV_WHEEL_RUNTIMEDIR ${OV_CPACK_RUNTIMEDIR})
set(OV_CPACK_ARCHIVEDIR ${CMAKE_INSTALL_LIBDIR})
set(OV_CPACK_PLUGINSDIR ${CMAKE_INSTALL_LIBDIR}/openvino-${OpenVINO_VERSION})
set(OV_CPACK_PLUGINSDIR ${OV_CPACK_RUNTIMEDIR}/openvino-${OpenVINO_VERSION})
set(OV_CPACK_IE_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/inferenceengine${OpenVINO_VERSION})
set(OV_CPACK_NGRAPH_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph${OpenVINO_VERSION})
set(OV_CPACK_OPENVINO_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/openvino${OpenVINO_VERSION})

View File

@ -14,15 +14,19 @@ function(ie_generate_dev_package_config)
endforeach()
add_custom_target(ie_dev_targets DEPENDS ${all_dev_targets})
set(PATH_VARS "OpenVINO_SOURCE_DIR")
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
list(APPEND PATH_VARS "gflags_BINARY_DIR")
# if we've found system gflags
if(gflags_DIR)
set(gflags_BINARY_DIR "${gflags_DIR}")
endif()
endif()
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig.cmake"
INSTALL_DESTINATION share # not used
PATH_VARS "OpenVINO_SOURCE_DIR;gflags_BINARY_DIR"
PATH_VARS ${PATH_VARS}
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in"
@ -47,15 +51,19 @@ function(ov_generate_dev_package_config)
endforeach()
add_custom_target(ov_dev_targets DEPENDS ${all_dev_targets})
set(PATH_VARS "OpenVINO_SOURCE_DIR")
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
list(APPEND PATH_VARS "gflags_BINARY_DIR")
# if we've found system gflags
if(gflags_DIR)
set(gflags_BINARY_DIR "${gflags_DIR}")
endif()
endif()
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in"
"${CMAKE_BINARY_DIR}/OpenVINODeveloperPackageConfig.cmake"
INSTALL_DESTINATION share # not used
PATH_VARS "OpenVINO_SOURCE_DIR;gflags_BINARY_DIR"
PATH_VARS ${PATH_VARS}
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig-version.cmake.in"

View File

@ -10,8 +10,10 @@ macro(ov_cpack_settings)
set(cpack_components_all ${CPACK_COMPONENTS_ALL})
unset(CPACK_COMPONENTS_ALL)
foreach(item IN LISTS cpack_components_all)
# filter out some components, which are not needed to be wrapped to conda-forge
if(# python wheels are not needed to be wrapped by conda | brew packages
# filter out some components, which are not needed to be wrapped to conda-forge | brew
if(# python is not a part of conda | brew
NOT item MATCHES "^${OV_CPACK_COMP_PYTHON_OPENVINO}_python.*" AND
# python wheels are not needed to be wrapped by conda | brew packages
NOT item STREQUAL OV_CPACK_COMP_PYTHON_WHEELS AND
# skip C / C++ / Python samples
NOT item STREQUAL OV_CPACK_COMP_CPP_SAMPLES AND

View File

@ -30,7 +30,9 @@ endforeach()
message(" ")
# for samples in 3rd party projects
if(ENABLE_SAMPLES)
set_and_check(gflags_DIR "@gflags_BINARY_DIR@")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Disable warning as error for private components

View File

@ -28,7 +28,9 @@ endforeach()
message(" ")
# for samples in 3rd party projects
if(ENABLE_SAMPLES)
set_and_check(gflags_DIR "@gflags_BINARY_DIR@")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Disable warning as error for private components

View File

@ -126,51 +126,6 @@ else()
set(GFLAGS_TARGET gflags)
endif()
if(NOT ANDROID)
find_package(PkgConfig QUIET)
endif()
if(NOT TARGET zlib::zlib)
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 "${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(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(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)
endif()
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/utils")
add_subdirectory(common/utils)
endif()

View File

@ -10,7 +10,36 @@ file (GLOB HDR ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
ie_add_sample(NAME ${TARGET_NAME}
SOURCES ${SRC}
HEADERS ${HDR}
DEPENDENCIES nlohmann_json::nlohmann_json format_reader ie_samples_utils)
DEPENDENCIES format_reader ie_samples_utils)
# Required nlohmann_json dependency
if(NOT ANDROID)
find_package(PkgConfig QUIET)
endif()
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(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 "${Samples_SOURCE_DIR}/thirdparty/nlohmann_json")
# 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)
endif()
endif()
target_link_libraries(${TARGET_NAME} PRIVATE nlohmann_json::nlohmann_json)
# Optional OpenCL dependnency

View File

@ -6,6 +6,37 @@ file (GLOB SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
file (GLOB HDR ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
${CMAKE_CURRENT_SOURCE_DIR}/*.h)
# Required zlib and cnpy dependencies
if(NOT ANDROID)
find_package(PkgConfig QUIET)
endif()
if(NOT TARGET zlib::zlib)
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")
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/zlib"
"${Samples_BINARY_DIR}/thirdparty/zlib" EXCLUDE_FROM_ALL)
endif()
endif()
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/cnpy")
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/cnpy"
"${Samples_BINARY_DIR}/thirdparty/cnpy" EXCLUDE_FROM_ALL)
endif()
# add sample
ie_add_sample(NAME speech_sample
SOURCES ${SRC}
HEADERS ${HDR}

View File

@ -11,7 +11,6 @@
#include <ie_plugin_config.hpp>
#include "tests_common.hpp"
#include "format_reader_ptr.h"
#include "single_layer_common.hpp"
#include "functional_test_utils/plugin_cache.hpp"

View File

@ -10,7 +10,6 @@
#include <blob_factory.hpp>
#include <ie_memcpy.h>
#include <format_reader_ptr.h>
#include <myriad_layers_tests.hpp>
#include <myriad_layers_reference_functions.hpp>

View File

@ -15,7 +15,9 @@ if(ENABLE_PROFILING_ITT)
add_subdirectory(itt_collector EXCLUDE_FROM_ALL)
endif()
if(ENABLE_SAMPLES OR ENABLE_TESTS)
add_subdirectory(cnpy EXCLUDE_FROM_ALL)
endif()
if(ENABLE_INTEL_GPU)
add_subdirectory(ocl)
@ -29,6 +31,7 @@ ov_install_static_lib(xbyak ${OV_CPACK_COMP_CORE})
# zlib
#
if(ENABLE_SAMPLES OR ENABLE_TESTS)
if(NOT ANDROID)
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
@ -45,6 +48,7 @@ endif()
if(NOT zlib_FOUND)
add_subdirectory(zlib EXCLUDE_FROM_ALL)
endif()
endif()
#
# Pugixml
@ -171,7 +175,7 @@ endif()
# Gflags
#
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL)
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
if(NOT APPLE OR CPACK_GENERATOR MATCHES "^(BREW|CONDA-FORGE)$")
# - on Apple only dynamic libraries are available
# also, we can easily mix arm64 and x86_64 binaries when cross-compile for Intel CPU
@ -297,12 +301,14 @@ ov_install_static_lib(nlohmann_json_schema_validator ${OV_CPACK_COMP_CORE})
if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW)$")
# These libraries are dependencies for openvino-samples package
if((ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL) AND NOT gflags_FOUND)
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
if(NOT gflags_FOUND)
message(FATAL_ERROR "gflags must be used as a ${CPACK_GENERATOR} package. Install libgflags-dev / gflags-devel")
endif()
if(NOT zlib_FOUND)
message(FATAL_ERROR "zlib must be used as a ${CPACK_GENERATOR} package. Install zlib1g-dev / zlib-devel")
endif()
endif()
if(NOT ENABLE_SYSTEM_PUGIXML AND NOT LINUX_OS_NAME STREQUAL "CentOS 7")
message(FATAL_ERROR "Pugixml must be used as a ${CPACK_GENERATOR} package. Install libpugixml-dev / pugixml-devel")
endif()