Support clang-tidy (#1034)

This commit is contained in:
Fangjun Kuang
2024-06-19 20:51:57 +08:00
committed by GitHub
parent 656b9fa1c8
commit a11c859971
63 changed files with 381 additions and 237 deletions

View File

@@ -534,3 +534,17 @@ if(SHERPA_ONNX_ENABLE_TESTS)
sherpa_onnx_add_test(${source})
endforeach()
endif()
set(srcs_to_check)
foreach(s IN LISTS sources)
list(APPEND srcs_to_check ${CMAKE_CURRENT_LIST_DIR}/${s})
endforeach()
# For clang-tidy
add_custom_target(
clang-tidy-check
clang-tidy -p ${CMAKE_BINARY_DIR}/compile_commands.json --config-file ${CMAKE_SOURCE_DIR}/.clang-tidy ${srcs_to_check}
DEPENDS ${sources})
add_custom_target(check DEPENDS clang-tidy-check)