diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..72c0613 --- /dev/null +++ b/.clang-format @@ -0,0 +1,67 @@ +--- +Language: Cpp +BasedOnStyle: LLVM + +# Indentation +IndentWidth: 4 # 4 spaces per indent +AccessModifierOffset: -4 +IndentAccessModifiers: false # Align access modifiers to braces +NamespaceIndentation: Inner # Indent namspace contents + +# Alignment +AlignConsecutiveAssignments: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true + AlignCompound: true + PadOperators: true +AlignConsecutiveBitFields: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true +AlignConsecutiveDeclarations: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true + # For future versions of clang-format + # AlignFunctionDeclarations: false + # AlignFunctionPointers: false +AlignConsecutiveMacros: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true + +# Newlines +ColumnLimit: 120 +BreakBeforeBraces: Allman # Braces on their own lines +SeparateDefinitionBlocks: Always # Separate definitions (functions etc.) with an empty line +AlwaysBreakTemplateDeclarations: true # Put template on their own lines +AllowShortBlocksOnASingleLine: Never +# On a newer version of clang-format, replace with BinPackArguments: OnePerLine +BinPackArguments: false # Don't allow multiple function arguments on the same line unless they all fit +BinPackParameters: false # Same but for parameters +PackConstructorInitializers: NextLine +AllowShortFunctionsOnASingleLine: None + +# Spaces +SpaceBeforeParens: ControlStatementsExceptControlMacros +SpaceAfterCStyleCast: true +PointerAlignment: Left + +# Includes +IncludeBlocks: Regroup # Regroup includes based on config +IncludeCategories: + - Regex: '(^"|\.hpp)' # 'local' includes + Priority: 3 + SortPriority: 0 + CaseSensitive: false + - Regex: '\/' # Library includes + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' # Everything else + Priority: 1 + SortPriority: 0 + CaseSensitive: false +... + diff --git a/README.md b/README.md index 600516e..a2a14e3 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,9 @@ You should have all of the following installed before installing GridKit™ - [CMake](https://cmake.org/) >= 3.12 - C++ 17 compliant compiler +#### Developer Dependencies +- `clang-format`, which can be obtained through most linux distribution package managers, or through the [LLVM project](https://github.com/llvm/llvm-project) >= 15.0.0 + ### Installing GridKit™ uses CMake for build configuration. Per CMake best practices it is recommended