From a7e23a4cc2a91859c295569164c9a9d2e576daa1 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Thu, 20 Jul 2017 16:47:37 +0800 Subject: [PATCH] fix link error static to shared --- CMakeLists.txt | 2 +- cmake/external/mkldnn.cmake | 3 ++- cmake/external/mklml.cmake | 11 ++--------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 62ab4669c..4cdd8dbd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,7 +145,7 @@ if(WITH_GPU) endif(WITH_GPU) if(WITH_MKLDNN) - list(APPEND EXTERNAL_LIBS ${MKLDNN_LIBRARY} ${MKLML_LIB_IOMP}) + list(APPEND EXTERNAL_LIBS ${MKLDNN_LIBRARY} ${MKLDNN_IOMP_LIB}) endif() if(USE_NNPACK) diff --git a/cmake/external/mkldnn.cmake b/cmake/external/mkldnn.cmake index fba0756f3..2b7447927 100644 --- a/cmake/external/mkldnn.cmake +++ b/cmake/external/mkldnn.cmake @@ -41,6 +41,7 @@ INCLUDE_DIRECTORIES(${MKLDNN_INCLUDE_DIR}) IF(${CBLAS_PROVIDER} STREQUAL "MKLML") SET(MKLDNN_DEPENDS ${MKLML_PROJECT}) SET(MKLDNN_MKLROOT ${MKLML_ROOT}) + SET(MKLDNN_IOMP_LIB ${MKLML_IOMP_LIB}) SET(MKLDNN_IOMP_DIR ${MKLML_LIB_DIR}) ENDIF() @@ -59,7 +60,7 @@ ExternalProject_Add( UPDATE_COMMAND "" ) -ADD_LIBRARY(mkldnn STATIC IMPORTED GLOBAL) +ADD_LIBRARY(mkldnn SHARED IMPORTED GLOBAL) SET_PROPERTY(TARGET mkldnn PROPERTY IMPORTED_LOCATION ${MKLDNN_LIBRARY}) ADD_DEPENDENCIES(mkldnn ${MKLDNN_PROJECT}) MESSAGE(STATUS "Mkldnn library: ${MKLDNN_LIBRARY}") diff --git a/cmake/external/mklml.cmake b/cmake/external/mklml.cmake index 45b3f9d85..dff51baec 100644 --- a/cmake/external/mklml.cmake +++ b/cmake/external/mklml.cmake @@ -48,14 +48,7 @@ ExternalProject_Add( TEST_COMMAND "" ) -IF (${CMAKE_VERSION} VERSION_LESS "3.3.0") - SET(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/mklml_dummy.c) - FILE(WRITE ${dummyfile} "const char * dummy_mklml = \"${dummyfile}\";") - ADD_LIBRARY(mklml STATIC ${dummyfile}) -ELSE() - ADD_LIBRARY(mklml INTERFACE) -ENDIF() - +ADD_LIBRARY(mklml SHARED IMPORTED GLOBAL) +SET_PROPERTY(TARGET mklml PROPERTY IMPORTED_LOCATION ${MKLML_LIB}) ADD_DEPENDENCIES(mklml ${MKLML_PROJECT}) - LIST(APPEND external_project_dependencies mklml) -- GitLab