Skip to content

Commit

Permalink
Update project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Apr 17, 2022
1 parent 919d5bd commit ed82967
Show file tree
Hide file tree
Showing 87 changed files with 22,185 additions and 15,713 deletions.
288 changes: 170 additions & 118 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,137 +1,189 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
# Main style properties
Language: Cpp
Standard: Latest
BasedOnStyle: Microsoft

# Columns and Lines
ColumnLimit: 80
ReflowComments: true
TabWidth: 8
UseCRLF: false
UseTab: Never
DeriveLineEnding: true

# Breaking around braces
BreakBeforeBraces: Custom
BraceWrapping:
# Control
AfterControlStatement: MultiLine
AfterCaseLabel: true
BeforeCatch: true
BeforeElse: false
BeforeWhile: true
# Definition
AfterNamespace: false
AfterStruct: true
AfterClass: true
SplitEmptyRecord: false
AfterFunction: false
SplitEmptyFunction: false
BeforeLambdaBody: false
AfterEnum: true
SplitEmptyNamespace: true
AfterUnion: true
AfterExternBlock: true
# Extra
IndentBraces: false

# Breaking around specifiers
# Namespaces
CompactNamespaces: false
# Templates
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeConceptDeclarations: true
# Classes
BreakInheritanceList: BeforeComma
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Leave
# Functions
AlwaysBreakAfterDefinitionReturnType: All
AlwaysBreakAfterReturnType: All
MaxEmptyLinesToKeep: 2
# Strings
AlwaysBreakBeforeMultilineStrings: false
BreakStringLiterals: true
# Expressions
BreakConstructorInitializers: BeforeColon
BreakBeforeBinaryOperators: All
BreakBeforeTernaryOperators: false

# Breaking single line blocks
# Control
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
# Declarations
AllowShortEnumsOnASingleLine: false
# Function
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: Inline
# Expressions
AllowAllArgumentsOnNextLine: false

# Indentation
# Parameters
IndentWidth: 4
# Definitions
NamespaceIndentation: All
IndentExternBlock: NoIndent
IndentPPDirectives: AfterHash
# Classes
AccessModifierOffset: -4
IndentAccessModifiers: false
# Templates
IndentRequires: false
# Functions
IndentWrappedFunctionNames: false
LambdaBodyIndentation: OuterScope
# Control
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseBlocks: false
IndentCaseLabels: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
# Expressions
ContinuationIndentWidth: 4
InsertTrailingCommas: None
KeepEmptyLinesAtTheStartOfBlocks: false

# Alignment
# Macros
AlignConsecutiveMacros: Consecutive
AttributeMacros: ['SMALL_CONSTEXPR']
# Declaration
PointerAlignment: Left
ReferenceAlignment: Pointer
DerivePointerAlignment: true
AlignConsecutiveDeclarations: None
# Namespace
ShortNamespaceLines: 0
# Brackets
AlignAfterOpenBracket: AlwaysBreak
# Expressions
AlignArrayOfStructures: Right
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true

# Spaces
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeRangeBasedForLoopColon: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
SpacesBeforeTrailingComments: 1
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInAngles: Never
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
...
Cpp11BracedListStyle: false

# BinPack
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: After
ExperimentalAutoDetectBinPacking: true

# Penalties
PenaltyBreakAssignment: 512
PenaltyBreakBeforeFirstCallParameter: 512
PenaltyBreakComment: 512
PenaltyBreakFirstLessLess: 512
PenaltyBreakString: 512
PenaltyBreakTemplateDeclaration: 512
PenaltyExcessCharacter: 256
PenaltyIndentedWhitespace: 8
PenaltyReturnTypeOnItsOwnLine: 2

# Sorting
SortIncludes: CaseInsensitive
SortUsingDeclarations: true
IncludeBlocks: Merge
IncludeCategories:
- Regex: '^["<]small/.*/detail/prologue.hpp' # config
Priority: 1
- Regex: '^["<]small/.*/detail/epilogue.hpp' # config
Priority: 10
- Regex: '^["<]small/config/' # config
Priority: 2
- Regex: '^["<]small/detail/config.hpp' # config
Priority: 2
- Regex: '^["<]small/.*/detail/' # details
Priority: 4
- Regex: '^["<]small/detail/' # details
Priority: 4
- Regex: '^["<]small/' # internal
Priority: 3
- Regex: '^(["<](boost)/)' # external
Priority: 5
- Regex: '<[[:alnum:].]+>' # C++
Priority: 6
- Regex: '.*' # any other
Priority: 7

# Comments
FixNamespaceComments: true
CommentPragmas: '^ clang-format'
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
cmake_minimum_required(VERSION 3.15)
project(
small
VERSION 0.1.3
VERSION 0.2.0
DESCRIPTION "C++ small containers"
HOMEPAGE_URL "https://alandefreitas.github.io/small"
)
Expand Down Expand Up @@ -40,7 +40,7 @@ include(cmake/small/dev-options.cmake)
#######################################################
### Libraries ###
#######################################################
add_subdirectory(source)
add_subdirectory(include)

#######################################################
### Installer ###
Expand All @@ -56,10 +56,10 @@ if (SMALL_BUILD_INSTALLER)
# Install headers
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/small
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
FILES_MATCHING PATTERN "*.hpp"
)

# Install cmake script
# Install cmake targets script
install(EXPORT small-targets
FILE small-targets.cmake
NAMESPACE small::
Expand Down Expand Up @@ -144,7 +144,7 @@ add_subdirectory(dev-tools)
if (SMALL_BUILD_TESTS)
include(CTest)
enable_testing()
add_subdirectory(tests)
add_subdirectory(test)
endif ()

if (SMALL_BUILD_DOCS)
Expand Down
7 changes: 0 additions & 7 deletions cmake/small/dev-options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ endif()
option(SMALL_BUILD_TESTS "Build tests" ON)
option(SMALL_BUILD_EXAMPLES "Build examples" ON)

if (APPLE OR CLANG)
set(DEFAULT_SMALL_BUILD_TESTS_WITH_PCH OFF)
else()
set(DEFAULT_SMALL_BUILD_TESTS_WITH_PCH ${SMALL_DEV_BUILD})
endif()
option(SMALL_BUILD_TESTS_WITH_PCH "Build tests with precompiled headers" ${DEFAULT_SMALL_BUILD_TESTS_WITH_PCH})

# Custom targets
option(SMALL_BUILD_DOCS "Build documentation" OFF)
option(SMALL_BUILD_COVERAGE_REPORT "Enable coverage support" OFF)
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/linter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ add_custom_target(
lint_small
COMMAND linter
# Files
--include_paths "${SMALL_ROOT_DIR}/source"
--include_paths "${SMALL_ROOT_DIR}/include"
# Linter options
--show_progress
# CMake command options
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ if (SMALL_BUILD_TESTS)
COMMAND unicode_strings-example)
add_test(NAME associative-example-as-test
COMMAND associative-example)
endif()
endif ()
Loading

0 comments on commit ed82967

Please sign in to comment.