From 94042ccd2dfe87ce821d339604a2fcd828e48a71 Mon Sep 17 00:00:00 2001 From: luotao1 Date: Thu, 9 Aug 2018 23:22:50 +0800 Subject: [PATCH] add comment --- cmake/external/anakin.cmake | 18 +++--------------- paddle/fluid/inference/api/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/cmake/external/anakin.cmake b/cmake/external/anakin.cmake index 86e91a960..37464485d 100644 --- a/cmake/external/anakin.cmake +++ b/cmake/external/anakin.cmake @@ -14,7 +14,7 @@ SET(ANAKIN_SABER_LIB ${ANAKIN_LIBRARY}/libanakin_saber_common.so) # nearly all the header files. function(fetch_include_recursively root_dir) if (IS_DIRECTORY ${root_dir}) - include_directories(${root_dir}) + include_directories(BEFORE ${root_dir}) endif() file(GLOB ALL_SUB RELATIVE ${root_dir} ${root_dir}/*) @@ -26,20 +26,6 @@ function(fetch_include_recursively root_dir) endfunction() fetch_include_recursively(${ANAKIN_INCLUDE}) -# A nother helper function used in Anakin. -function(target_fetch_include_recursively root_dir target_name) - if (IS_DIRECTORY ${root_dir}) - target_include_directories(${target_name} PUBLIC ${root_dir}) - endif() - - file(GLOB ALL_SUB RELATIVE ${root_dir} ${root_dir}/*) - foreach(sub ${ALL_SUB}) - if (IS_DIRECTORY ${root_dir}/${sub}) - target_include_directories(${target_name} PUBLIC ${root_dir}/${sub}) - endif() - endforeach() -endfunction() - set(ANAKIN_COMPILE_EXTRA_FLAGS -Wno-error=unused-but-set-variable -Wno-unused-but-set-variable -Wno-error=unused-variable -Wno-unused-variable @@ -56,6 +42,7 @@ set(ANAKIN_COMPILE_EXTRA_FLAGS ExternalProject_Add( extern_anakin ${EXTERNAL_PROJECT_LOG_ARGS} + # TODO(luotao): use PaddlePaddle/Anakin later GIT_REPOSITORY "https://github.com/luotao1/Anakin" GIT_TAG "3957ae9263eaa0b1986758dac60a88852afb09be" PREFIX ${ANAKIN_SOURCE_DIR} @@ -73,6 +60,7 @@ ExternalProject_Add( message(STATUS "Anakin for inference is enabled") message(STATUS "Anakin is set INCLUDE:${ANAKIN_INCLUDE} LIBRARY:${ANAKIN_LIBRARY}") +fetch_include_recursively(${ANAKIN_INCLUDE}) add_dependencies(extern_anakin protobuf mklml) add_library(anakin SHARED IMPORTED GLOBAL) set_property(TARGET anakin PROPERTY IMPORTED_LOCATION ${ANAKIN_SHARED_LIB}) diff --git a/paddle/fluid/inference/api/CMakeLists.txt b/paddle/fluid/inference/api/CMakeLists.txt index d3bff665c..097a9eb84 100644 --- a/paddle/fluid/inference/api/CMakeLists.txt +++ b/paddle/fluid/inference/api/CMakeLists.txt @@ -62,11 +62,11 @@ endif() if (WITH_ANAKIN) # only needed in CI # compile the libinference_anakin_api.a and anakin.so. + fetch_include_recursively(${ANAKIN_INCLUDE}) nv_library(inference_anakin_api SRCS api.cc api_anakin_engine.cc DEPS anakin) nv_library(inference_anakin_api_shared SHARED SRCS api.cc api_anakin_engine.cc DEPS anakin) set(ANAKIN_DEPS_LIB ${ANAKIN_SHARED_LIB} ${ANAKIN_SABER_LIB} ${CUDNN_LIBRARY}) function(anakin_target target_name) - target_fetch_include_recursively(${ANAKIN_INCLUDE} ${target_name}) target_compile_options(${target_name} BEFORE PUBLIC ${ANAKIN_COMPILE_EXTRA_FLAGS}) target_link_libraries(${target_name} ${ANAKIN_DEPS_LIB}) endfunction() -- GitLab