From 521e70152fad840e9037a2c151e52f1831e3b244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E6=99=93=E4=BC=9F?= <39303645+Shixiaowei02@users.noreply.github.com> Date: Wed, 29 Jul 2020 17:17:07 +0800 Subject: [PATCH] fix cmake of lite, test=develop (#25680) --- cmake/external/lite.cmake | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/cmake/external/lite.cmake b/cmake/external/lite.cmake index 978b042712..b541d73bc6 100644 --- a/cmake/external/lite.cmake +++ b/cmake/external/lite.cmake @@ -18,6 +18,15 @@ if(NOT LINUX OR NOT WITH_MKL) return() endif() +if(XPU_SDK_ROOT) + set(LITE_WITH_XPU ON) + include_directories("${XPU_SDK_ROOT}/XTDK/include") + include_directories("${XPU_SDK_ROOT}/XTCL/include") + add_definitions(-DPADDLE_WITH_XPU) + LINK_DIRECTORIES("${XPU_SDK_ROOT}/XTDK/shlib/") + LINK_DIRECTORIES("${XPU_SDK_ROOT}/XTDK/runtime/shlib/") +endif() + if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR) include(ExternalProject) set(LITE_PROJECT extern_lite) @@ -47,6 +56,8 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR) -DCUDNN_ROOT=${CUDNN_ROOT} -DLITE_WITH_STATIC_CUDA=OFF -DCUDA_ARCH_NAME=${CUDA_ARCH_NAME} + -DLITE_WITH_XPU=${LITE_WITH_XPU} + -DXPU_SDK_ROOT=${XPU_SDK_ROOT} -DLITE_WITH_ARM=OFF) ExternalProject_Add( @@ -95,13 +106,5 @@ endfunction() external_lite_libs(lite_full_static ${LITE_BINARY_DIR}/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so) set(LITE_SHARED_LIB ${LITE_BINARY_DIR}/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so) -if(XPU_SDK_ROOT) - include_directories("${XPU_SDK_ROOT}/XTDK/include") - include_directories("${XPU_SDK_ROOT}/XTCL/include") - add_definitions(-DPADDLE_WITH_XPU) - LINK_DIRECTORIES("${XPU_SDK_ROOT}/XTDK/shlib/") - LINK_DIRECTORIES("${XPU_SDK_ROOT}/XTDK/runtime/shlib/") -endif() - add_definitions(-DPADDLE_WITH_LITE) add_definitions(-DLITE_WITH_LOG) -- GitLab