Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions cmake/inference_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ function(copy_part_of_thrid_party TARGET DST)
copy(${TARGET}
SRCS ${MKLML_LIB} ${MKLML_IOMP_LIB} ${MKLML_INC_DIR}
DSTS ${dst_dir}/lib ${dst_dir}/lib ${dst_dir})
if(WITH_STRIP)
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND strip -s ${dst_dir}/lib/libiomp5.so
COMMAND strip -s ${dst_dir}/lib/libmklml_intel.so
COMMENT "striping libiomp5.so\nstriping libmklml_intel.so")
endif()
endif()
elseif(${CBLAS_PROVIDER} STREQUAL EXTERN_OPENBLAS)
set(dst_dir "${DST}/third_party/install/openblas")
Expand All @@ -94,8 +100,17 @@ function(copy_part_of_thrid_party TARGET DST)
DSTS ${dst_dir} ${dst_dir}/lib ${dst_dir}/lib)
else()
copy(${TARGET}
SRCS ${MKLDNN_INC_DIR} ${MKLDNN_SHARED_LIB} ${MKLDNN_SHARED_LIB_1} ${MKLDNN_SHARED_LIB_2}
DSTS ${dst_dir} ${dst_dir}/lib ${dst_dir}/lib ${dst_dir}/lib)
SRCS ${MKLDNN_INC_DIR} ${MKLDNN_SHARED_LIB}
DSTS ${dst_dir} ${dst_dir}/lib)
if(WITH_STRIP)
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND strip -s ${dst_dir}/lib/libmkldnn.so.0
COMMENT "striping libmkldnn.so.0")
endif()
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink libmkldnn.so.0 ${dst_dir}/lib/libdnnl.so.1
COMMAND ${CMAKE_COMMAND} -E create_symlink libmkldnn.so.0 ${dst_dir}/lib/libdnnl.so.2
COMMENT "Make a symbol link of libmkldnn.so.0")
endif()
endif()

Expand Down Expand Up @@ -225,6 +240,13 @@ copy(inference_lib_dist
SRCS ${src_dir}/inference/capi_exp/pd_*.h ${paddle_inference_c_lib}
DSTS ${PADDLE_INFERENCE_C_INSTALL_DIR}/paddle/include ${PADDLE_INFERENCE_C_INSTALL_DIR}/paddle/lib)

if(WITH_STRIP AND NOT WIN32)
add_custom_command(TARGET inference_lib_dist POST_BUILD
COMMAND strip -s ${PADDLE_INFERENCE_C_INSTALL_DIR}/paddle/lib/libpaddle_inference_c.so
COMMAND strip -s ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/lib/libpaddle_inference.so
COMMENT "striping libpaddle_inference_c.so\nstriping libpaddle_inference.so")
endif()

# fluid library for both train and inference
set(fluid_lib_deps inference_lib_dist)
add_custom_target(fluid_lib_dist ALL DEPENDS ${fluid_lib_deps})
Expand Down