Skip to content
Snippets Groups Projects
Verified Commit 153c035a authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Adding a clang format configuration and target

parent 50d7101e
No related branches found
No related tags found
No related merge requests found
BasedOnStyle: WebKit
IndentWidth: 4
ColumnLimit: 100
Language: Cpp
Standard: c++20
DerivePointerAlignment: false
PointerAlignment: Left
ReferenceAlignment: Right
SortIncludes: CaseSensitive
AccessModifierOffset: -4
AlignAfterOpenBracket: true
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: None
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach
BreakBeforeConceptDeclarations: true
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: Yes
EmptyLineBeforeAccessModifier: Always
BinPackParameters: true
ReflowComments: true
ShortNamespaceLines: 0
NamespaceIndentation: All
FixNamespaceComments: true
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Leave
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
TabWidth: 4
UseTab: Never
UseCRLF: false
...@@ -4,6 +4,7 @@ project(vkcv) ...@@ -4,6 +4,7 @@ project(vkcv)
# cmake options # cmake options
option(BUILD_MODULES "Enables building VkCV as shared libraries" ON) option(BUILD_MODULES "Enables building VkCV as shared libraries" ON)
option(BUILD_PROJECTS "Enables building the VkCV projects" ON) option(BUILD_PROJECTS "Enables building the VkCV projects" ON)
option(BUILD_CLANG_FORMAT "Enables formatting the source code" ON)
option(BUILD_DOXYGEN_DOCS "Enables building the VkCV doxygen documentation" OFF) option(BUILD_DOXYGEN_DOCS "Enables building the VkCV doxygen documentation" OFF)
option(BUILD_SHARED "Enables building VkCV as shared libraries" OFF) option(BUILD_SHARED "Enables building VkCV as shared libraries" OFF)
option(BUILD_VMA_VULKAN_VERSION "Enforce a specific Vulkan version for VMA" OFF) option(BUILD_VMA_VULKAN_VERSION "Enforce a specific Vulkan version for VMA" OFF)
...@@ -15,6 +16,7 @@ endif() ...@@ -15,6 +16,7 @@ endif()
message(STATUS "Options:") message(STATUS "Options:")
message(" - BUILD_MODULES: ${BUILD_MODULES}") message(" - BUILD_MODULES: ${BUILD_MODULES}")
message(" - BUILD_PROJECTS: ${BUILD_PROJECTS}") message(" - BUILD_PROJECTS: ${BUILD_PROJECTS}")
message(" - BUILD_CLANG_FORMAT: ${BUILD_CLANG_FORMAT}")
message(" - BUILD_DOXYGEN_DOCS: ${BUILD_DOXYGEN_DOCS}") message(" - BUILD_DOXYGEN_DOCS: ${BUILD_DOXYGEN_DOCS}")
message(" - BUILD_SHARED: ${BUILD_SHARED}") message(" - BUILD_SHARED: ${BUILD_SHARED}")
......
...@@ -112,4 +112,17 @@ set(vkcv_sources ...@@ -112,4 +112,17 @@ set(vkcv_sources
${vkcv_include}/vkcv/BlitDownsampler.hpp ${vkcv_include}/vkcv/BlitDownsampler.hpp
${vkcv_source}/vkcv/BlitDownsampler.cpp ${vkcv_source}/vkcv/BlitDownsampler.cpp
${vkcv_include}/vkcv/Sampler.hpp
${vkcv_include}/vkcv/Result.hpp
) )
if (BUILD_CLANG_FORMAT)
message(STATUS "Clang-Format: ON")
# add clang-format as target if installed
include(${vkcv_config}/ext/ClangFormat.cmake)
else()
message(STATUS "Clang-Format: OFF")
endif()
if (EXISTS "/usr/bin/clang-format")
# note the option ALL which allows to format the source together with the application
add_custom_target( clang_format ALL
COMMAND /usr/bin/clang-format -style=file --sort-includes -i ${vkcv_sources}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Formatting code with Clang-Format"
VERBATIM )
else ()
message(WARNING "Doxygen need to be installed to generate the doxygen documentation")
endif ()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment