A set of fixes for Conan C++ package manager (#19552)
This commit is contained in:
@@ -83,7 +83,11 @@ macro(ov_define_component_include_rules)
|
||||
unset(OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL)
|
||||
set(OV_CPACK_COMP_CORE_C_DEV_EXCLUDE_ALL ${OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL})
|
||||
# licensing
|
||||
set(OV_CPACK_COMP_LICENSING_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
if(CPACK_GENERATOR STREQUAL "CONAN")
|
||||
unset(OV_CPACK_COMP_LICENSING_EXCLUDE_ALL)
|
||||
else()
|
||||
set(OV_CPACK_COMP_LICENSING_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
# samples
|
||||
set(OV_CPACK_COMP_CPP_SAMPLES_EXCLUDE_ALL EXCLUDE_FROM_ALL)
|
||||
set(OV_CPACK_COMP_C_SAMPLES_EXCLUDE_ALL ${OV_CPACK_COMP_CPP_SAMPLES_EXCLUDE_ALL})
|
||||
|
||||
@@ -358,7 +358,7 @@ function(ov_generate_plugins_hpp)
|
||||
"${plugins_hpp_in}"
|
||||
"${IEDevScripts_DIR}/plugins/create_plugins_hpp.cmake"
|
||||
COMMENT
|
||||
"Generate ov_plugins.hpp for build"
|
||||
"Generate ov_plugins.hpp"
|
||||
VERBATIM)
|
||||
|
||||
# for some reason dependency on source files does not work
|
||||
|
||||
@@ -16,10 +16,20 @@ function(_ov_get_tbb_location tbb_target _tbb_lib_location_var)
|
||||
message(FATAL_ERROR "Internal error: ${target} does not represent a target")
|
||||
endif()
|
||||
|
||||
# check that target is imported
|
||||
get_target_property(is_imported ${target} IMPORTED)
|
||||
if(NOT is_imported)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_target_property(_imported_configs ${target} IMPORTED_CONFIGURATIONS)
|
||||
if(NOT _imported_configs)
|
||||
# if IMPORTED_CONFIGURATIONS property is not set, then set a common list
|
||||
set(_imported_configs RELEASE NONE)
|
||||
if(NOT OV_GENERATOR_MULTI_CONFIG)
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} _build_type)
|
||||
list(APPEND _imported_configs ${_build_type})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# generate a list of locations
|
||||
@@ -38,7 +48,7 @@ function(_ov_get_tbb_location tbb_target _tbb_lib_location_var)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
macro(_handle_tbb_target _tbb_target)
|
||||
macro(_get_target_location_and_return _tbb_target)
|
||||
_get_target_location(${_tbb_target} "_tbb_lib_location")
|
||||
if(_tbb_lib_location)
|
||||
set(${_tbb_lib_location_var} "${_tbb_lib_location}" PARENT_SCOPE)
|
||||
@@ -53,7 +63,7 @@ function(_ov_get_tbb_location tbb_target _tbb_lib_location_var)
|
||||
# handle cases like in conan: $<$<CONFIG:Release>:CONAN_LIB::onetbb_TBB_tbb_tbb_RELEASE>
|
||||
if(${tbb_lib} MATCHES "CONAN_LIB::([A-Za-z0-9_]*)")
|
||||
set(tbb_lib_parsed "CONAN_LIB::${CMAKE_MATCH_1}")
|
||||
_handle_tbb_target(${tbb_lib_parsed})
|
||||
_get_target_location_and_return(${tbb_lib_parsed})
|
||||
elseif(tbb_lib MATCHES "${CMAKE_SHARED_LIBRARY_PREFIX}tbb${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
# tbb_lib just a full path to a library itself
|
||||
set(${_tbb_lib_location_var} "${tbb_lib}" PARENT_SCOPE)
|
||||
@@ -62,14 +72,21 @@ function(_ov_get_tbb_location tbb_target _tbb_lib_location_var)
|
||||
endforeach()
|
||||
|
||||
# handle case of usual target
|
||||
_handle_tbb_target(${tbb_target})
|
||||
_get_target_location_and_return(${tbb_target})
|
||||
|
||||
message(FATAL_ERROR "Failed to detect TBB library location")
|
||||
endfunction()
|
||||
|
||||
macro(ov_find_package_tbb)
|
||||
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" AND NOT TBB_FOUND)
|
||||
set(_ov_minimal_tbb_version 2017.0)
|
||||
# conan generates TBBConfig.cmake files, which follows cmake's
|
||||
# SameMajorVersion scheme, while TBB itself follows AnyNewerVersion one
|
||||
# see https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#generating-a-package-version-file
|
||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "conan_toolchain.cmake" OR CONAN_EXPORTED)
|
||||
set(_ov_minimal_tbb_version 2021.0)
|
||||
else()
|
||||
set(_ov_minimal_tbb_version 2017.0)
|
||||
endif()
|
||||
|
||||
if(NOT ENABLE_SYSTEM_TBB)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
|
||||
|
||||
@@ -22,6 +22,8 @@ function(_ov_detect_dynamic_tbbbind_2_5 var)
|
||||
|
||||
find_file(_ov_tbbbind_2_5
|
||||
NAMES "${CMAKE_SHARED_LIBRARY_PREFIX}tbbbind_2_5${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||
# TBB versions prior 2021.4.0 name library as tbbbind_2_4
|
||||
"${CMAKE_SHARED_LIBRARY_PREFIX}tbbbind_2_4${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||
HINTS "${_tbb_libs_dir}"
|
||||
DOC "Path to TBBBind 2.5+ library"
|
||||
NO_DEFAULT_PATH
|
||||
|
||||
12
src/plugins/intel_gpu/thirdparty/CMakeLists.txt
vendored
12
src/plugins/intel_gpu/thirdparty/CMakeLists.txt
vendored
@@ -79,6 +79,14 @@ if(ENABLE_ONEDNN_FOR_GPU)
|
||||
list(APPEND cmake_extra_args "-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}")
|
||||
endif()
|
||||
|
||||
# propogate OpenCL if explicitly specified
|
||||
if(OpenCL_LIBRARY)
|
||||
list(APPEND cmake_extra_args "-DOpenCL_LIBRARY=${OpenCL_LIBRARY}")
|
||||
endif()
|
||||
if(OpenCL_INCLUDE_DIR)
|
||||
list(APPEND cmake_extra_args "-DOpenCL_INCLUDE_DIR=${OpenCL_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(onednn_gpu_build
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/onednn_gpu"
|
||||
BINARY_DIR "${ONEDNN_BUILD_DIR}"
|
||||
@@ -118,11 +126,9 @@ if(ENABLE_ONEDNN_FOR_GPU)
|
||||
"-DDNNL_LIBRARY_TYPE=STATIC"
|
||||
"-DDNNL_EXPERIMENTAL_PROFILING=ON"
|
||||
"-DONEDNN_BUILD_GRAPH=OFF"
|
||||
"-DOpenCL_LIBRARY=${OpenCL_LIBRARY}"
|
||||
"-DOpenCL_INCLUDE_DIR=${OpenCL_INCLUDE_DIR}"
|
||||
# specifically for Conan, because it overrides CMAKE_PREFIX_PATH and oneDNN's FindOpenCL.cmake is ignored
|
||||
# Conan's FindOpenCL.cmake module does not set OpenCL_INCLUDE_DIRS, so we need to set it manually
|
||||
"-DOpenCL_INCLUDE_DIRS=${OpenCL_INCLUDE_DIR}"
|
||||
"-DOpenCL_INCLUDE_DIRS=$<TARGET_PROPERTY:OpenCL::OpenCL,INTERFACE_INCLUDE_DIRECTORIES>"
|
||||
)
|
||||
add_library(onednn_gpu_tgt INTERFACE)
|
||||
set_target_properties(onednn_gpu_tgt PROPERTIES
|
||||
|
||||
Reference in New Issue
Block a user