diff --git a/.clang-format b/.clang-format index 59281193..072567c7 100644 --- a/.clang-format +++ b/.clang-format @@ -1,12 +1,13 @@ AccessModifierOffset: 0 AlignEscapedNewlinesLeft: true -AlignTrailingComments: false +AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: false AllowShortFunctionsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: false +BinPackArguments: false BinPackParameters: false BreakBeforeBinaryOperators: false BreakBeforeTernaryOperators: false @@ -30,7 +31,7 @@ CommentPragmas: '' ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 0 ContinuationIndentWidth: 0 -Cpp11BracedListStyle: true +Cpp11BracedListStyle: false DerivePointerAlignment: false IndentCaseLabels: true IndentWidth: 4 diff --git a/CMakeLists.txt b/CMakeLists.txt index bdd0b47d..cd6d728c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -334,9 +334,9 @@ find_program( CLANG_TIDY message ( STATUS "Found clang-tidy" ) # whenever clang-tidy is available, use it to automatically add braces after ever "make" if ( WITH_PROFILING ) -# set ( CMAKE_C_CLANG_TIDY "clang-tidy" ) + set ( CMAKE_C_CLANG_TIDY "clang-tidy" ) else ( WITH_PROFILING ) -# set ( CMAKE_C_CLANG_TIDY "clang-tidy;-checks=-*,readability-braces-around-statements;-format-style=file" ) + set ( CMAKE_C_CLANG_TIDY "clang-tidy;-checks=-*,readability-braces-*;-format-style=file" ) endif ( WITH_PROFILING ) endif ( CLANG_TIDY ) endif ( CMAKE_VERSION VERSION_GREATER "3.6.0" ) @@ -356,17 +356,33 @@ file(GLOB_RECURSE ) # Adding clang-format target if executable is found -find_program ( CLANG_FORMAT "clang-format" ) -if ( CLANG_FORMAT ) +# find_program ( CLANG_FORMAT "clang-format" ) +# if ( CLANG_FORMAT ) +# add_custom_target( +# clang-format +# COMMAND ${CLANG_FORMAT} +# -i +# -style=file +# ${ALL_SOURCE_FILES} +# ) +# endif(CLANG_FORMAT) + +find_program ( ASTYLE "astyle" ) +if ( ASTYLE ) add_custom_target( format - COMMAND ${CLANG_FORMAT} - -i - -style=file + COMMAND ${ASTYLE} + -A1 + -xb + -j + -k3 + -p + -f + -n + -U ${ALL_SOURCE_FILES} ) -endif(CLANG_FORMAT) - +endif(ASTYLE) if(NOT enable-pkgconfig)