Set up auto-formatter
This commit is contained in:
parent
21cf170b5a
commit
5c49bb98ce
21
.clang-format
Normal file
21
.clang-format
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
BasedOnStyle: WebKit
|
||||||
|
AlignAfterOpenBracket: AlwaysBreak
|
||||||
|
AlignConsecutiveMacros: false
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignEscapedNewlines: DontAlign
|
||||||
|
AlignOperands: false
|
||||||
|
AlignTrailingComments: false
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: ForIndentation
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
PointerAlignment: Right
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: true
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
ColumnLimit: 77
|
||||||
|
...
|
@ -14,6 +14,15 @@ macro(set_default_target_options target)
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
add_custom_target(format
|
||||||
|
COMMAND sh ${CMAKE_SOURCE_DIR}/scripts/format.sh
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
add_custom_target(check-format
|
||||||
|
COMMAND sh ${CMAKE_SOURCE_DIR}/scripts/check-format.sh
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
add_subdirectory(engine)
|
add_subdirectory(engine)
|
||||||
|
|
||||||
if (${TESTS})
|
if (${TESTS})
|
||||||
|
2
scripts/check-format.sh
Executable file
2
scripts/check-format.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
scripts_dir=`dirname $0`
|
||||||
|
sh "$scripts_dir/sources.sh" | xargs -n 1 clang-format --dry-run --Werror
|
2
scripts/format.sh
Executable file
2
scripts/format.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
scripts_dir=`dirname $0`
|
||||||
|
sh "$scripts_dir/sources.sh" | xargs -n 1 clang-format -i
|
3
scripts/sources.sh
Executable file
3
scripts/sources.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
root=`git rev-parse --show-toplevel`
|
||||||
|
find "$root/engine" "$root/tests" -name '*.c' -o -name '*.h'
|
Loading…
x
Reference in New Issue
Block a user