From 4f1da4adcb1aec2dd37eb35aabae526e3adf7904 Mon Sep 17 00:00:00 2001 From: silingtong123 <35439432+silingtong123@users.noreply.github.com> Date: Tue, 14 Jan 2020 16:55:18 +0800 Subject: [PATCH] remove the useless third_party library from C++ inference library (#22021) * remove the useless third_party library from C++ inference library * revert removing the install directory --- cmake/inference_lib.cmake | 50 +++++++++---------- .../inference/api/demo_ci/CMakeLists.txt | 8 +-- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/cmake/inference_lib.cmake b/cmake/inference_lib.cmake index 4c92d0ba4f..4d0e777af8 100644 --- a/cmake/inference_lib.cmake +++ b/cmake/inference_lib.cmake @@ -104,6 +104,11 @@ function(copy_part_of_thrid_party TARGET DST) copy(${TARGET} SRCS ${GLOG_INCLUDE_DIR} ${GLOG_LIBRARIES} DSTS ${dst_dir} ${dst_dir}/lib) + + set(dst_dir "${DST}/third_party/install/xxhash") + copy(${TARGET} + SRCS ${XXHASH_INCLUDE_DIR} ${XXHASH_LIBRARIES} + DSTS ${dst_dir} ${dst_dir}/lib) if (NOT PROTOBUF_FOUND OR WIN32) set(dst_dir "${DST}/third_party/install/protobuf") @@ -138,31 +143,6 @@ endfunction() set(inference_lib_deps third_party paddle_fluid paddle_fluid_c paddle_fluid_shared paddle_fluid_c_shared) add_custom_target(inference_lib_dist DEPENDS ${inference_lib_deps}) -set(dst_dir "${FLUID_INFERENCE_INSTALL_DIR}/third_party/eigen3") -copy(inference_lib_dist - SRCS ${EIGEN_INCLUDE_DIR}/Eigen/Core ${EIGEN_INCLUDE_DIR}/Eigen/src ${EIGEN_INCLUDE_DIR}/unsupported/Eigen - DSTS ${dst_dir}/Eigen ${dst_dir}/Eigen ${dst_dir}/unsupported) - -set(dst_dir "${FLUID_INFERENCE_INSTALL_DIR}/third_party/boost") -copy(inference_lib_dist - SRCS ${BOOST_INCLUDE_DIR}/boost - DSTS ${dst_dir}) - -set(dst_dir "${FLUID_INFERENCE_INSTALL_DIR}/third_party/dlpack") -copy(inference_lib_dist - SRCS ${DLPACK_INCLUDE_DIR}/dlpack - DSTS ${dst_dir}) - -set(dst_dir "${FLUID_INFERENCE_INSTALL_DIR}/third_party/install/xxhash") -copy(inference_lib_dist - SRCS ${XXHASH_INCLUDE_DIR} ${XXHASH_LIBRARIES} - DSTS ${dst_dir} ${dst_dir}/lib) - -set(dst_dir "${FLUID_INFERENCE_INSTALL_DIR}/third_party/install/zlib") -copy(inference_lib_dist - SRCS ${ZLIB_INCLUDE_DIR} ${ZLIB_LIBRARIES} - DSTS ${dst_dir} ${dst_dir}/lib) - copy(inference_lib_dist SRCS ${CMAKE_CURRENT_BINARY_DIR}/CMakeCache.txt DSTS ${FLUID_INFERENCE_INSTALL_DIR}) @@ -253,6 +233,26 @@ copy(fluid_lib_dist DSTS ${dst_dir}/${module} ) +set(dst_dir "${FLUID_INSTALL_DIR}/third_party/eigen3") +copy(inference_lib_dist + SRCS ${EIGEN_INCLUDE_DIR}/Eigen/Core ${EIGEN_INCLUDE_DIR}/Eigen/src ${EIGEN_INCLUDE_DIR}/unsupported/Eigen + DSTS ${dst_dir}/Eigen ${dst_dir}/Eigen ${dst_dir}/unsupported) + +set(dst_dir "${FLUID_INSTALL_DIR}/third_party/boost") +copy(inference_lib_dist + SRCS ${BOOST_INCLUDE_DIR}/boost + DSTS ${dst_dir}) + +set(dst_dir "${FLUID_INSTALL_DIR}/third_party/dlpack") +copy(inference_lib_dist + SRCS ${DLPACK_INCLUDE_DIR}/dlpack + DSTS ${dst_dir}) + +set(dst_dir "${FLUID_INSTALL_DIR}/third_party/install/zlib") +copy(inference_lib_dist + SRCS ${ZLIB_INCLUDE_DIR} ${ZLIB_LIBRARIES} + DSTS ${dst_dir} ${dst_dir}/lib) + # CMakeCache Info copy(fluid_lib_dist SRCS ${FLUID_INFERENCE_INSTALL_DIR}/third_party ${CMAKE_CURRENT_BINARY_DIR}/CMakeCache.txt diff --git a/paddle/fluid/inference/api/demo_ci/CMakeLists.txt b/paddle/fluid/inference/api/demo_ci/CMakeLists.txt index f6c4bed79f..255a1bf33e 100644 --- a/paddle/fluid/inference/api/demo_ci/CMakeLists.txt +++ b/paddle/fluid/inference/api/demo_ci/CMakeLists.txt @@ -32,11 +32,7 @@ include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}protobuf/include") include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}glog/include") include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}gflags/include") include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}xxhash/include") -include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}zlib/include") -include_directories("${PADDLE_LIB}/third_party/boost") -include_directories("${PADDLE_LIB}/third_party/eigen3") -link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}zlib/lib") link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}protobuf/lib") link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}glog/lib") link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}gflags/lib") @@ -137,12 +133,12 @@ if (NOT WIN32) set(EXTERNAL_LIB "-lrt -ldl -lpthread") set(DEPS ${DEPS} ${MATH_LIB} ${MKLDNN_LIB} ${NGRAPH_LIB} - glog gflags protobuf z xxhash + glog gflags protobuf xxhash ${EXTERNAL_LIB}) else() set(DEPS ${DEPS} ${MATH_LIB} ${MKLDNN_LIB} - glog gflags_static libprotobuf zlibstatic xxhash ${EXTERNAL_LIB}) + glog gflags_static libprotobuf xxhash ${EXTERNAL_LIB}) set(DEPS ${DEPS} libcmt shlwapi.lib) endif(NOT WIN32) -- GitLab