Skip to content

Commit 94042cc

Browse files
committed
add comment
1 parent 64c0ba2 commit 94042cc

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

cmake/external/anakin.cmake

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ SET(ANAKIN_SABER_LIB ${ANAKIN_LIBRARY}/libanakin_saber_common.so)
1414
# nearly all the header files.
1515
function(fetch_include_recursively root_dir)
1616
if (IS_DIRECTORY ${root_dir})
17-
include_directories(${root_dir})
17+
include_directories(BEFORE ${root_dir})
1818
endif()
1919

2020
file(GLOB ALL_SUB RELATIVE ${root_dir} ${root_dir}/*)
@@ -26,20 +26,6 @@ function(fetch_include_recursively root_dir)
2626
endfunction()
2727
fetch_include_recursively(${ANAKIN_INCLUDE})
2828

29-
# A nother helper function used in Anakin.
30-
function(target_fetch_include_recursively root_dir target_name)
31-
if (IS_DIRECTORY ${root_dir})
32-
target_include_directories(${target_name} PUBLIC ${root_dir})
33-
endif()
34-
35-
file(GLOB ALL_SUB RELATIVE ${root_dir} ${root_dir}/*)
36-
foreach(sub ${ALL_SUB})
37-
if (IS_DIRECTORY ${root_dir}/${sub})
38-
target_include_directories(${target_name} PUBLIC ${root_dir}/${sub})
39-
endif()
40-
endforeach()
41-
endfunction()
42-
4329
set(ANAKIN_COMPILE_EXTRA_FLAGS
4430
-Wno-error=unused-but-set-variable -Wno-unused-but-set-variable
4531
-Wno-error=unused-variable -Wno-unused-variable
@@ -56,6 +42,7 @@ set(ANAKIN_COMPILE_EXTRA_FLAGS
5642
ExternalProject_Add(
5743
extern_anakin
5844
${EXTERNAL_PROJECT_LOG_ARGS}
45+
# TODO(luotao): use PaddlePaddle/Anakin later
5946
GIT_REPOSITORY "https://github.com/luotao1/Anakin"
6047
GIT_TAG "3957ae9263eaa0b1986758dac60a88852afb09be"
6148
PREFIX ${ANAKIN_SOURCE_DIR}
@@ -73,6 +60,7 @@ ExternalProject_Add(
7360
message(STATUS "Anakin for inference is enabled")
7461
message(STATUS "Anakin is set INCLUDE:${ANAKIN_INCLUDE} LIBRARY:${ANAKIN_LIBRARY}")
7562

63+
fetch_include_recursively(${ANAKIN_INCLUDE})
7664
add_dependencies(extern_anakin protobuf mklml)
7765
add_library(anakin SHARED IMPORTED GLOBAL)
7866
set_property(TARGET anakin PROPERTY IMPORTED_LOCATION ${ANAKIN_SHARED_LIB})

paddle/fluid/inference/api/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ endif()
6262

6363
if (WITH_ANAKIN) # only needed in CI
6464
# compile the libinference_anakin_api.a and anakin.so.
65+
fetch_include_recursively(${ANAKIN_INCLUDE})
6566
nv_library(inference_anakin_api SRCS api.cc api_anakin_engine.cc DEPS anakin)
6667
nv_library(inference_anakin_api_shared SHARED SRCS api.cc api_anakin_engine.cc DEPS anakin)
6768
set(ANAKIN_DEPS_LIB ${ANAKIN_SHARED_LIB} ${ANAKIN_SABER_LIB} ${CUDNN_LIBRARY})
6869
function(anakin_target target_name)
69-
target_fetch_include_recursively(${ANAKIN_INCLUDE} ${target_name})
7070
target_compile_options(${target_name} BEFORE PUBLIC ${ANAKIN_COMPILE_EXTRA_FLAGS})
7171
target_link_libraries(${target_name} ${ANAKIN_DEPS_LIB})
7272
endfunction()

0 commit comments

Comments
 (0)