未验证 提交 086540cc 编写于 作者: W Wilber 提交者: GitHub

strip inference.so and make link to mkldnn.so (#34895)

上级 f609ca37
......@@ -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")
......@@ -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()
......@@ -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})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册