Add code quality checks and formatting configuration
- Introduced a .clang-format file to enforce Google C++ style guidelines across the codebase. - Updated CMakeLists.txt to include custom targets for formatting and format-checking using clang-format. - Added a quality_check.sh script to automate code quality checks, including formatting and static analysis with cppcheck. - Enhanced CMakePresets.json with new macOS-specific configurations for ARM64 and universal binaries, improving build flexibility and support.
This commit is contained in:
@@ -127,6 +127,26 @@ if (YAZE_BUILD_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
# Code quality targets
|
||||
find_program(CLANG_FORMAT NAMES clang-format clang-format-14 clang-format-15 clang-format-16 clang-format-17 clang-format-18)
|
||||
if(CLANG_FORMAT)
|
||||
file(GLOB_RECURSE ALL_SOURCE_FILES
|
||||
"${CMAKE_SOURCE_DIR}/src/*.cc"
|
||||
"${CMAKE_SOURCE_DIR}/src/*.h"
|
||||
"${CMAKE_SOURCE_DIR}/test/*.cc"
|
||||
"${CMAKE_SOURCE_DIR}/test/*.h")
|
||||
|
||||
add_custom_target(format
|
||||
COMMAND ${CLANG_FORMAT} -i --style=Google ${ALL_SOURCE_FILES}
|
||||
COMMENT "Running clang-format on source files"
|
||||
)
|
||||
|
||||
add_custom_target(format-check
|
||||
COMMAND ${CLANG_FORMAT} --dry-run --Werror --style=Google ${ALL_SOURCE_FILES}
|
||||
COMMENT "Checking code format"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Packaging configuration
|
||||
include(cmake/packaging.cmake)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user