From 5bf5650dcf26f437346bc4dedb40a0dbd7138732 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Thu, 4 Jan 2018 10:08:56 +0800 Subject: [PATCH] generate mkldnn dummy target for static deps --- cmake/external/mkldnn.cmake | 16 ++++++++++++---- paddle/operators/tensor.save | Bin 462 -> 466 bytes 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cmake/external/mkldnn.cmake b/cmake/external/mkldnn.cmake index 5d24caebdc..b67c559fdf 100644 --- a/cmake/external/mkldnn.cmake +++ b/cmake/external/mkldnn.cmake @@ -63,9 +63,17 @@ ExternalProject_Add( -DMKLROOT:PATH=${MKLML_ROOT} ) -ADD_LIBRARY(mkldnn SHARED IMPORTED GLOBAL) -SET_PROPERTY(TARGET mkldnn PROPERTY IMPORTED_LOCATION ${MKLDNN_LIB}) -ADD_DEPENDENCIES(mkldnn ${MKLDNN_PROJECT}) +ADD_LIBRARY(shared_mkldnn SHARED IMPORTED GLOBAL) +SET_PROPERTY(TARGET shared_mkldnn PROPERTY IMPORTED_LOCATION ${MKLDNN_LIB}) +ADD_DEPENDENCIES(shared_mkldnn ${MKLDNN_PROJECT}) MESSAGE(STATUS "MKLDNN library: ${MKLDNN_LIB}") add_definitions(-DPADDLE_WITH_MKLDNN) -LIST(APPEND external_project_dependencies mkldnn) +LIST(APPEND external_project_dependencies shared_mkldnn) + +# generate a static dummy target to track mkldnn dependencies +# for cc_library(xxx SRCS xxx.c DEPS mkldnn) +SET(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/mkldnn_dummy.c) +FILE(WRITE ${dummyfile} "const char * dummy = \"${dummyfile}\";") +ADD_LIBRARY(mkldnn STATIC ${dummyfile}) +TARGET_LINK_LIBRARIES(mkldnn ${MKLDNN_LIB} ${MKLML_LIB} ${MKLML_IOMP_LIB}) +ADD_DEPENDENCIES(mkldnn ${MKLDNN_PROJECT}) diff --git a/paddle/operators/tensor.save b/paddle/operators/tensor.save index c24308a7d0131b84c28c0a9857cce4949afb2091..de6cd5a66a26e9e8f2bee245cf17ec190c5c1e05 100644 GIT binary patch delta 13 UcmX@de2JNnVe)K7;|=o|0UwzJSpWb4 delta 11 Scmcb_e2#ge$vno1ECv7@nFH_u -- GitLab