Skip to content

Commit

Permalink
ENH: add cpplint
Browse files Browse the repository at this point in the history
  • Loading branch information
gangliao committed Jul 15, 2017
1 parent 48cf64e commit 13b0dcd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmake/cpplint.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ set(IGNORE_PATTERN
.*cblas\\.h.*
.*\\.pb\\.txt
.*LtrDataProvider.*
.*MultiDataProvider.*)
.*MultiDataProvider.*
.*pb.*)

# add_style_check_target
#
Expand All @@ -52,14 +53,13 @@ macro(add_style_check_target TARGET_NAME)
endif()
endforeach()
if(LINT MATCHES ON)
# cpplint code style
get_filename_component(base_filename ${filename} NAME)
set(CUR_GEN ${CMAKE_CURRENT_BINARY_DIR}/${base_filename}.cpplint)
add_custom_command(OUTPUT ${CUR_GEN}

This comment has been minimized.

Copy link
@emailweixu

emailweixu Aug 4, 2017

Collaborator

Why change this from "OUTPUT ${CUR_GEN}" to "TARGET ${TARGET_NAME}"? After this change, the cpplint is always performed no matter whether the source is changed.

PRE_BUILD
COMMAND env ${py_env} "${PYTHON_EXECUTABLE}" "${PROJ_ROOT}/paddle/scripts/cpplint.py"
"--filter=${STYLE_FILTER}"
"--write-success=${CUR_GEN}" ${filename}
DEPENDS ${filename}

This comment has been minimized.

Copy link
@emailweixu

emailweixu Aug 4, 2017

Collaborator

Why is this removed?

add_custom_command(TARGET ${TARGET_NAME} PRE_BUILD
COMMAND "${PYTHON_EXECUTABLE}" "${PROJ_ROOT}/paddle/scripts/cpplint.py"
"--filter=${STYLE_FILTER}"
"--write-success=${CUR_GEN}" ${filename}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
endforeach()
Expand Down
4 changes: 4 additions & 0 deletions cmake/generic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ function(cc_library TARGET_NAME)
add_dependencies(${TARGET_NAME} ${cc_library_DEPS})
target_link_libraries(${TARGET_NAME} ${cc_library_DEPS})
endif()

# cpplint code style
add_style_check_target(${TARGET_NAME} ${cc_library_SRCS})

else(cc_library_SRCS)
if (cc_library_DEPS)
merge_static_libs(${TARGET_NAME} ${cc_library_DEPS})
Expand Down

0 comments on commit 13b0dcd

Please sign in to comment.