Commit dfff804b authored by Sang Ik Lee's avatar Sang Ik Lee Committed by Robert Kimball

Silee2/fix prebuilt mkldnn (#2575)

* mkl-dnn prebuilt: Use IMPORTED_LINK_INTERFACE_LIBRARIES to ask to link mklml and omp runtime.

* mkl-dnn prebuilt: fix IMPORTED libraries related issues.

* Setup target libmkl for prebuilt mkl-dnn.
parent 97ca4a69
......@@ -48,14 +48,30 @@ if(MKLDNN_INCLUDE_DIR AND MKLDNN_LIB_DIR)
set(MKLML_LIB_DIR ${MKLDNN_LIB_DIR})
endif()
if(WIN32)
add_library(libmkl STATIC IMPORTED)
set_property(TARGET libmkl PROPERTY IMPORTED_LOCATION ${MKLML_LIB_DIR}/${MKLML_IMPLIB})
set_target_properties(libmkl PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES ${MKLML_LIB_DIR}/${OMP_IMPLIB})
else()
add_library(libmkl SHARED IMPORTED)
set_property(TARGET libmkl PROPERTY IMPORTED_LOCATION ${MKLML_LIB_DIR}/${MKLML_LIB})
set_target_properties(libmkl PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES ${MKLML_LIB_DIR}/${OMP_LIB})
endif()
if(WIN32)
add_library(libmkldnn STATIC IMPORTED)
set_property(TARGET libmkldnn PROPERTY IMPORTED_LOCATION ${MKLDNN_LIB_DIR}/${MKLDNN_IMPORT_LIB})
set_property(TARGET libmkldnn PROPERTY IMPORTED_LOCATION ${MKLDNN_LIB_DIR}/${MKLDNN_IMPLIB})
set_target_properties(libmkldnn PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES "${MKLML_LIB_DIR}/${MKLML_IMPLIB};${MKLML_LIB_DIR}/${OMP_IMPLIB}")
else()
add_library(libmkldnn SHARED IMPORTED)
set_property(TARGET libmkldnn PROPERTY IMPORTED_LOCATION ${MKLDNN_LIB_DIR}/${MKLDNN_LIB})
set_target_properties(libmkldnn PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES "${MKLML_LIB_DIR}/${MKLML_LIB};${MKLML_LIB_DIR}/${OMP_LIB}")
endif()
target_include_directories(libmkldnn SYSTEM INTERFACE ${MKLDNN_INCLUDE_DIR})
set_target_properties(libmkldnn PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${MKLDNN_INCLUDE_DIR})
install(FILES ${MKLDNN_LIB_DIR}/${MKLDNN_LIB} ${MKLML_LIB_DIR}/${MKLML_LIB} ${MKLML_LIB_DIR}/${OMP_LIB} DESTINATION ${NGRAPH_INSTALL_LIB})
return()
......
......@@ -43,6 +43,6 @@ add_custom_command(
add_custom_target(python_wheel DEPENDS ngraph ${CMAKE_BINARY_DIR}/python/dist/)
if (NGRAPH_CPU_ENABLE)
add_dependencies(python_wheel ext_mkldnn)
add_dependencies(python_wheel libmkldnn)
endif()
......@@ -85,7 +85,7 @@ add_custom_target(header_resource
BYPRODUCTS
)
if (NGRAPH_CPU_ENABLE)
add_dependencies(header_resource ext_eigen ext_mkldnn)
add_dependencies(header_resource ext_eigen libmkldnn)
endif()
if(NGRAPH_LIB_VERSIONING_ENABLE)
......
......@@ -191,7 +191,7 @@ if (NGRAPH_CPU_ENABLE)
endif()
endif()
add_dependencies(cpu_backend ext_mkldnn ext_eigen)
add_dependencies(cpu_backend libmkldnn ext_eigen)
target_link_libraries(cpu_backend PUBLIC ngraph libmkldnn libmkl libeigen libjson libtbb)
if (NOT NGRAPH_DEX_ONLY)
target_link_libraries(cpu_backend PUBLIC codegen)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment