mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-05 12:30:39 +02:00
add formatting to cmake
This commit is contained in:
parent
2e4eec0c8a
commit
76c0f7a757
6
.github/workflows/format.yml
vendored
6
.github/workflows/format.yml
vendored
@ -11,9 +11,13 @@ jobs:
|
||||
# find all examples in build/examples and run them
|
||||
run: |
|
||||
pwd
|
||||
find -name "*.cpp" -not -path "./build/*" | xargs -I {} -n 1 -P 10 clang-format {} -Werror --dry-run -style='file:.clang-format'
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build . --target=check-format
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -164,3 +164,22 @@ add_subdirectory(examples)
|
||||
if(AARE_PYTHON_BINDINGS)
|
||||
add_subdirectory(python)
|
||||
endif()
|
||||
|
||||
|
||||
# custom target to run check formatting with clang-format
|
||||
add_custom_target(
|
||||
check-format
|
||||
COMMAND find \( -name "*.cpp" -o -name "*.hpp" \) -not -path "./build/*" | xargs -I {} -n 1 -P 10 bash -c "clang-format -Werror -style=\"file:.clang-format\" {} | diff {} -"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Checking code formatting with clang-format"
|
||||
VERBATIM
|
||||
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
format-files
|
||||
COMMAND find \( -name "*.cpp" -o -name "*.hpp" \) -not -path "./build/*" | xargs -I {} -n 1 -P 10 bash -c "clang-format -i -style=\"file:.clang-format\" {}"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Formatting with clang-format"
|
||||
VERBATIM
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user