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_TOOLSDIR ${CMAKE_INSTALL_BINDIR}) # only C++ tools are here
set(OV_CPACK_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}) set(OV_CPACK_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
set(OV_CPACK_LIBRARYDIR ${CMAKE_INSTALL_LIBDIR}) set(OV_CPACK_LIBRARYDIR ${CMAKE_INSTALL_LIBDIR})
set(OV_CPACK_RUNTIMEDIR ${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_WHEEL_RUNTIMEDIR ${OV_CPACK_RUNTIMEDIR})
set(OV_CPACK_ARCHIVEDIR ${CMAKE_INSTALL_LIBDIR}) 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_IE_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/inferenceengine${OpenVINO_VERSION})
set(OV_CPACK_NGRAPH_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph${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}) 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() endforeach()
add_custom_target(ie_dev_targets DEPENDS ${all_dev_targets}) add_custom_target(ie_dev_targets DEPENDS ${all_dev_targets})
# if we've found system gflags set(PATH_VARS "OpenVINO_SOURCE_DIR")
if(gflags_DIR) if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
set(gflags_BINARY_DIR "${gflags_DIR}") list(APPEND PATH_VARS "gflags_BINARY_DIR")
# if we've found system gflags
if(gflags_DIR)
set(gflags_BINARY_DIR "${gflags_DIR}")
endif()
endif() endif()
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in" configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig.cmake" "${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig.cmake"
INSTALL_DESTINATION share # not used INSTALL_DESTINATION share # not used
PATH_VARS "OpenVINO_SOURCE_DIR;gflags_BINARY_DIR" PATH_VARS ${PATH_VARS}
NO_CHECK_REQUIRED_COMPONENTS_MACRO) NO_CHECK_REQUIRED_COMPONENTS_MACRO)
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in" configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in"
@ -47,15 +51,19 @@ function(ov_generate_dev_package_config)
endforeach() endforeach()
add_custom_target(ov_dev_targets DEPENDS ${all_dev_targets}) add_custom_target(ov_dev_targets DEPENDS ${all_dev_targets})
# if we've found system gflags set(PATH_VARS "OpenVINO_SOURCE_DIR")
if(gflags_DIR) if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
set(gflags_BINARY_DIR "${gflags_DIR}") list(APPEND PATH_VARS "gflags_BINARY_DIR")
# if we've found system gflags
if(gflags_DIR)
set(gflags_BINARY_DIR "${gflags_DIR}")
endif()
endif() endif()
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in" configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINODeveloperPackageConfig.cmake.in"
"${CMAKE_BINARY_DIR}/OpenVINODeveloperPackageConfig.cmake" "${CMAKE_BINARY_DIR}/OpenVINODeveloperPackageConfig.cmake"
INSTALL_DESTINATION share # not used INSTALL_DESTINATION share # not used
PATH_VARS "OpenVINO_SOURCE_DIR;gflags_BINARY_DIR" PATH_VARS ${PATH_VARS}
NO_CHECK_REQUIRED_COMPONENTS_MACRO) NO_CHECK_REQUIRED_COMPONENTS_MACRO)
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig-version.cmake.in" 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}) set(cpack_components_all ${CPACK_COMPONENTS_ALL})
unset(CPACK_COMPONENTS_ALL) unset(CPACK_COMPONENTS_ALL)
foreach(item IN LISTS cpack_components_all) foreach(item IN LISTS cpack_components_all)
# filter out some components, which are not needed to be wrapped to conda-forge # filter out some components, which are not needed to be wrapped to conda-forge | brew
if(# python wheels are not needed to be wrapped by conda | brew packages 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 NOT item STREQUAL OV_CPACK_COMP_PYTHON_WHEELS AND
# skip C / C++ / Python samples # skip C / C++ / Python samples
NOT item STREQUAL OV_CPACK_COMP_CPP_SAMPLES AND NOT item STREQUAL OV_CPACK_COMP_CPP_SAMPLES AND

View File

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

View File

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

View File

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

View File

@ -10,7 +10,36 @@ file (GLOB HDR ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
ie_add_sample(NAME ${TARGET_NAME} ie_add_sample(NAME ${TARGET_NAME}
SOURCES ${SRC} SOURCES ${SRC}
HEADERS ${HDR} 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 # 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) file (GLOB HDR ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
${CMAKE_CURRENT_SOURCE_DIR}/*.h) ${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 ie_add_sample(NAME speech_sample
SOURCES ${SRC} SOURCES ${SRC}
HEADERS ${HDR} HEADERS ${HDR}

View File

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

View File

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

View File

@ -15,7 +15,9 @@ if(ENABLE_PROFILING_ITT)
add_subdirectory(itt_collector EXCLUDE_FROM_ALL) add_subdirectory(itt_collector EXCLUDE_FROM_ALL)
endif() endif()
add_subdirectory(cnpy EXCLUDE_FROM_ALL) if(ENABLE_SAMPLES OR ENABLE_TESTS)
add_subdirectory(cnpy EXCLUDE_FROM_ALL)
endif()
if(ENABLE_INTEL_GPU) if(ENABLE_INTEL_GPU)
add_subdirectory(ocl) add_subdirectory(ocl)
@ -29,21 +31,23 @@ ov_install_static_lib(xbyak ${OV_CPACK_COMP_CORE})
# zlib # zlib
# #
if(NOT ANDROID) if(ENABLE_SAMPLES OR ENABLE_TESTS)
find_package(PkgConfig QUIET) if(NOT ANDROID)
if(PkgConfig_FOUND) find_package(PkgConfig QUIET)
pkg_search_module(zlib QUIET if(PkgConfig_FOUND)
IMPORTED_TARGET GLOBAL pkg_search_module(zlib QUIET
zlib) IMPORTED_TARGET GLOBAL
if(zlib_FOUND) zlib)
add_library(zlib::zlib ALIAS PkgConfig::zlib) if(zlib_FOUND)
message(STATUS "${PKG_CONFIG_EXECUTABLE}: zlib (${zlib_VERSION}) is found at ${zlib_PREFIX}") add_library(zlib::zlib ALIAS PkgConfig::zlib)
message(STATUS "${PKG_CONFIG_EXECUTABLE}: zlib (${zlib_VERSION}) is found at ${zlib_PREFIX}")
endif()
endif() endif()
endif() endif()
endif()
if(NOT zlib_FOUND) if(NOT zlib_FOUND)
add_subdirectory(zlib EXCLUDE_FROM_ALL) add_subdirectory(zlib EXCLUDE_FROM_ALL)
endif()
endif() endif()
# #
@ -171,7 +175,7 @@ endif()
# Gflags # 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)$") if(NOT APPLE OR CPACK_GENERATOR MATCHES "^(BREW|CONDA-FORGE)$")
# - on Apple only dynamic libraries are available # - on Apple only dynamic libraries are available
# also, we can easily mix arm64 and x86_64 binaries when cross-compile for Intel CPU # also, we can easily mix arm64 and x86_64 binaries when cross-compile for Intel CPU
@ -297,11 +301,13 @@ ov_install_static_lib(nlohmann_json_schema_validator ${OV_CPACK_COMP_CORE})
if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW)$") if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW)$")
# These libraries are dependencies for openvino-samples package # 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)
message(FATAL_ERROR "gflags must be used as a ${CPACK_GENERATOR} package. Install libgflags-dev / gflags-devel") if(NOT gflags_FOUND)
endif() message(FATAL_ERROR "gflags must be used as a ${CPACK_GENERATOR} package. Install libgflags-dev / gflags-devel")
if(NOT zlib_FOUND) endif()
message(FATAL_ERROR "zlib must be used as a ${CPACK_GENERATOR} package. Install zlib1g-dev / zlib-devel") if(NOT zlib_FOUND)
message(FATAL_ERROR "zlib must be used as a ${CPACK_GENERATOR} package. Install zlib1g-dev / zlib-devel")
endif()
endif() endif()
if(NOT ENABLE_SYSTEM_PUGIXML AND NOT LINUX_OS_NAME STREQUAL "CentOS 7") 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") message(FATAL_ERROR "Pugixml must be used as a ${CPACK_GENERATOR} package. Install libpugixml-dev / pugixml-devel")