Skip to content

Commit

Permalink
Provide TBB/MLAS/oneDNN externally
Browse files Browse the repository at this point in the history
Signed-off-by: Vihang Mehta <[email protected]>
  • Loading branch information
vihangm committed Nov 20, 2024
1 parent 5a7178d commit 2279df5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmake/developer_package/target_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ ov_libc_version()
#
macro(ov_get_glibcxx_use_cxx11_abi)
if(LINUX AND OPENVINO_STDLIB STREQUAL "GNU")
ov_get_compiler_definition("_GLIBCXX_USE_CXX11_ABI" OV_GLIBCXX_USE_CXX11_ABI)
set(OV_GLIBCXX_USE_CXX11_ABI "1" PARENT_SCOPE)
endif()
endmacro()

Expand Down
5 changes: 4 additions & 1 deletion cmake/templates/OpenVINOConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ macro(_ov_find_tbb)

set(enable_system_tbb "@ENABLE_SYSTEM_TBB@")
if(NOT enable_system_tbb)
set_and_check(_tbb_dir "@PACKAGE_OV_TBB_DIR@")
# [GML] Because bazel builds in a build_tmpdir, the TBB path is wrong.
# [GML] This is a hack to fix-up the path.
string(REPLACE ".build_tmpdir" "" _gml_package_ie_tbb_dir "@PACKAGE_OV_TBB_DIR@")
set_and_check(_tbb_dir ${_gml_package_ie_tbb_dir})

# see https://stackoverflow.com/questions/28070810/cmake-generate-error-on-windows-as-it-uses-as-escape-seq
if(DEFINED ENV{TBBROOT})
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/intel_cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ target_link_libraries(${TARGET_NAME} PRIVATE dnnl
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
if (ENABLE_MLAS_FOR_CPU)
target_link_libraries(${TARGET_NAME} PRIVATE mlas)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE $<TARGET_PROPERTY:mlas,INCLUDE_DIRECTORIES>)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${MLAS_INCLUDE_DIRS})
add_definitions(-DOV_CPU_WITH_MLAS)
endif()
if (ENABLE_SNIPPETS_LIBXSMM_TPP)
Expand All @@ -269,7 +269,7 @@ endif ()
if(ENABLE_SHL_FOR_CPU)
target_link_libraries(${TARGET_NAME} PRIVATE shl)
endif()
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE $<TARGET_PROPERTY:dnnl,INCLUDE_DIRECTORIES>)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${DNNL_INCLUDE_DIRS})

# Temporal solution to use template reference implementations in cases where optimizied implementation
# is not (yet) needed.
Expand Down
7 changes: 4 additions & 3 deletions src/plugins/intel_cpu/thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,14 @@ if (ENABLE_SNIPPETS_LIBXSMM_TPP)
endif()

if(ENABLE_MLAS_FOR_CPU)
add_subdirectory(mlas)
ov_install_static_lib(mlas ${OV_CPACK_COMP_CORE})
include_directories(${MLAS_INCLUDE_DIRS})
link_directories(${MLAS_LIBRARY_DIRS})
endif()

if(ENABLE_SHL_FOR_CPU)
add_subdirectory(shl)
ov_install_static_lib(shl ${OV_CPACK_COMP_CORE})
endif()

ov_add_onednn()
include_directories(${DNNL_INCLUDE_DIRS})
link_directories(${DNNL_LIBRARY_DIRS})
6 changes: 5 additions & 1 deletion thirdparty/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ endif()
#

if(ENABLE_OV_ONNX_FRONTEND)
find_package(ONNX 1.15.0 QUIET COMPONENTS onnx onnx_proto NO_MODULE)
find_package(ONNX QUIET COMPONENTS onnx onnx_proto NO_MODULE)

if(ONNX_FOUND)
# conan and vcpkg create imported targets 'onnx' and 'onnx_proto'
Expand Down Expand Up @@ -518,6 +518,7 @@ endif()
# Install
#

if(ENABLE_SAMPLES OR ENABLE_TESTS)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}
Expand All @@ -538,7 +539,9 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags
PATTERN .travis.yml EXCLUDE
PATTERN src/gflags_completions.sh EXCLUDE
PATTERN WORKSPACE EXCLUDE)
endif()

if(ENABLE_SAMPLES)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json/nlohmann_json
DESTINATION ${OV_CPACK_SAMPLESDIR}/cpp/thirdparty
COMPONENT ${OV_CPACK_COMP_CPP_SAMPLES}
Expand All @@ -563,6 +566,7 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json/nlohmann_json
PATTERN tools EXCLUDE
PATTERN WORKSPACE.bazel EXCLUDE
PATTERN wsjcpp.yml EXCLUDE)
endif()

# restore state

Expand Down

0 comments on commit 2279df5

Please sign in to comment.