Avoid global targets in thirdparty dependencies (#17755)
* Added dependencies via vcpkg * Try to remove global imported targets * Fix for conan * Fixed RHEL case * Fixed RHEL, U18 cases * Returned OpenCV finding * Update cmake/templates/OpenVINOConfig.cmake.in Fixed IMPORTED_GLOBAL => GLOBAL in OpenVINOConfig.cmake.in template file * Apply suggestions from code review Properply used NAMES in find_package * Fixed case with zlib * Final fixes * Fixes * Removed CONFIG from find package ZLIB * Fixed RHEL * Reverted changes with gflags back * Turn off LTO after thirdparty dependencies are built
This commit is contained in:
parent
b0b540aeaf
commit
6a562268d3
@ -3,10 +3,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
if(DEFINED BUILD_SHARED_LIBS AND NOT BUILD_SHARED_LIBS)
|
if(DEFINED BUILD_SHARED_LIBS AND NOT BUILD_SHARED_LIBS)
|
||||||
# 'target_link_libraries' does not work correctly when called from
|
# 3.17: 'target_link_libraries' does not work correctly when called from
|
||||||
# different directory where 'add_library' is called: CMake generates
|
# different directory where 'add_library' is called: CMake generates
|
||||||
# incorrect OpenVINOConfig.cmake in this case
|
# incorrect OpenVINOConfig.cmake in this case
|
||||||
cmake_minimum_required(VERSION 3.17)
|
# 3.18: add_library cannot create ALIAS for non-GLOBAL targets
|
||||||
|
cmake_minimum_required(VERSION 3.18)
|
||||||
else()
|
else()
|
||||||
if(CPACK_GENERATOR STREQUAL "DEB")
|
if(CPACK_GENERATOR STREQUAL "DEB")
|
||||||
# we have to use CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS variable
|
# we have to use CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS variable
|
||||||
@ -120,7 +121,7 @@ if (ENABLE_TESTS)
|
|||||||
include(cmake/test_model_zoo.cmake)
|
include(cmake/test_model_zoo.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(thirdparty)
|
include(thirdparty/dependencies.cmake)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
if(ENABLE_SAMPLES OR ENABLE_TESTS OR ENABLE_COMPILE_TOOL)
|
if(ENABLE_SAMPLES OR ENABLE_TESTS OR ENABLE_COMPILE_TOOL)
|
||||||
|
@ -238,7 +238,15 @@ macro(_ov_find_pugixml)
|
|||||||
if(_ov_pugixml_pkgconfig_interface AND NOT ANDROID)
|
if(_ov_pugixml_pkgconfig_interface AND NOT ANDROID)
|
||||||
_ov_find_dependency(PkgConfig)
|
_ov_find_dependency(PkgConfig)
|
||||||
elseif(_ov_pugixml_cmake_interface)
|
elseif(_ov_pugixml_cmake_interface)
|
||||||
_ov_find_dependency(PugiXML REQUIRED)
|
_ov_find_dependency(PugiXML NAMES PugiXML pugixml)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# see https://cmake.org/cmake/help/latest/command/add_library.html#alias-libraries
|
||||||
|
# cmake older than 3.18 cannot create an alias for imported non-GLOBAL targets
|
||||||
|
# so, we have to use 'GLOBAL' property for cases when we call from OpenVINODeveloperPackage
|
||||||
|
# because the alias openvino::pugixml is created later
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.18 AND OpenVINODeveloperPackage_DIR)
|
||||||
|
set(_ov_pugixml_visibility GLOBAL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PugiXML_FOUND)
|
if(PugiXML_FOUND)
|
||||||
@ -248,8 +256,10 @@ macro(_ov_find_pugixml)
|
|||||||
set(_ov_pugixml_target pugixml::pugixml)
|
set(_ov_pugixml_target pugixml::pugixml)
|
||||||
endif()
|
endif()
|
||||||
if(OpenVINODeveloperPackage_DIR)
|
if(OpenVINODeveloperPackage_DIR)
|
||||||
set_property(TARGET ${_ov_pugixml_target} PROPERTY IMPORTED_GLOBAL ON)
|
# align with build tree and create alias
|
||||||
# align with build tree
|
if(_ov_pugixml_visibility STREQUAL "GLOBAL")
|
||||||
|
set_target_properties(${_ov_pugixml_target} PROPERTIES IMPORTED_GLOBAL TRUE)
|
||||||
|
endif()
|
||||||
add_library(openvino::pugixml ALIAS ${_ov_pugixml_target})
|
add_library(openvino::pugixml ALIAS ${_ov_pugixml_target})
|
||||||
endif()
|
endif()
|
||||||
unset(_ov_pugixml_target)
|
unset(_ov_pugixml_target)
|
||||||
@ -265,7 +275,7 @@ macro(_ov_find_pugixml)
|
|||||||
${pkg_config_quiet_arg}
|
${pkg_config_quiet_arg}
|
||||||
${pkg_config_required_arg}
|
${pkg_config_required_arg}
|
||||||
IMPORTED_TARGET
|
IMPORTED_TARGET
|
||||||
GLOBAL
|
${_ov_pugixml_visibility}
|
||||||
pugixml)
|
pugixml)
|
||||||
|
|
||||||
unset(pkg_config_quiet_arg)
|
unset(pkg_config_quiet_arg)
|
||||||
@ -295,6 +305,8 @@ macro(_ov_find_pugixml)
|
|||||||
message(FATAL_ERROR "Failed to find system pugixml in OpenVINO Developer Package")
|
message(FATAL_ERROR "Failed to find system pugixml in OpenVINO Developer Package")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
unset(_ov_pugixml_visibility)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
@ -314,7 +326,7 @@ macro(_ov_find_ade)
|
|||||||
# whether 'ade' is found via find_package
|
# whether 'ade' is found via find_package
|
||||||
set(_ENABLE_SYSTEM_ADE "@ade_FOUND@")
|
set(_ENABLE_SYSTEM_ADE "@ade_FOUND@")
|
||||||
if(_OV_ENABLE_GAPI_PREPROCESSING AND _ENABLE_SYSTEM_ADE)
|
if(_OV_ENABLE_GAPI_PREPROCESSING AND _ENABLE_SYSTEM_ADE)
|
||||||
_ov_find_dependency(ade 0.1.2)
|
_ov_find_dependency(ade @ade_VERSION@)
|
||||||
endif()
|
endif()
|
||||||
unset(_OV_ENABLE_GAPI_PREPROCESSING)
|
unset(_OV_ENABLE_GAPI_PREPROCESSING)
|
||||||
unset(_ENABLE_SYSTEM_ADE)
|
unset(_ENABLE_SYSTEM_ADE)
|
||||||
@ -375,9 +387,8 @@ endmacro()
|
|||||||
|
|
||||||
macro(_ov_find_protobuf_frontend_dependency)
|
macro(_ov_find_protobuf_frontend_dependency)
|
||||||
set(_OV_ENABLE_SYSTEM_PROTOBUF "@ENABLE_SYSTEM_PROTOBUF@")
|
set(_OV_ENABLE_SYSTEM_PROTOBUF "@ENABLE_SYSTEM_PROTOBUF@")
|
||||||
# TODO: remove check for target existence
|
if(_OV_ENABLE_SYSTEM_PROTOBUF)
|
||||||
if(_OV_ENABLE_SYSTEM_PROTOBUF AND NOT TARGET protobuf::libprotobuf)
|
_ov_find_dependency(Protobuf @Protobuf_VERSION@ EXACT NAMES Protobuf protobuf)
|
||||||
_ov_find_dependency(Protobuf @Protobuf_VERSION@ EXACT)
|
|
||||||
endif()
|
endif()
|
||||||
unset(_OV_ENABLE_SYSTEM_PROTOBUF)
|
unset(_OV_ENABLE_SYSTEM_PROTOBUF)
|
||||||
endmacro()
|
endmacro()
|
||||||
@ -385,8 +396,7 @@ endmacro()
|
|||||||
macro(_ov_find_tensorflow_frontend_dependencies)
|
macro(_ov_find_tensorflow_frontend_dependencies)
|
||||||
set(_OV_ENABLE_SYSTEM_SNAPPY "@ENABLE_SYSTEM_SNAPPY@")
|
set(_OV_ENABLE_SYSTEM_SNAPPY "@ENABLE_SYSTEM_SNAPPY@")
|
||||||
set(_ov_snappy_lib "@ov_snappy_lib@")
|
set(_ov_snappy_lib "@ov_snappy_lib@")
|
||||||
# TODO: remove check for target existence
|
if(_OV_ENABLE_SYSTEM_SNAPPY)
|
||||||
if(_OV_ENABLE_SYSTEM_SNAPPY AND NOT TARGET ${_ov_snappy_lib})
|
|
||||||
_ov_find_dependency(Snappy @Snappy_VERSION@ EXACT)
|
_ov_find_dependency(Snappy @Snappy_VERSION@ EXACT)
|
||||||
endif()
|
endif()
|
||||||
unset(_OV_ENABLE_SYSTEM_SNAPPY)
|
unset(_OV_ENABLE_SYSTEM_SNAPPY)
|
||||||
|
@ -33,7 +33,11 @@ set(ENABLE_PLUGINS_XML ON)
|
|||||||
|
|
||||||
# for samples in 3rd party projects
|
# for samples in 3rd party projects
|
||||||
if(ENABLE_SAMPLES)
|
if(ENABLE_SAMPLES)
|
||||||
set_and_check(gflags_DIR "@gflags_BINARY_DIR@")
|
if("@gflags_FOUND@")
|
||||||
|
set_and_check(gflags_DIR "@gflags_DIR@")
|
||||||
|
else()
|
||||||
|
set_and_check(gflags_DIR "@gflags_BINARY_DIR@")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
@ -19,7 +19,7 @@ It is possible because not all interface symbols of OpenVINO Runtime libraries a
|
|||||||
|
|
||||||
## System requirements
|
## System requirements
|
||||||
|
|
||||||
* CMake version 3.17 or higher must be used to build static OpenVINO libraries.
|
* CMake version 3.18 or higher must be used to build static OpenVINO libraries.
|
||||||
* Supported OSes:
|
* Supported OSes:
|
||||||
* Windows x64
|
* Windows x64
|
||||||
* Linux x64
|
* Linux x64
|
||||||
|
@ -64,8 +64,7 @@ function(ov_check_python_build_conditions)
|
|||||||
endif()
|
endif()
|
||||||
# use libraries with the same version as python itself
|
# use libraries with the same version as python itself
|
||||||
set(PYBIND11_PYTHON_VERSION ${PYTHON_VERSION_STRING})
|
set(PYBIND11_PYTHON_VERSION ${PYTHON_VERSION_STRING})
|
||||||
find_host_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} EXACT
|
find_host_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} EXACT ${find_package_mode})
|
||||||
${find_package_mode})
|
|
||||||
set(PYTHONLIBSNEW_FOUND ${PYTHONLIBS_FOUND} PARENT_SCOPE)
|
set(PYTHONLIBSNEW_FOUND ${PYTHONLIBS_FOUND} PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
# try to find python libraries
|
# try to find python libraries
|
||||||
|
@ -115,7 +115,7 @@ macro(ov_find_package_tbb)
|
|||||||
IMPORTED_TARGET
|
IMPORTED_TARGET
|
||||||
# we need to set GLOBAL in order to create ALIAS later
|
# we need to set GLOBAL in order to create ALIAS later
|
||||||
# ALIAS creation for non-GLOBAL targets is available since cmake 3.18
|
# ALIAS creation for non-GLOBAL targets is available since cmake 3.18
|
||||||
GLOBAL
|
${OV_PkgConfig_VISILITY}
|
||||||
tbb)
|
tbb)
|
||||||
if(tbb_FOUND)
|
if(tbb_FOUND)
|
||||||
# parse version
|
# parse version
|
||||||
@ -190,7 +190,6 @@ macro(ov_find_package_tbb)
|
|||||||
if(PkgConfig_FOUND)
|
if(PkgConfig_FOUND)
|
||||||
pkg_search_module(HWLOC QUIET
|
pkg_search_module(HWLOC QUIET
|
||||||
IMPORTED_TARGET
|
IMPORTED_TARGET
|
||||||
GLOBAL
|
|
||||||
hwloc)
|
hwloc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ add_library(openvino::itt ALIAS ${TARGET_NAME})
|
|||||||
target_link_libraries(${TARGET_NAME} PUBLIC openvino::util)
|
target_link_libraries(${TARGET_NAME} PUBLIC openvino::util)
|
||||||
|
|
||||||
if(ENABLE_PROFILING_ITT)
|
if(ENABLE_PROFILING_ITT)
|
||||||
target_link_libraries(${TARGET_NAME} PUBLIC ittapi::ittnotify)
|
target_link_libraries(${TARGET_NAME} PUBLIC ittapi::ittapi)
|
||||||
if(ENABLE_PROFILING_FILTER STREQUAL "ALL")
|
if(ENABLE_PROFILING_FILTER STREQUAL "ALL")
|
||||||
target_compile_definitions(${TARGET_NAME} PUBLIC
|
target_compile_definitions(${TARGET_NAME} PUBLIC
|
||||||
ENABLE_PROFILING_ALL
|
ENABLE_PROFILING_ALL
|
||||||
|
@ -47,12 +47,12 @@ find_package_handle_standard_args(ITT
|
|||||||
if(ITT_FOUND)
|
if(ITT_FOUND)
|
||||||
set(INTEL_ITT_FOUND ${ITT_FOUND})
|
set(INTEL_ITT_FOUND ${ITT_FOUND})
|
||||||
|
|
||||||
add_library(ittapi::ittnotify STATIC IMPORTED GLOBAL)
|
add_library(ittapi::ittapi STATIC IMPORTED GLOBAL)
|
||||||
set_target_properties(ittapi::ittnotify PROPERTIES IMPORTED_LOCATION "${Located_ITT_LIBS}"
|
set_target_properties(ittapi::ittapi PROPERTIES IMPORTED_LOCATION "${Located_ITT_LIBS}"
|
||||||
INTERFACE_INCLUDE_DIRECTORIES ${Located_ITT_INCLUDE_DIRS}
|
INTERFACE_INCLUDE_DIRECTORIES ${Located_ITT_INCLUDE_DIRS}
|
||||||
INTERFACE_COMPILE_DEFINITIONS ENABLE_PROFILING_ITT)
|
INTERFACE_COMPILE_DEFINITIONS ENABLE_PROFILING_ITT)
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
set_target_properties(ittapi::ittnotify PROPERTIES INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS};Threads::Threads")
|
set_target_properties(ittapi::ittapi PROPERTIES INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS};Threads::Threads")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -2,11 +2,20 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set(_old_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||||
|
set(_old_CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ${CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE})
|
||||||
|
|
||||||
# Android toolchain does not provide pkg-config file. So, cmake mistakenly uses
|
# Android toolchain does not provide pkg-config file. So, cmake mistakenly uses
|
||||||
# build system pkg-config executable, which finds packages on build system. Such
|
# build system pkg-config executable, which finds packages on build system. Such
|
||||||
# libraries cannot be linked into Android binaries.
|
# libraries cannot be linked into Android binaries.
|
||||||
if(NOT ANDROID)
|
if(NOT ANDROID)
|
||||||
find_package(PkgConfig QUIET)
|
find_package(PkgConfig QUIET)
|
||||||
|
# see https://cmake.org/cmake/help/latest/command/add_library.html#alias-libraries
|
||||||
|
# cmake older than 3.18 cannot create an alias for imported non-GLOBAL targets
|
||||||
|
# so, we have to use 'IMPORTED_GLOBAL' property
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.18)
|
||||||
|
set(OV_PkgConfig_VISILITY GLOBAL)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SUGGEST_OVERRIDE_SUPPORTED)
|
if(SUGGEST_OVERRIDE_SUPPORTED)
|
||||||
@ -21,31 +30,20 @@ if(ENABLE_PROFILING_ITT)
|
|||||||
find_package(ittapi QUIET)
|
find_package(ittapi QUIET)
|
||||||
if(ittapi_FOUND)
|
if(ittapi_FOUND)
|
||||||
# conan defines 'ittapi::ittapi' target
|
# conan defines 'ittapi::ittapi' target
|
||||||
# create more common alias 'ittapi::ittnotify'
|
|
||||||
set_target_properties(ittapi::ittapi PROPERTIES
|
set_target_properties(ittapi::ittapi PROPERTIES
|
||||||
IMPORTED_GLOBAL ON
|
|
||||||
INTERFACE_COMPILE_DEFINITIONS ENABLE_PROFILING_ITT)
|
INTERFACE_COMPILE_DEFINITIONS ENABLE_PROFILING_ITT)
|
||||||
add_library(ittapi::ittnotify ALIAS ittapi::ittapi)
|
|
||||||
|
|
||||||
# set ittapi_FOUND to parent scope to properly generate OpenVINOConfig.cmake for static build
|
|
||||||
set(ittapi_FOUND ${ittapi_FOUND} PARENT_SCOPE)
|
|
||||||
else()
|
else()
|
||||||
add_subdirectory(ittapi)
|
add_subdirectory(thirdparty/ittapi)
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(itt_collector EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/itt_collector EXCLUDE_FROM_ALL)
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_SAMPLES OR ENABLE_TESTS)
|
|
||||||
add_subdirectory(cnpy EXCLUDE_FROM_ALL)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(X86_64 OR UNIVERSAL2)
|
if(X86_64 OR UNIVERSAL2)
|
||||||
find_package(xbyak QUIET)
|
find_package(xbyak QUIET)
|
||||||
if(xbyak_FOUND)
|
if(xbyak_FOUND)
|
||||||
# conan creates alias xbyak::xbyak, we only need to make it GLOBAL
|
# conan creates alias xbyak::xbyak, no extra steps are required
|
||||||
set_target_properties(xbyak::xbyak PROPERTIES IMPORTED_GLOBAL ON)
|
|
||||||
else()
|
else()
|
||||||
add_subdirectory(xbyak EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/xbyak EXCLUDE_FROM_ALL)
|
||||||
# export and install xbyak
|
# export and install xbyak
|
||||||
openvino_developer_export_targets(COMPONENT openvino_common TARGETS xbyak::xbyak)
|
openvino_developer_export_targets(COMPONENT openvino_common TARGETS xbyak::xbyak)
|
||||||
ov_install_static_lib(xbyak ${OV_CPACK_COMP_CORE})
|
ov_install_static_lib(xbyak ${OV_CPACK_COMP_CORE})
|
||||||
@ -71,7 +69,6 @@ if(ENABLE_INTEL_GPU)
|
|||||||
if(NOT OpenCLHeaders_FOUND)
|
if(NOT OpenCLHeaders_FOUND)
|
||||||
message(WARNING "OpenCLHeaders not found, but OpenCLICDLoader is installed. Please, install OpenCL headers")
|
message(WARNING "OpenCLHeaders not found, but OpenCLICDLoader is installed. Please, install OpenCL headers")
|
||||||
else()
|
else()
|
||||||
set_target_properties(OpenCL::Headers PROPERTIES IMPORTED_GLOBAL ON)
|
|
||||||
set_property(TARGET OpenCL::OpenCL APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenCL::Headers)
|
set_property(TARGET OpenCL::OpenCL APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenCL::Headers)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -82,25 +79,20 @@ if(ENABLE_INTEL_GPU)
|
|||||||
if(NOT OpenCLHeadersCpp_FOUND)
|
if(NOT OpenCLHeadersCpp_FOUND)
|
||||||
message(WARNING "OpenCLHeadersCpp not found, but OpenCLICDLoader is installed. Please, install OpenCL C++ headers")
|
message(WARNING "OpenCLHeadersCpp not found, but OpenCLICDLoader is installed. Please, install OpenCL C++ headers")
|
||||||
else()
|
else()
|
||||||
set_target_properties(OpenCL::HeadersCpp PROPERTIES IMPORTED_GLOBAL ON)
|
|
||||||
get_target_property(opencl_cpp_include_dirs OpenCL::HeadersCpp INTERFACE_INCLUDE_DIRECTORIES)
|
get_target_property(opencl_cpp_include_dirs OpenCL::HeadersCpp INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
set_property(TARGET OpenCL::OpenCL APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenCL::HeadersCpp)
|
set_property(TARGET OpenCL::OpenCL APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenCL::HeadersCpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# set OpenCLICDLoader_FOUND to parent scope to generate proper OpenVINOConfig.cmake for static libraries case
|
|
||||||
set(OpenCLICDLoader_FOUND ON PARENT_SCOPE)
|
|
||||||
else()
|
else()
|
||||||
# try to find system OpenCL:
|
# try to find system OpenCL:
|
||||||
# - 'apt-get install opencl-headers ocl-icd-opencl-dev'
|
# - 'apt-get install opencl-headers ocl-icd-opencl-dev'
|
||||||
# - 'yum install ocl-icd-devel opencl-headers'
|
# - 'yum install ocl-icd-devel opencl-headers'
|
||||||
# - 'conda install khronos-opencl-icd-loader -c conda-forge'
|
# - 'conda install khronos-opencl-icd-loader -c conda-forge'
|
||||||
|
# - 'vcpkg install opencl:<triplet>'
|
||||||
find_package(OpenCL QUIET)
|
find_package(OpenCL QUIET)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TARGET OpenCL::OpenCL)
|
if(TARGET OpenCL::OpenCL)
|
||||||
set_target_properties(OpenCL::OpenCL PROPERTIES IMPORTED_GLOBAL ON)
|
|
||||||
|
|
||||||
# try to find CL/opencl.hpp
|
# try to find CL/opencl.hpp
|
||||||
find_file(OpenCL_HPP
|
find_file(OpenCL_HPP
|
||||||
NAMES CL/opencl.hpp OpenCL/opencl.hpp
|
NAMES CL/opencl.hpp OpenCL/opencl.hpp
|
||||||
@ -123,8 +115,8 @@ if(ENABLE_INTEL_GPU)
|
|||||||
|
|
||||||
# set variables for onednn_gpu
|
# set variables for onednn_gpu
|
||||||
if(OpenCLHeaders_FOUND)
|
if(OpenCLHeaders_FOUND)
|
||||||
set(OpenCL_INCLUDE_DIR "$<TARGET_PROPERTY:OpenCL::Headers,INTERFACE_INCLUDE_DIRECTORIES>" PARENT_SCOPE)
|
set(OpenCL_INCLUDE_DIR "$<TARGET_PROPERTY:OpenCL::Headers,INTERFACE_INCLUDE_DIRECTORIES>")
|
||||||
set(OpenCL_LIBRARY "$<TARGET_PROPERTY:OpenCL::OpenCL,IMPORTED_LOCATION_RELEASE>" PARENT_SCOPE)
|
set(OpenCL_LIBRARY "$<TARGET_PROPERTY:OpenCL::OpenCL,IMPORTED_LOCATION_RELEASE>")
|
||||||
elseif(OpenCL_FOUND)
|
elseif(OpenCL_FOUND)
|
||||||
# find_package(OpenCL) already defines OpenCL_INCLUDE_DIR and OpenCL_LIBRARY
|
# find_package(OpenCL) already defines OpenCL_INCLUDE_DIR and OpenCL_LIBRARY
|
||||||
# see https://cmake.org/cmake/help/latest/module/FindOpenCL.html
|
# see https://cmake.org/cmake/help/latest/module/FindOpenCL.html
|
||||||
@ -133,14 +125,7 @@ if(ENABLE_INTEL_GPU)
|
|||||||
message(FATAL_ERROR "Internal error: cannot find OpenCL headers")
|
message(FATAL_ERROR "Internal error: cannot find OpenCL headers")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
add_subdirectory(ocl)
|
add_subdirectory(thirdparty/ocl)
|
||||||
|
|
||||||
set(OpenCL_INCLUDE_DIR "${OpenCL_INCLUDE_DIR}" PARENT_SCOPE)
|
|
||||||
set(OpenCL_LIBRARY "${OpenCL_LIBRARY}" PARENT_SCOPE)
|
|
||||||
set(opencl_root_hints "${opencl_root_hints}" PARENT_SCOPE)
|
|
||||||
|
|
||||||
# system OpenCL is not found: set it explictly for consistent OpenVINOConfig.cmake generation
|
|
||||||
set(ENABLE_SYSTEM_OPENCL OFF PARENT_SCOPE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# cmake cannot set properties for imported targets
|
# cmake cannot set properties for imported targets
|
||||||
@ -157,7 +142,8 @@ if(ENABLE_INTEL_GPU)
|
|||||||
# used in tests
|
# used in tests
|
||||||
add_library(opencl_new_headers INTERFACE)
|
add_library(opencl_new_headers INTERFACE)
|
||||||
add_library(OpenCL::NewHeaders ALIAS opencl_new_headers)
|
add_library(OpenCL::NewHeaders ALIAS opencl_new_headers)
|
||||||
foreach(opencl_dir "${CMAKE_CURRENT_SOURCE_DIR}/ocl/clhpp_headers/include" "${CMAKE_CURRENT_SOURCE_DIR}/ocl/cl_headers")
|
foreach(opencl_dir "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ocl/clhpp_headers/include"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ocl/cl_headers")
|
||||||
if(EXISTS "${opencl_dir}")
|
if(EXISTS "${opencl_dir}")
|
||||||
set_property(TARGET opencl_new_headers APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
set_property(TARGET opencl_new_headers APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||||
$<BUILD_INTERFACE:${opencl_dir}>)
|
$<BUILD_INTERFACE:${opencl_dir}>)
|
||||||
@ -172,35 +158,44 @@ endif()
|
|||||||
#
|
#
|
||||||
|
|
||||||
if(ENABLE_SAMPLES OR ENABLE_TESTS)
|
if(ENABLE_SAMPLES OR ENABLE_TESTS)
|
||||||
find_package(ZLIB QUIET CONFIG)
|
find_package(ZLIB QUIET)
|
||||||
if(ZLIB_FOUND)
|
if(ZLIB_FOUND)
|
||||||
# need to make it global to use outside of the current sub-directory
|
# FindZLIB module defines ZLIB::ZLIB, no extra steps are required
|
||||||
set_target_properties(ZLIB::ZLIB PROPERTIES IMPORTED_GLOBAL ON)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# cmake has failed to find zlib, let's try pkg-config
|
# cmake has failed to find zlib, let's try pkg-config
|
||||||
if(NOT ZLIB_FOUND AND PkgConfig_FOUND)
|
if(NOT ZLIB_FOUND AND PkgConfig_FOUND)
|
||||||
pkg_search_module(zlib QUIET
|
pkg_search_module(zlib QUIET
|
||||||
IMPORTED_TARGET GLOBAL
|
IMPORTED_TARGET
|
||||||
zlib)
|
zlib)
|
||||||
if(zlib_FOUND)
|
if(zlib_FOUND)
|
||||||
add_library(ZLIB::ZLIB ALIAS PkgConfig::zlib)
|
add_library(ZLIB::ZLIB INTERFACE IMPORTED)
|
||||||
|
set_target_properties(ZLIB::ZLIB PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::zlib)
|
||||||
message(STATUS "${PKG_CONFIG_EXECUTABLE}: zlib (${zlib_VERSION}) is found at ${zlib_PREFIX}")
|
message(STATUS "${PKG_CONFIG_EXECUTABLE}: zlib (${zlib_VERSION}) is found at ${zlib_PREFIX}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT (zlib_FOUND OR ZLIB_FOUND))
|
if(NOT (zlib_FOUND OR ZLIB_FOUND))
|
||||||
add_subdirectory(zlib EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/zlib EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# cnpy
|
||||||
|
#
|
||||||
|
|
||||||
|
if(ENABLE_SAMPLES OR ENABLE_TESTS)
|
||||||
|
add_subdirectory(thirdparty/cnpy EXCLUDE_FROM_ALL)
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Pugixml
|
# Pugixml
|
||||||
#
|
#
|
||||||
|
|
||||||
if(ENABLE_SYSTEM_PUGIXML)
|
if(ENABLE_SYSTEM_PUGIXML)
|
||||||
# try system pugixml first
|
# try system pugixml first
|
||||||
find_package(PugiXML QUIET)
|
# Note: we also specify 'pugixml' in NAMES because vcpkg
|
||||||
|
find_package(PugiXML QUIET NAMES PugiXML pugixml)
|
||||||
if(PugiXML_FOUND)
|
if(PugiXML_FOUND)
|
||||||
# TODO: use static pugixml library in case of BUILD_SHARED_LIBS=OFF
|
# TODO: use static pugixml library in case of BUILD_SHARED_LIBS=OFF
|
||||||
if(TARGET pugixml::shared)
|
if(TARGET pugixml::shared)
|
||||||
@ -216,7 +211,7 @@ if(ENABLE_SYSTEM_PUGIXML)
|
|||||||
# - 'apt-get install libpugixml-dev'
|
# - 'apt-get install libpugixml-dev'
|
||||||
set(pugixml_target pugixml)
|
set(pugixml_target pugixml)
|
||||||
elseif(TARGET pugixml::static)
|
elseif(TARGET pugixml::static)
|
||||||
# sometimes pugixml::static target already exists, just need to make it global
|
# sometimes pugixml::static target already exists, just need to create an alias
|
||||||
# - 'conda install pugixml -c conda-forge'
|
# - 'conda install pugixml -c conda-forge'
|
||||||
set(pugixml_target pugixml::static)
|
set(pugixml_target pugixml::static)
|
||||||
else()
|
else()
|
||||||
@ -225,10 +220,10 @@ if(ENABLE_SYSTEM_PUGIXML)
|
|||||||
# to property generate OpenVINO Developer packages files
|
# to property generate OpenVINO Developer packages files
|
||||||
set(PugiXML_FOUND ${PugiXML_FOUND} CACHE BOOL "" FORCE)
|
set(PugiXML_FOUND ${PugiXML_FOUND} CACHE BOOL "" FORCE)
|
||||||
elseif(PkgConfig_FOUND)
|
elseif(PkgConfig_FOUND)
|
||||||
# U18 case when cmake interface is not available
|
# Ubuntu 18.04 case when cmake interface is not available
|
||||||
pkg_search_module(pugixml QUIET
|
pkg_search_module(pugixml QUIET
|
||||||
IMPORTED_TARGET
|
IMPORTED_TARGET
|
||||||
GLOBAL
|
${OV_PkgConfig_VISILITY}
|
||||||
pugixml)
|
pugixml)
|
||||||
if(pugixml_FOUND)
|
if(pugixml_FOUND)
|
||||||
set(pugixml_target PkgConfig::pugixml)
|
set(pugixml_target PkgConfig::pugixml)
|
||||||
@ -246,10 +241,13 @@ if(ENABLE_SYSTEM_PUGIXML)
|
|||||||
if(NOT TARGET ${pugixml_target})
|
if(NOT TARGET ${pugixml_target})
|
||||||
find_library(PUGIXML_LIBRARY NAMES pugixml DOC "Path to pugixml library")
|
find_library(PUGIXML_LIBRARY NAMES pugixml DOC "Path to pugixml library")
|
||||||
if(PUGIXML_LIBRARY)
|
if(PUGIXML_LIBRARY)
|
||||||
add_library(pugixml INTERFACE IMPORTED GLOBAL)
|
add_library(pugixml INTERFACE IMPORTED)
|
||||||
set_target_properties(pugixml PROPERTIES INTERFACE_LINK_LIBRARIES "${PUGIXML_LIBRARY}")
|
set_target_properties(pugixml PROPERTIES INTERFACE_LINK_LIBRARIES "${PUGIXML_LIBRARY}")
|
||||||
set(pugixml_target pugixml)
|
set(pugixml_target pugixml)
|
||||||
set(PugiXML_FOUND ON)
|
set(PugiXML_FOUND ON)
|
||||||
|
# because we don't need to have a dependency on specific cmake targets in this case
|
||||||
|
# in file OpenVINOConfig.cmake static build case
|
||||||
|
set(ENABLE_SYSTEM_PUGIXML OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -279,13 +277,16 @@ if(ENABLE_SYSTEM_PUGIXML)
|
|||||||
message(FATAL_ERROR "Debian | RPM package build requires shared Pugixml library")
|
message(FATAL_ERROR "Debian | RPM package build requires shared Pugixml library")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(${pugixml_target} PROPERTIES IMPORTED_GLOBAL ON)
|
if(OV_PkgConfig_VISILITY)
|
||||||
|
# need to set GLOBAL visibility in order to create ALIAS for this target
|
||||||
|
set_target_properties(${pugixml_target} PROPERTIES IMPORTED_GLOBAL ON)
|
||||||
|
endif()
|
||||||
# create an alias for real target which can be shared or static
|
# create an alias for real target which can be shared or static
|
||||||
add_library(openvino::pugixml ALIAS ${pugixml_target})
|
add_library(openvino::pugixml ALIAS ${pugixml_target})
|
||||||
else()
|
else()
|
||||||
# reset to prevent improper code generation in OpenVINODeveloperPackage.cmake,
|
# reset to prevent improper code generation in OpenVINODeveloperPackage.cmake,
|
||||||
# and OpenVINOConfig.cmake for static case
|
# and OpenVINOConfig.cmake for static case
|
||||||
set(ENABLE_SYSTEM_PUGIXML OFF PARENT_SCOPE)
|
set(ENABLE_SYSTEM_PUGIXML OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -294,7 +295,7 @@ if(NOT TARGET openvino::pugixml)
|
|||||||
function(ov_build_pugixml)
|
function(ov_build_pugixml)
|
||||||
function(ov_build_pugixml_static)
|
function(ov_build_pugixml_static)
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
add_subdirectory(pugixml EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/pugixml EXCLUDE_FROM_ALL)
|
||||||
endfunction()
|
endfunction()
|
||||||
ov_build_pugixml_static()
|
ov_build_pugixml_static()
|
||||||
set_property(TARGET pugixml-static PROPERTY EXPORT_NAME pugixml)
|
set_property(TARGET pugixml-static PROPERTY EXPORT_NAME pugixml)
|
||||||
@ -312,17 +313,17 @@ endif()
|
|||||||
|
|
||||||
if(ENABLE_GAPI_PREPROCESSING)
|
if(ENABLE_GAPI_PREPROCESSING)
|
||||||
add_library(ocv_hal INTERFACE)
|
add_library(ocv_hal INTERFACE)
|
||||||
target_include_directories(ocv_hal INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/ocv")
|
target_include_directories(ocv_hal INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/ocv")
|
||||||
|
|
||||||
# ade
|
# ade
|
||||||
find_package(ade 0.1.2 QUIET)
|
find_package(ade 0.1.0 QUIET)
|
||||||
if(ade_FOUND)
|
if(ade_FOUND)
|
||||||
# conan creates 'ade' target
|
# conan and vcpkg create 'ade' target
|
||||||
|
# we just need to remove non-numerical symbols from version,
|
||||||
# set ade_FOUND to parent scope to properly generate OpenVINOConfig.cmake for static build
|
# because conan defines it as 0.1.2a, which is invalid in cmake
|
||||||
set(ade_FOUND ${ade_FOUND} PARENT_SCOPE)
|
string(REGEX REPLACE "[a-z]" "" ade_VERSION "${ade_VERSION}")
|
||||||
else()
|
else()
|
||||||
add_subdirectory(ade EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/ade EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
set_target_properties(ade PROPERTIES FOLDER thirdparty)
|
set_target_properties(ade PROPERTIES FOLDER thirdparty)
|
||||||
openvino_developer_export_targets(COMPONENT openvino_common TARGETS ade)
|
openvino_developer_export_targets(COMPONENT openvino_common TARGETS ade)
|
||||||
@ -331,7 +332,7 @@ if(ENABLE_GAPI_PREPROCESSING)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# fluid
|
# fluid
|
||||||
add_subdirectory(fluid/modules/gapi EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/fluid/modules/gapi EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11)
|
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11)
|
||||||
target_compile_options(fluid PRIVATE "-Wno-maybe-uninitialized")
|
target_compile_options(fluid PRIVATE "-Wno-maybe-uninitialized")
|
||||||
@ -351,42 +352,50 @@ endif()
|
|||||||
#
|
#
|
||||||
|
|
||||||
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
|
if(ENABLE_SAMPLES OR ENABLE_COMPILE_TOOL OR ENABLE_TESTS)
|
||||||
# on Windows and macOS we don't use gflags, because will be dynamically linked
|
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg " OR DEFINED VCPKG_VERBOSE OR
|
||||||
if(CMAKE_HOST_LINUX AND LINUX)
|
CMAKE_TOOLCHAIN_FILE MATCHES "conan_toolchain" OR DEFINED CONAN_EXPORTED)
|
||||||
|
# vcpkg contains only libs compiled with threads
|
||||||
|
# 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)
|
if(OV_OS_RHEL)
|
||||||
set(gflag_component nothreads_shared)
|
set(gflag_component nothreads_shared)
|
||||||
elseif(OV_OS_DEBIAN)
|
elseif(OV_OS_DEBIAN)
|
||||||
set(gflag_component nothreads_static)
|
set(gflag_component nothreads_static)
|
||||||
endif()
|
endif()
|
||||||
find_package(gflags QUIET OPTIONAL_COMPONENTS ${gflag_component})
|
find_package(gflags QUIET OPTIONAL_COMPONENTS ${gflag_component})
|
||||||
else()
|
|
||||||
# conan case
|
|
||||||
find_package(gflags QUIET)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(gflags_FOUND)
|
if(gflags_FOUND)
|
||||||
if(TARGET gflags)
|
if(TARGET gflags)
|
||||||
set_target_properties(gflags PROPERTIES IMPORTED_GLOBAL ON)
|
# no extra steps
|
||||||
elseif(TARGET gflags_nothreads-static)
|
elseif(TARGET gflags_nothreads-static)
|
||||||
# Debian 9: gflag_component is ignored
|
# Debian 9: gflag_component is ignored
|
||||||
set_target_properties(gflags_nothreads-static PROPERTIES IMPORTED_GLOBAL ON)
|
set(gflags_target gflags_nothreads-static)
|
||||||
add_library(gflags ALIAS gflags_nothreads-static)
|
|
||||||
elseif(TARGET gflags_nothreads-shared)
|
elseif(TARGET gflags_nothreads-shared)
|
||||||
# CentOS / RHEL / Fedora case
|
# CentOS / RHEL / Fedora case
|
||||||
set_target_properties(gflags_nothreads-shared PROPERTIES IMPORTED_GLOBAL ON)
|
set(gflags_target gflags_nothreads-shared)
|
||||||
add_library(gflags ALIAS gflags_nothreads-shared)
|
|
||||||
elseif(TARGET ${GFLAGS_TARGET})
|
elseif(TARGET ${GFLAGS_TARGET})
|
||||||
set_target_properties(${GFLAGS_TARGET} PROPERTIES IMPORTED_GLOBAL ON)
|
set(gflags_target ${GFLAGS_TARGET})
|
||||||
add_library(gflags ALIAS ${GFLAGS_TARGET})
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Internal error: failed to find imported target 'gflags' using '${gflag_component}' component")
|
message(FATAL_ERROR "Internal error: failed to find imported target 'gflags' using '${gflag_component}' component")
|
||||||
endif()
|
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")
|
message(STATUS "gflags (${gflags_VERSION}) is found at ${gflags_DIR} using '${gflag_component}' component")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT TARGET gflags)
|
if(NOT TARGET gflags)
|
||||||
add_subdirectory(gflags EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/gflags EXCLUDE_FROM_ALL)
|
||||||
openvino_developer_export_targets(COMPONENT openvino_common TARGETS gflags)
|
openvino_developer_export_targets(COMPONENT openvino_common TARGETS gflags)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -401,11 +410,14 @@ if(ENABLE_TESTS)
|
|||||||
|
|
||||||
if(GTest_FOUND)
|
if(GTest_FOUND)
|
||||||
foreach(gtest_target gtest gtest_main gmock gmock_main)
|
foreach(gtest_target gtest gtest_main gmock gmock_main)
|
||||||
set_target_properties(GTest::${gtest_target} PROPERTIES IMPORTED_GLOBAL ON)
|
if(OV_PkgConfig_VISILITY)
|
||||||
|
# need to set GLOBAL visibility in order to create ALIAS for this target
|
||||||
|
set_target_properties(GTest::${gtest_target} PROPERTIES IMPORTED_GLOBAL ON)
|
||||||
|
endif()
|
||||||
add_library(${gtest_target} ALIAS GTest::${gtest_target})
|
add_library(${gtest_target} ALIAS GTest::${gtest_target})
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
add_subdirectory(gtest EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/gtest EXCLUDE_FROM_ALL)
|
||||||
openvino_developer_export_targets(COMPONENT tests
|
openvino_developer_export_targets(COMPONENT tests
|
||||||
TARGETS gmock gmock_main gtest gtest_main)
|
TARGETS gmock gmock_main gtest gtest_main)
|
||||||
endif()
|
endif()
|
||||||
@ -423,25 +435,15 @@ if(ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_TF_FRONTEND
|
|||||||
if(CMAKE_VERBOSE_MAKEFILE)
|
if(CMAKE_VERBOSE_MAKEFILE)
|
||||||
set(Protobuf_DEBUG ON)
|
set(Protobuf_DEBUG ON)
|
||||||
endif()
|
endif()
|
||||||
find_package(Protobuf 3.20.3 REQUIRED)
|
# Note: we also specify 'protobuf' in NAMES because vcpkg
|
||||||
|
find_package(Protobuf 3.20.3 REQUIRED NAMES Protobuf protobuf)
|
||||||
set(PROTOC_EXECUTABLE protobuf::protoc)
|
set(PROTOC_EXECUTABLE protobuf::protoc)
|
||||||
|
|
||||||
# in case of system protobuf, we have to add version to OpenVINOConfig.cmake for static build
|
|
||||||
# to ensure no mismatch between versions of protoc and libprotobuf, we need to use exactly
|
|
||||||
# the same versions
|
|
||||||
set(Protobuf_VERSION ${Protobuf_VERSION} PARENT_SCOPE)
|
|
||||||
|
|
||||||
foreach(target ${PROTOC_EXECUTABLE} protobuf::libprotobuf protobuf::libprotobuf-lite)
|
|
||||||
set_target_properties(${target} PROPERTIES IMPORTED_GLOBAL ON)
|
|
||||||
endforeach()
|
|
||||||
else()
|
else()
|
||||||
add_subdirectory(protobuf EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/protobuf EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# forward variables used in the other places
|
# forward additional variables used in the other places
|
||||||
set(PROTOC_DEPENDENCY ${PROTOC_DEPENDENCY} PARENT_SCOPE)
|
set(Protobuf_IN_FRONTEND ON)
|
||||||
set(PROTOC_EXECUTABLE ${PROTOC_EXECUTABLE} PARENT_SCOPE)
|
|
||||||
set(Protobuf_IN_FRONTEND ON PARENT_SCOPE)
|
|
||||||
|
|
||||||
# set public / interface compile options
|
# set public / interface compile options
|
||||||
foreach(target_name protobuf::libprotobuf protobuf::libprotobuf-lite)
|
foreach(target_name protobuf::libprotobuf protobuf::libprotobuf-lite)
|
||||||
@ -489,17 +491,12 @@ if(ENABLE_OV_TF_LITE_FRONTEND)
|
|||||||
# we don't actually use library files (.so | .dylib | .a) itself, only headers
|
# we don't actually use library files (.so | .dylib | .a) itself, only headers
|
||||||
set(flatbuffers_LIBRARY flatbuffers::flatbuffers)
|
set(flatbuffers_LIBRARY flatbuffers::flatbuffers)
|
||||||
set(flatbuffers_COMPILER flatbuffers::flatc)
|
set(flatbuffers_COMPILER flatbuffers::flatc)
|
||||||
|
|
||||||
foreach(target IN LISTS flatbuffers_LIBRARY flatbuffers_COMPILER)
|
|
||||||
set_property(TARGET ${target} PROPERTY IMPORTED_GLOBAL ON)
|
|
||||||
endforeach()
|
|
||||||
else()
|
else()
|
||||||
add_subdirectory(flatbuffers EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/flatbuffers EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(flatbuffers_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:${flatbuffers_LIBRARY},INTERFACE_INCLUDE_DIRECTORIES> PARENT_SCOPE)
|
# set additional variables, used in other places of our cmake scripts
|
||||||
set(flatbuffers_COMPILER ${flatbuffers_COMPILER} PARENT_SCOPE)
|
set(flatbuffers_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:${flatbuffers_LIBRARY},INTERFACE_INCLUDE_DIRECTORIES>)
|
||||||
set(flatbuffers_DEPENDENCY ${flatbuffers_DEPENDENCY} PARENT_SCOPE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -517,13 +514,12 @@ if(ENABLE_SNAPPY_COMPRESSION)
|
|||||||
set(ov_snappy_lib Snappy::snappy-static)
|
set(ov_snappy_lib Snappy::snappy-static)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(${ov_snappy_lib} PROPERTIES IMPORTED_GLOBAL ON)
|
if(OV_PkgConfig_VISILITY)
|
||||||
add_library(openvino::snappy ALIAS ${ov_snappy_lib})
|
# need to set GLOBAL visibility in order to create ALIAS for this target
|
||||||
|
set_target_properties(${ov_snappy_lib} PROPERTIES IMPORTED_GLOBAL ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
# set Snappy_VERSION to parent scope for consistent OpenVINOConfig.cmake generation
|
add_library(openvino::snappy ALIAS ${ov_snappy_lib})
|
||||||
# in case of static build with system dependencies
|
|
||||||
set(Snappy_VERSION ${Snappy_VERSION} PARENT_SCOPE)
|
|
||||||
set(ov_snappy_lib ${ov_snappy_lib} PARENT_SCOPE)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT TARGET openvino::snappy)
|
if(NOT TARGET openvino::snappy)
|
||||||
@ -551,7 +547,7 @@ if(ENABLE_SNAPPY_COMPRESSION)
|
|||||||
ie_add_compiler_flags(-Wno-sign-compare)
|
ie_add_compiler_flags(-Wno-sign-compare)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(snappy EXCLUDE_FROM_ALL)
|
add_subdirectory(thirdparty/snappy EXCLUDE_FROM_ALL)
|
||||||
# need to create alias openvino::snappy
|
# need to create alias openvino::snappy
|
||||||
add_library(openvino::snappy ALIAS snappy)
|
add_library(openvino::snappy ALIAS snappy)
|
||||||
|
|
||||||
@ -574,15 +570,9 @@ if(ENABLE_OV_ONNX_FRONTEND)
|
|||||||
find_package(ONNX 1.13.1 EXACT QUIET COMPONENTS onnx onnx_proto NO_MODULE)
|
find_package(ONNX 1.13.1 EXACT QUIET COMPONENTS onnx onnx_proto NO_MODULE)
|
||||||
|
|
||||||
if(ONNX_FOUND)
|
if(ONNX_FOUND)
|
||||||
# conan creates imported targets 'onnx' and 'onnx_proto'
|
# conan and vcpkg create imported targets 'onnx' and 'onnx_proto'
|
||||||
set_target_properties(onnx onnx_proto PROPERTIES IMPORTED_GLOBAL ON)
|
|
||||||
|
|
||||||
# set ONNX_VERSION to parent scope for correct OpenVINOConfig.cmake generation
|
|
||||||
# in case of static libraries
|
|
||||||
set(ONNX_VERSION ${ONNX_VERSION} PARENT_SCOPE)
|
|
||||||
set(ENABLE_SYSTEM_ONNX ON PARENT_SCOPE)
|
|
||||||
else()
|
else()
|
||||||
add_subdirectory(onnx)
|
add_subdirectory(thirdparty/onnx)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -594,19 +584,16 @@ if(ENABLE_SAMPLES)
|
|||||||
# Note: VPUX requires 3.9.0 version, because it contains 'nlohmann::ordered_json'
|
# Note: VPUX requires 3.9.0 version, because it contains 'nlohmann::ordered_json'
|
||||||
find_package(nlohmann_json 3.9.0 QUIET)
|
find_package(nlohmann_json 3.9.0 QUIET)
|
||||||
if(nlohmann_json_FOUND)
|
if(nlohmann_json_FOUND)
|
||||||
# conan creates imported target nlohmann_json::nlohmann_json
|
# conan and vcpkg create imported target nlohmann_json::nlohmann_json
|
||||||
# no needs to make the target global, because samples call find_package(nlohmann_json) as well
|
|
||||||
# but we need to set nlohmann_json_FOUND to parent scope to properly generate InferenceEngineDeveloperPackageConfig.cmake
|
|
||||||
set(nlohmann_json_FOUND ${nlohmann_json_FOUND} PARENT_SCOPE)
|
|
||||||
else()
|
else()
|
||||||
add_subdirectory(json)
|
add_subdirectory(thirdparty/json)
|
||||||
|
|
||||||
# this is required only because of VPUX plugin reused this
|
# this is required only because of VPUX plugin reused this
|
||||||
openvino_developer_export_targets(COMPONENT openvino_common TARGETS nlohmann_json)
|
openvino_developer_export_targets(COMPONENT openvino_common TARGETS nlohmann_json)
|
||||||
|
|
||||||
# for nlohmann library versions older than v3.0.0
|
# for nlohmann library versions older than v3.0.0
|
||||||
if(NOT TARGET nlohmann_json::nlohmann_json)
|
if(NOT TARGET nlohmann_json::nlohmann_json)
|
||||||
add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED GLOBAL)
|
add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED)
|
||||||
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
|
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
|
||||||
INTERFACE_LINK_LIBRARIES nlohmann_json
|
INTERFACE_LINK_LIBRARIES nlohmann_json
|
||||||
INTERFACE_COMPILE_DEFINITIONS JSON_HEADER)
|
INTERFACE_COMPILE_DEFINITIONS JSON_HEADER)
|
||||||
@ -633,7 +620,7 @@ if(CPACK_GENERATOR MATCHES "^(DEB|RPM|CONDA-FORGE|BREW|CONAN)$")
|
|||||||
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")
|
||||||
endif()
|
endif()
|
||||||
elseif(APPLE OR WIN32)
|
elseif(APPLE OR WIN32)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gflags
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags
|
||||||
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty
|
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty
|
||||||
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}
|
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}
|
||||||
PATTERN bazel EXCLUDE
|
PATTERN bazel EXCLUDE
|
||||||
@ -652,16 +639,16 @@ elseif(APPLE OR WIN32)
|
|||||||
PATTERN .travis.yml EXCLUDE
|
PATTERN .travis.yml EXCLUDE
|
||||||
PATTERN WORKSPACE EXCLUDE)
|
PATTERN WORKSPACE EXCLUDE)
|
||||||
|
|
||||||
file(GLOB zlib_sources ${CMAKE_CURRENT_SOURCE_DIR}/zlib/zlib/*.c
|
file(GLOB zlib_sources ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/zlib/*.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/zlib/zlib/*.h)
|
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/zlib/*.h)
|
||||||
install(FILES ${zlib_sources}
|
install(FILES ${zlib_sources}
|
||||||
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty/zlib/zlib
|
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty/zlib/zlib
|
||||||
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES})
|
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES})
|
||||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/zlib/CMakeLists.txt
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/CMakeLists.txt
|
||||||
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty/zlib
|
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty/zlib
|
||||||
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES})
|
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES})
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/json/nlohmann_json
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json/nlohmann_json
|
||||||
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty
|
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty
|
||||||
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}
|
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}
|
||||||
PATTERN ChangeLog.md EXCLUDE
|
PATTERN ChangeLog.md EXCLUDE
|
||||||
@ -682,6 +669,11 @@ elseif(APPLE OR WIN32)
|
|||||||
PATTERN wsjcpp.yml EXCLUDE)
|
PATTERN wsjcpp.yml EXCLUDE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cnpy
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cnpy
|
||||||
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty
|
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty
|
||||||
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES})
|
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES})
|
||||||
|
|
||||||
|
# restore state
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${_old_CMAKE_CXX_FLAGS}")
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ${_old_CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE})
|
@ -27,7 +27,7 @@ add_library(${TARGET_NAME} SHARED ${SOURCES})
|
|||||||
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME IntelSEAPI)
|
set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME IntelSEAPI)
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE ittapi::ittnotify)
|
target_link_libraries(${TARGET_NAME} PRIVATE ittapi::ittapi)
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS})
|
target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS})
|
||||||
|
8
thirdparty/ittapi/CMakeLists.txt
vendored
8
thirdparty/ittapi/CMakeLists.txt
vendored
@ -22,9 +22,9 @@ else()
|
|||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ittapi/src/ittnotify>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ittapi/src/ittnotify>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ittapi/include>)
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ittapi/include>)
|
||||||
|
|
||||||
# create alias ittapi::ittnotify
|
# create alias ittapi::ittapi
|
||||||
add_library(ittapi::ittnotify ALIAS ittnotify)
|
add_library(ittapi::ittapi ALIAS ittnotify)
|
||||||
|
|
||||||
openvino_developer_export_targets(COMPONENT openvino_common TARGETS ittapi::ittnotify)
|
openvino_developer_export_targets(COMPONENT openvino_common TARGETS ittapi::ittapi)
|
||||||
ov_install_static_lib(ittapi::ittnotify ${OV_CPACK_COMP_CORE})
|
ov_install_static_lib(ittapi::ittapi ${OV_CPACK_COMP_CORE})
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user