未验证 提交 d62af8b4 编写于 作者: L Leo Chen 提交者: GitHub

refine overalls.cmake (#44623)

上级 ce7c7995
......@@ -75,36 +75,21 @@ if(WITH_COVERAGE)
"${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
endif()
set(EXCLUDE_DIRS "demo/" "build/" "tests/" ".test_env/")
if(WITH_GPU)
file(
GLOB_RECURSE PADDLE_SOURCES
RELATIVE "${PROJECT_SOURCE_DIR}"
"*.cpp" "*.cc" ".c" "*.cu")
GLOB_RECURSE
PADDLE_SOURCES
"${PROJECT_SOURCE_DIR}/paddle/*.cpp"
"${PROJECT_SOURCE_DIR}/paddle/*.cc"
"${PROJECT_SOURCE_DIR}/paddle/*.cu"
"${PROJECT_SOURCE_DIR}/paddle/*.cu.cc"
"${PROJECT_SOURCE_DIR}/paddle/*.c")
else()
file(
GLOB_RECURSE PADDLE_SOURCES
RELATIVE "${PROJECT_SOURCE_DIR}"
"*.cpp" "*.cc" "*.c")
file(GLOB_RECURSE PADDLE_SOURCES "${PROJECT_SOURCE_DIR}/paddle/*.cpp"
"${PROJECT_SOURCE_DIR}/paddle/*.cc" "${PROJECT_SOURCE_DIR}/paddle/*.c")
endif()
# exclude trivial files in PADDLE_SOURCES
foreach(EXCLUDE_DIR ${EXCLUDE_DIRS})
foreach(TMP_PATH ${PADDLE_SOURCES})
string(FIND ${TMP_PATH} ${EXCLUDE_DIR} EXCLUDE_DIR_FOUND)
if(NOT ${EXCLUDE_DIR_FOUND} EQUAL -1)
list(REMOVE_ITEM PADDLE_SOURCES ${TMP_PATH})
endif()
endforeach()
endforeach()
# convert to absolute path
set(PADDLE_SRCS "")
foreach(PADDLE_SRC ${PADDLE_SOURCES})
set(PADDLE_SRCS "${PADDLE_SRCS};${PROJECT_SOURCE_DIR}/${PADDLE_SRC}")
endforeach()
code_coverage("${PADDLE_SRCS}" ${COVERALLS_UPLOAD}
"${PROJECT_SOURCE_DIR}/cmake")
endif()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册